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 01231cd936
commit 18d5d55cb6
5 changed files with 16 additions and 14 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

@ -434,12 +434,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);
@ -612,7 +612,7 @@ UploadSurfaceToTexture(GLContext* gl,
const nsIntRegion& aDstRegion,
GLuint& aTexture,
size_t* aOutUploadSize,
bool aOverwrite,
bool aNeedInit,
const gfx::IntPoint& aSrcPoint,
bool aPixelBuffer,
GLenum aTextureUnit,
@ -624,7 +624,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) {

View File

@ -2965,14 +2965,13 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
{
MOZ_ASSERT(mInUpdate, "Ending update while not in update");
bool overwriteTexture = false;
bool needInit = !mTexture;
LayoutDeviceIntRegion updateRegion = mUpdateRegion;
if (!mTexture || (mTextureSize != mBufferSize)) {
overwriteTexture = true;
if (mTextureSize != mBufferSize) {
mTextureSize = mBufferSize;
}
if (overwriteTexture || !CanUploadSubtextures()) {
if (needInit || !CanUploadSubtextures()) {
updateRegion =
LayoutDeviceIntRect(LayoutDeviceIntPoint(0, 0), mTextureSize);
}
@ -2986,7 +2985,7 @@ RectTextureImage::EndUpdate(bool aKeepSurface)
UploadImageDataToTexture(mGLContext, data, stride, format,
updateRegion.ToUnknownRegion(), mTexture, nullptr,
overwriteTexture, /* aPixelBuffer = */ false,
needInit, /* aPixelBuffer = */ false,
LOCAL_GL_TEXTURE0,
LOCAL_GL_TEXTURE_RECTANGLE_ARB);