No bug - clang-format -p dom/canvas

This commit is contained in:
Jeff Gilbert 2019-03-29 23:42:18 -07:00
Родитель 758e836333
Коммит 498b71e5e9
4 изменённых файлов: 23 добавлений и 20 удалений

Просмотреть файл

@ -304,12 +304,14 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) {
////
const auto checkedSize = CheckedInt<size_t>(size);
if (!checkedSize.isValid()) return ErrorOutOfMemory("size too large for platform.");
if (!checkedSize.isValid())
return ErrorOutOfMemory("size too large for platform.");
const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u));
if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros.");
BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(), usage);
BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(),
usage);
}
void WebGLContext::BufferData(GLenum target,

Просмотреть файл

@ -284,15 +284,13 @@ void WebGLContext::GetExtension(JSContext* cx, const nsAString& wideName,
// Step 4: Enable any implied extensions.
switch (ext) {
case WebGLExtensionID::EXT_color_buffer_float:
EnableSupportedExtension(callerType,
WebGLExtensionID::EXT_float_blend);
EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend);
break;
case WebGLExtensionID::OES_texture_float:
EnableSupportedExtension(callerType,
WebGLExtensionID::WEBGL_color_buffer_float);
EnableSupportedExtension(callerType,
WebGLExtensionID::EXT_float_blend);
EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend);
break;
case WebGLExtensionID::OES_texture_half_float:
@ -301,8 +299,7 @@ void WebGLContext::GetExtension(JSContext* cx, const nsAString& wideName,
break;
case WebGLExtensionID::WEBGL_color_buffer_float:
EnableSupportedExtension(callerType,
WebGLExtensionID::EXT_float_blend);
EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend);
break;
default:

Просмотреть файл

@ -42,7 +42,8 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl)
dui = {pi.format, pi.format, pi.type};
swizzle = nullptr;
if (needsSizedFormat ||
gl->IsExtensionSupported(gl::GLContext::CHROMIUM_color_buffer_float_rgba)) {
gl->IsExtensionSupported(
gl::GLContext::CHROMIUM_color_buffer_float_rgba)) {
dui.internalFormat = LOCAL_GL_RGBA32F;
}
fnAdd(webgl::EffectiveFormat::RGBA32F);

Просмотреть файл

@ -25,20 +25,22 @@ class GLContext; // This is going to be needed a lot.
} // namespace gl
// -
// Prevent implicit conversions into calloc and malloc. (mozilla namespace only!)
// Prevent implicit conversions into calloc and malloc. (mozilla namespace
// only!)
template<typename DestT>
class ForbidNarrowing final
{
template <typename DestT>
class ForbidNarrowing final {
DestT mVal;
public:
template<typename SrcT>
public:
template <typename SrcT>
MOZ_IMPLICIT ForbidNarrowing(SrcT val) : mVal(val) {
static_assert(std::numeric_limits<SrcT>::min() >= std::numeric_limits<DestT>::min(),
"SrcT must be narrower than DestT.");
static_assert(std::numeric_limits<SrcT>::max() <= std::numeric_limits<DestT>::max(),
"SrcT must be narrower than DestT.");
static_assert(
std::numeric_limits<SrcT>::min() >= std::numeric_limits<DestT>::min(),
"SrcT must be narrower than DestT.");
static_assert(
std::numeric_limits<SrcT>::max() <= std::numeric_limits<DestT>::max(),
"SrcT must be narrower than DestT.");
}
explicit operator DestT() const { return mVal; }
@ -48,7 +50,8 @@ inline void* malloc(const ForbidNarrowing<size_t> s) {
return ::malloc(size_t(s));
}
inline void* calloc(const ForbidNarrowing<size_t> n, const ForbidNarrowing<size_t> size) {
inline void* calloc(const ForbidNarrowing<size_t> n,
const ForbidNarrowing<size_t> size) {
return ::calloc(size_t(n), size_t(size));
}