mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 620799 - Fallback to normal surface allocation if creating a PBO fails. r=joe a=blocking2.0
This commit is contained in:
parent
f5f4d25848
commit
9301918144
@ -461,11 +461,11 @@ BasicBufferOGL::BeginPaint(ContentType aContentType)
|
||||
// BeginUpdate is allowed to modify the given region,
|
||||
// if it wants more to be repainted than we request.
|
||||
result.mContext = mTexImage->BeginUpdate(result.mRegionToDraw);
|
||||
result.mContext->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y));
|
||||
if (!result.mContext) {
|
||||
NS_WARNING("unable to get context for update");
|
||||
return result;
|
||||
}
|
||||
result.mContext->Translate(-gfxPoint(quadrantRect.x, quadrantRect.y));
|
||||
// Move rgnToPaint back into position so that the thebes callback
|
||||
// gets the right coordintes.
|
||||
result.mRegionToDraw.MoveBy(-offset);
|
||||
|
@ -308,9 +308,12 @@ protected:
|
||||
GetSurfaceForUpdate(const gfxIntSize& aSize, ImageFormat aFmt)
|
||||
{
|
||||
mGLContext->MakeCurrent();
|
||||
if (!mGLContext->IsExtensionSupported(GLContext::ARB_pixel_buffer_object)) {
|
||||
if (!mGLContext->
|
||||
IsExtensionSupported(GLContext::ARB_pixel_buffer_object))
|
||||
{
|
||||
return gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenSurface(aSize, gfxASurface::ContentFromFormat(aFmt));
|
||||
CreateOffscreenSurface(aSize,
|
||||
gfxASurface::ContentFromFormat(aFmt));
|
||||
}
|
||||
|
||||
if (!mPixelBuffer) {
|
||||
@ -325,22 +328,28 @@ protected:
|
||||
mPixelBufferSize = size;
|
||||
}
|
||||
unsigned char* data =
|
||||
(unsigned char*)mGLContext->fMapBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, LOCAL_GL_WRITE_ONLY);
|
||||
(unsigned char*)mGLContext->
|
||||
fMapBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER,
|
||||
LOCAL_GL_WRITE_ONLY);
|
||||
|
||||
if (!data) {
|
||||
return nsnull;
|
||||
mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
return gfxPlatform::GetPlatform()->
|
||||
CreateOffscreenSurface(aSize,
|
||||
gfxASurface::ContentFromFormat(aFmt));
|
||||
}
|
||||
|
||||
nsRefPtr<gfxQuartzSurface> surf =
|
||||
new gfxQuartzSurface(data, aSize,
|
||||
aSize.width * 4, aFmt);
|
||||
|
||||
mBoundPixelBuffer = true;
|
||||
return surf.forget();
|
||||
}
|
||||
|
||||
bool FinishedSurfaceUpdate()
|
||||
{
|
||||
if (mPixelBuffer) {
|
||||
if (mBoundPixelBuffer) {
|
||||
mGLContext->MakeCurrent();
|
||||
mGLContext->fUnmapBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER);
|
||||
return true;
|
||||
@ -350,9 +359,10 @@ protected:
|
||||
|
||||
void FinishedSurfaceUpload()
|
||||
{
|
||||
if (mPixelBuffer) {
|
||||
if (mBoundPixelBuffer) {
|
||||
mGLContext->MakeCurrent();
|
||||
mGLContext->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
mBoundPixelBuffer = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,10 +375,12 @@ private:
|
||||
: BasicTextureImage(aTexture, aSize, aWrapMode, aContentType, aContext)
|
||||
, mPixelBuffer(0)
|
||||
, mPixelBufferSize(0)
|
||||
, mBoundPixelBuffer(false)
|
||||
{}
|
||||
|
||||
GLuint mPixelBuffer;
|
||||
PRInt32 mPixelBufferSize;
|
||||
bool mBoundPixelBuffer;
|
||||
};
|
||||
|
||||
already_AddRefed<TextureImage>
|
||||
|
Loading…
Reference in New Issue
Block a user