зеркало из https://github.com/mozilla/gecko-dev.git
Bug 962392 - Whitespace fixes. - r=dglastonbury
This commit is contained in:
Родитель
21279ba34c
Коммит
49b5a372fe
|
@ -39,10 +39,10 @@
|
|||
|
||||
class nsIDocShell;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Minimum value constants defined in 6.2 State Tables of OpenGL ES - 2.0.25
|
||||
* https://bugzilla.mozilla.org/show_bug.cgi?id=686732
|
||||
*
|
||||
*
|
||||
* Exceptions: some of the following values are set to higher values than in the spec because
|
||||
* the values in the spec are ridiculously low. They are explicitly marked below
|
||||
*/
|
||||
|
@ -442,7 +442,7 @@ public:
|
|||
void TexParameteri(GLenum target, GLenum pname, GLint param) {
|
||||
TexParameter_base(target, pname, ¶m, nullptr);
|
||||
}
|
||||
|
||||
|
||||
void TexSubImage2D(GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLsizei width, GLsizei height, GLenum format,
|
||||
|
@ -476,7 +476,7 @@ public:
|
|||
data->Stride(), format, type,
|
||||
data->GetData(), byteLength,
|
||||
-1, srcFormat, mPixelStorePremultiplyAlpha);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Uniform1i(WebGLUniformLocation* location, GLint x);
|
||||
|
@ -492,7 +492,7 @@ public:
|
|||
GLfloat z);
|
||||
void Uniform4f(WebGLUniformLocation* location, GLfloat x, GLfloat y,
|
||||
GLfloat z, GLfloat w);
|
||||
|
||||
|
||||
void Uniform1iv(WebGLUniformLocation* location,
|
||||
const dom::Int32Array& arr) {
|
||||
Uniform1iv_base(location, arr.Length(), arr.Data());
|
||||
|
@ -525,7 +525,7 @@ public:
|
|||
}
|
||||
void Uniform3iv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
const GLint* data);
|
||||
|
||||
|
||||
void Uniform4iv(WebGLUniformLocation* location,
|
||||
const dom::Int32Array& arr) {
|
||||
Uniform4iv_base(location, arr.Length(), arr.Data());
|
||||
|
@ -569,7 +569,7 @@ public:
|
|||
}
|
||||
void Uniform3fv_base(WebGLUniformLocation* location, uint32_t arrayLength,
|
||||
const GLfloat* data);
|
||||
|
||||
|
||||
void Uniform4fv(WebGLUniformLocation* location,
|
||||
const dom::Float32Array& arr) {
|
||||
Uniform4fv_base(location, arr.Length(), arr.Data());
|
||||
|
@ -817,8 +817,8 @@ protected:
|
|||
void UndoFakeVertexAttrib0();
|
||||
void InvalidateFakeVertexAttrib0();
|
||||
|
||||
static CheckedUint32 GetImageSize(GLsizei height,
|
||||
GLsizei width,
|
||||
static CheckedUint32 GetImageSize(GLsizei height,
|
||||
GLsizei width,
|
||||
uint32_t pixelSize,
|
||||
uint32_t alignment);
|
||||
|
||||
|
@ -952,7 +952,7 @@ protected:
|
|||
bool ValidateDrawModeEnum(GLenum mode, const char *info);
|
||||
bool ValidateAttribIndex(GLuint index, const char *info);
|
||||
bool ValidateStencilParamsForDrawCall();
|
||||
|
||||
|
||||
bool ValidateGLSLVariableName(const nsAString& name, const char *info);
|
||||
bool ValidateGLSLCharacter(char16_t c);
|
||||
bool ValidateGLSLString(const nsAString& string, const char *info);
|
||||
|
@ -1048,7 +1048,7 @@ protected:
|
|||
int32_t MaxTextureSizeForTarget(GLenum target) const {
|
||||
return target == LOCAL_GL_TEXTURE_2D ? mGLMaxTextureSize : mGLMaxCubeMapTextureSize;
|
||||
}
|
||||
|
||||
|
||||
/** like glBufferData but if the call may change the buffer size, checks any GL error generated
|
||||
* by this glBufferData call and returns it */
|
||||
GLenum CheckedBufferData(GLenum target,
|
||||
|
|
|
@ -108,7 +108,7 @@ WebGLContext::FakeBlackTexture::~FakeBlackTexture()
|
|||
void
|
||||
WebGLContext::ActiveTexture(GLenum texture)
|
||||
{
|
||||
if (IsContextLost())
|
||||
if (IsContextLost())
|
||||
return;
|
||||
|
||||
if (texture < LOCAL_GL_TEXTURE0 ||
|
||||
|
@ -168,7 +168,7 @@ WebGLContext::BindAttribLocation(WebGLProgram *prog, GLuint location,
|
|||
NS_LossyConvertUTF16toASCII cname(name);
|
||||
nsCString mappedName;
|
||||
prog->MapIdentifier(cname, &mappedName);
|
||||
|
||||
|
||||
MakeContextCurrent();
|
||||
gl->fBindAttribLocation(progname, location, mappedName.get());
|
||||
}
|
||||
|
@ -443,7 +443,7 @@ WebGLContext::CopyTexSubImage2D_base(GLenum target,
|
|||
if (!ValidateTexFormatAndType(internalformat, LOCAL_GL_UNSIGNED_BYTE, -1, &texelSize, info))
|
||||
return;
|
||||
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
GetImageSize(height, width, texelSize, mPixelStoreUnpackAlignment);
|
||||
|
||||
if (!checked_neededByteLength.isValid())
|
||||
|
@ -914,7 +914,7 @@ WebGLContext::DoFakeVertexAttrib0(GLuint vertexCount)
|
|||
"with %d vertices. Try reducing the number of vertices.", vertexCount);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
GLuint dataSize = checked_dataSize.value();
|
||||
|
||||
if (!mFakeVertexAttrib0BufferObject) {
|
||||
|
@ -960,7 +960,7 @@ WebGLContext::DoFakeVertexAttrib0(GLuint vertexCount)
|
|||
gl->fBufferData(LOCAL_GL_ARRAY_BUFFER, dataSize, nullptr, LOCAL_GL_DYNAMIC_DRAW);
|
||||
}
|
||||
UpdateWebGLErrorAndClearGLError(&error);
|
||||
|
||||
|
||||
gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mBoundArrayBuffer ? mBoundArrayBuffer->GLName() : 0);
|
||||
|
||||
// note that we do this error checking and early return AFTER having restored the buffer binding above
|
||||
|
@ -973,7 +973,7 @@ WebGLContext::DoFakeVertexAttrib0(GLuint vertexCount)
|
|||
|
||||
gl->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, mFakeVertexAttrib0BufferObject);
|
||||
gl->fVertexAttribPointer(0, 4, LOCAL_GL_FLOAT, LOCAL_GL_FALSE, 0, 0);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1195,14 +1195,14 @@ WebGLContext::GenerateMipmap(GLenum target)
|
|||
|
||||
if (!tex)
|
||||
return ErrorInvalidOperation("generateMipmap: No texture is bound to this target.");
|
||||
|
||||
|
||||
GLenum imageTarget = (target == LOCAL_GL_TEXTURE_2D) ? LOCAL_GL_TEXTURE_2D
|
||||
: LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X;
|
||||
if (!tex->HasImageInfoAt(imageTarget, 0))
|
||||
{
|
||||
return ErrorInvalidOperation("generateMipmap: Level zero of texture is not defined.");
|
||||
}
|
||||
|
||||
|
||||
if (!tex->IsFirstImagePowerOfTwo())
|
||||
return ErrorInvalidOperation("generateMipmap: Level zero of texture does not have power-of-two width and height.");
|
||||
|
||||
|
@ -1321,7 +1321,7 @@ WebGLContext::GetAttribLocation(WebGLProgram *prog, const nsAString& name)
|
|||
return -1;
|
||||
|
||||
if (!ValidateGLSLVariableName(name, "getAttribLocation"))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
NS_LossyConvertUTF16toASCII cname(name);
|
||||
nsCString mappedName;
|
||||
|
@ -1630,7 +1630,7 @@ WebGLContext::GetProgramInfoLog(WebGLProgram *prog, nsACString& retval)
|
|||
retval.Truncate();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GLuint progname = prog->GLName();
|
||||
|
||||
MakeContextCurrent();
|
||||
|
@ -2175,7 +2175,7 @@ WebGLContext::LinkProgram(WebGLProgram *program)
|
|||
for (size_t i = 0; i < program->AttachedShaders().Length(); i++) {
|
||||
|
||||
WebGLShader* shader = program->AttachedShaders()[i];
|
||||
|
||||
|
||||
if (shader->CompileStatus())
|
||||
continue;
|
||||
|
||||
|
@ -2407,7 +2407,7 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
|
|||
// no need to check again for integer overflow here, since we already know the sizes aren't greater than before
|
||||
uint32_t subrect_plainRowSize = subrect_width * bytesPerPixel;
|
||||
// There are checks above to ensure that this doesn't overflow.
|
||||
uint32_t subrect_alignedRowSize =
|
||||
uint32_t subrect_alignedRowSize =
|
||||
RoundedToNextMultipleOf(subrect_plainRowSize, mPixelStorePackAlignment).value();
|
||||
uint32_t subrect_byteLength = (subrect_height-1)*subrect_alignedRowSize + subrect_plainRowSize;
|
||||
|
||||
|
@ -2470,7 +2470,7 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
|
|||
NS_WARNING("Unhandled case, how'd we get here?");
|
||||
return rv.Throw(NS_ERROR_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3126,7 +3126,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
|||
#endif
|
||||
}
|
||||
|
||||
// We're storing an actual instance of StripComments because, if we don't, the
|
||||
// We're storing an actual instance of StripComments because, if we don't, the
|
||||
// cleanSource nsAString instance will be destroyed before the reference is
|
||||
// actually used.
|
||||
StripComments stripComments(shader->Source());
|
||||
|
@ -3141,7 +3141,7 @@ WebGLContext::CompileShader(WebGLShader *shader)
|
|||
if (gl->WorkAroundDriverBugs()) {
|
||||
const uint32_t maxSourceLength = 0x3ffff;
|
||||
if (sourceCString.Length() > maxSourceLength)
|
||||
return ErrorInvalidValue("compileShader: source has more than %d characters",
|
||||
return ErrorInvalidValue("compileShader: source has more than %d characters",
|
||||
maxSourceLength);
|
||||
}
|
||||
|
||||
|
@ -3658,7 +3658,7 @@ WebGLContext::ShaderSource(WebGLShader *shader, const nsAString& source)
|
|||
if (!ValidateObject("shaderSource: shader", shader))
|
||||
return;
|
||||
|
||||
// We're storing an actual instance of StripComments because, if we don't, the
|
||||
// We're storing an actual instance of StripComments because, if we don't, the
|
||||
// cleanSource nsAString instance will be destroyed before the reference is
|
||||
// actually used.
|
||||
StripComments stripComments(source);
|
||||
|
@ -3685,7 +3685,7 @@ GLenum WebGLContext::CheckedTexImage2D(GLenum target,
|
|||
MOZ_ASSERT(tex != nullptr, "no texture bound");
|
||||
|
||||
bool sizeMayChange = true;
|
||||
|
||||
|
||||
if (tex->HasImageInfoAt(target, level)) {
|
||||
const WebGLTexture::ImageInfo& imageInfo = tex->ImageInfoAt(target, level);
|
||||
sizeMayChange = width != imageInfo.Width() ||
|
||||
|
@ -3693,7 +3693,7 @@ GLenum WebGLContext::CheckedTexImage2D(GLenum target,
|
|||
format != imageInfo.InternalFormat() ||
|
||||
type != imageInfo.Type();
|
||||
}
|
||||
|
||||
|
||||
if (sizeMayChange) {
|
||||
UpdateWebGLErrorAndClearGLError();
|
||||
gl->fTexImage2D(target, level, internalFormat, width, height, border, format, type, data);
|
||||
|
@ -3764,7 +3764,7 @@ WebGLContext::TexImage2D_base(GLenum target, GLint level, GLenum internalformat,
|
|||
|
||||
uint32_t srcTexelSize = WebGLTexelConversions::TexelBytesForFormat(actualSrcFormat);
|
||||
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
GetImageSize(height, width, srcTexelSize, mPixelStoreUnpackAlignment);
|
||||
|
||||
CheckedUint32 checked_plainRowSize = CheckedUint32(width) * srcTexelSize;
|
||||
|
@ -3890,7 +3890,7 @@ WebGLContext::TexImage2D(GLenum target, GLint level,
|
|||
// Spec says to generate an INVALID_VALUE error
|
||||
return ErrorInvalidValue("texImage2D: null ImageData");
|
||||
}
|
||||
|
||||
|
||||
Uint8ClampedArray arr(pixels->GetDataObject());
|
||||
return TexImage2D_base(target, level, internalformat, pixels->Width(),
|
||||
pixels->Height(), 4*pixels->Width(), 0,
|
||||
|
@ -3948,19 +3948,19 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
|
|||
if (width == 0 || height == 0)
|
||||
return; // ES 2.0 says it has no effect, we better return right now
|
||||
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
CheckedUint32 checked_neededByteLength =
|
||||
GetImageSize(height, width, srcTexelSize, mPixelStoreUnpackAlignment);
|
||||
|
||||
CheckedUint32 checked_plainRowSize = CheckedUint32(width) * srcTexelSize;
|
||||
|
||||
CheckedUint32 checked_alignedRowSize =
|
||||
CheckedUint32 checked_alignedRowSize =
|
||||
RoundedToNextMultipleOf(checked_plainRowSize.value(), mPixelStoreUnpackAlignment);
|
||||
|
||||
if (!checked_neededByteLength.isValid())
|
||||
return ErrorInvalidOperation("texSubImage2D: integer overflow computing the needed buffer size");
|
||||
|
||||
uint32_t bytesNeeded = checked_neededByteLength.value();
|
||||
|
||||
|
||||
if (byteLength < bytesNeeded)
|
||||
return ErrorInvalidOperation("texSubImage2D: not enough data for operation (need %d, have %d)", bytesNeeded, byteLength);
|
||||
|
||||
|
@ -3971,11 +3971,11 @@ WebGLContext::TexSubImage2D_base(GLenum target, GLint level,
|
|||
|
||||
if (!tex->HasImageInfoAt(target, level))
|
||||
return ErrorInvalidOperation("texSubImage2D: no texture image previously defined for this level and face");
|
||||
|
||||
|
||||
const WebGLTexture::ImageInfo &imageInfo = tex->ImageInfoAt(target, level);
|
||||
if (!CanvasUtils::CheckSaneSubrectSize(xoffset, yoffset, width, height, imageInfo.Width(), imageInfo.Height()))
|
||||
return ErrorInvalidValue("texSubImage2D: subtexture rectangle out of bounds");
|
||||
|
||||
|
||||
// Require the format and type in texSubImage2D to match that of the existing texture as created by texImage2D
|
||||
if (imageInfo.InternalFormat() != format || imageInfo.Type() != type)
|
||||
return ErrorInvalidOperation("texSubImage2D: format or type doesn't match the existing texture");
|
||||
|
@ -4236,8 +4236,8 @@ InternalFormatForFormatAndType(GLenum format, GLenum type, bool isGLES2)
|
|||
return LOCAL_GL_DEPTH_COMPONENT16;
|
||||
else if (type == LOCAL_GL_UNSIGNED_INT)
|
||||
return LOCAL_GL_DEPTH_COMPONENT32;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (format == LOCAL_GL_DEPTH_STENCIL) {
|
||||
if (type == LOCAL_GL_UNSIGNED_INT_24_8_EXT)
|
||||
return LOCAL_GL_DEPTH24_STENCIL8;
|
||||
|
|
Загрузка…
Ссылка в новой задаче