зеркало из https://github.com/mozilla/gecko-dev.git
Bug 713774 - Fix crasher when changing orientation on Android r=blassey
This commit is contained in:
Родитель
462e0daa64
Коммит
c8a8b06b4c
|
@ -126,6 +126,9 @@ AndroidDirectTexture::Reallocate(PRUint32 aWidth, PRUint32 aHeight, gfxASurface:
|
|||
bool result = mBackBuffer->Reallocate(aWidth, aHeight, aFormat);
|
||||
if (result) {
|
||||
mPendingReallocBuffer = mFrontBuffer;
|
||||
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -303,11 +303,11 @@ AndroidGraphicBuffer::DestroyBuffer()
|
|||
}
|
||||
|
||||
bool
|
||||
AndroidGraphicBuffer::EnsureBufferCreated(PRUint32 aWidth, PRUint32 aHeight, PRUint32 aUsage, gfxImageFormat aFormat)
|
||||
AndroidGraphicBuffer::EnsureBufferCreated()
|
||||
{
|
||||
if (!mHandle) {
|
||||
mHandle = malloc(GRAPHIC_BUFFER_SIZE);
|
||||
sGLFunctions.fGraphicBufferCtor(mHandle, mWidth, mHeight, GetAndroidFormat(aFormat), GetAndroidUsage(aUsage));
|
||||
sGLFunctions.fGraphicBufferCtor(mHandle, mWidth, mHeight, GetAndroidFormat(mFormat), GetAndroidUsage(mUsage));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -320,7 +320,7 @@ AndroidGraphicBuffer::EnsureInitialized()
|
|||
return false;
|
||||
}
|
||||
|
||||
EnsureBufferCreated(mWidth, mHeight, mUsage, mFormat);
|
||||
EnsureBufferCreated();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -363,19 +363,19 @@ AndroidGraphicBuffer::Reallocate(PRUint32 aWidth, PRUint32 aHeight, gfxImageForm
|
|||
if (!EnsureInitialized())
|
||||
return false;
|
||||
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
mFormat = aFormat;
|
||||
|
||||
// Sometimes GraphicBuffer::reallocate just doesn't work. In those cases we'll just allocate a brand
|
||||
// new buffer. If reallocate fails once, never try it again.
|
||||
if (!gTryRealloc || sGLFunctions.fGraphicBufferReallocate(mHandle, aWidth, aHeight, GetAndroidFormat(aFormat)) != 0) {
|
||||
DestroyBuffer();
|
||||
EnsureBufferCreated(aWidth, aHeight, mUsage, aFormat);
|
||||
EnsureBufferCreated();
|
||||
|
||||
gTryRealloc = false;
|
||||
}
|
||||
|
||||
mWidth = aWidth;
|
||||
mHeight = aHeight;
|
||||
mFormat = aFormat;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ private:
|
|||
bool EnsureEGLImage();
|
||||
|
||||
void DestroyBuffer();
|
||||
bool EnsureBufferCreated(PRUint32 aWidth, PRUint32 aHeight, PRUint32 aUsage, gfxASurface::gfxImageFormat aFormat);
|
||||
bool EnsureBufferCreated();
|
||||
|
||||
PRUint32 GetAndroidUsage(PRUint32 aUsage);
|
||||
PRUint32 GetAndroidFormat(gfxASurface::gfxImageFormat aFormat);
|
||||
|
|
|
@ -1191,9 +1191,8 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
|
|||
nsAutoString metadata;
|
||||
unsigned char *bits = NULL;
|
||||
if (sHasDirectTexture) {
|
||||
if ((sDirectTexture->Width() != gAndroidBounds.width ||
|
||||
sDirectTexture->Height() != gAndroidBounds.height) &&
|
||||
gAndroidBounds.width != 0 && gAndroidBounds.height != 0) {
|
||||
if (sDirectTexture->Width() != gAndroidBounds.width ||
|
||||
sDirectTexture->Height() != gAndroidBounds.height) {
|
||||
sDirectTexture->Reallocate(gAndroidBounds.width, gAndroidBounds.height);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче