Bug 1243418 - Fix up incorrect 'aOverwrite' usage and impl in GLUploadHelpers r=jgilbert

This commit is contained in:
James Willcox 2016-01-27 10:09:01 -06:00
parent 6ce8f1df22
commit 7a195bd71f
4 changed files with 12 additions and 9 deletions

View File

@ -173,6 +173,7 @@ BasicTextureImage::EndUpdate()
RefPtr<gfx::DataSourceSurface> updateData = updateSnapshot->GetDataSurface();
bool relative = FinishedSurfaceUpdate();
bool needInit = mTextureState == Created;
size_t uploadSize;
mTextureFormat =
UploadSurfaceToTexture(mGLContext,
@ -180,7 +181,7 @@ BasicTextureImage::EndUpdate()
mUpdateRegion,
mTexture,
&uploadSize,
mTextureState == Created,
needInit,
mUpdateOffset,
relative);
FinishedSurfaceUpload();
@ -230,13 +231,14 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
}
size_t uploadSize;
bool needInit = mTextureState == Created;
mTextureFormat =
UploadSurfaceToTexture(mGLContext,
aSurf,
region,
mTexture,
&uploadSize,
mTextureState == Created,
needInit,
bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y),
false);
if (uploadSize > 0) {

View File

@ -432,12 +432,12 @@ UploadImageDataToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
size_t* aOutUploadSize,
bool aOverwrite,
bool aNeedInit,
bool aPixelBuffer,
GLenum aTextureUnit,
GLenum aTextureTarget)
{
bool textureInited = aOverwrite ? false : true;
bool textureInited = aNeedInit ? false : true;
gl->MakeCurrent();
gl->fActiveTexture(aTextureUnit);
@ -610,7 +610,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
size_t* aOutUploadSize,
bool aOverwrite,
bool aNeedInit,
const gfx::IntPoint& aSrcPoint,
bool aPixelBuffer,
GLenum aTextureUnit,
@ -622,7 +622,7 @@ UploadSurfaceToTexture(GLContext* gl,
data += DataOffset(aSrcPoint, stride, format);
return UploadImageDataToTexture(gl, data, stride, format,
aDstRegion, aTexture, aOutUploadSize,
aOverwrite, aPixelBuffer, aTextureUnit,
aNeedInit, aPixelBuffer, aTextureUnit,
aTextureTarget);
}

View File

@ -61,7 +61,7 @@ UploadImageDataToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
size_t* aOutUploadSize = nullptr,
bool aOverwrite = false,
bool aNeedInit = false,
bool aPixelBuffer = false,
GLenum aTextureUnit = LOCAL_GL_TEXTURE0,
GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D);
@ -75,7 +75,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
size_t* aOutUploadSize = nullptr,
bool aOverwrite = false,
bool aNeedInit = false,
const gfx::IntPoint& aSrcPoint = gfx::IntPoint(0, 0),
bool aPixelBuffer = false,
GLenum aTextureUnit = LOCAL_GL_TEXTURE0,

View File

@ -207,6 +207,7 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
region = aRegion;
}
bool needInit = mTextureState == Created;
size_t uploadSize = 0;
mTextureFormat =
UploadSurfaceToTexture(mGLContext,
@ -214,7 +215,7 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
region,
mTexture,
&uploadSize,
mTextureState == Created,
needInit,
bounds.TopLeft() + gfx::IntPoint(aFrom.x, aFrom.y),
false);
if (uploadSize > 0) {