Bug 850566 - Part 2: Render gralloc buffer by using image size. r=roc, a=tef+
authorSotaro Ikeda <sikeda@mozilla.com>
Tue, 09 Apr 2013 17:24:49 -0400
changeset 118710 f4e509cb83cc65610e5b614d707d5109bcc655da
parent 118709 a49d901c6f10450b6679e217aa98f60a37cab13e
child 118711 fff03f1901f29f737d5818bfc387e333fa8b74b8
push id97
push userryanvm@gmail.com
push dateTue, 09 Apr 2013 21:25:18 +0000
reviewersroc, tef
bugs850566
milestone18.0
Bug 850566 - Part 2: Render gralloc buffer by using image size. r=roc, a=tef+
gfx/layers/opengl/ImageLayerOGL.cpp
--- a/gfx/layers/opengl/ImageLayerOGL.cpp
+++ b/gfx/layers/opengl/ImageLayerOGL.cpp
@@ -955,16 +955,17 @@ ShadowImageLayerOGL::RenderLayer(int aPr
     }
 #ifdef MOZ_WIDGET_GONK
     if (img
         && (img->type() == SharedImage::TSurfaceDescriptor)
         && (img->get_SurfaceDescriptor().type() == SurfaceDescriptor::TSurfaceDescriptorGralloc)) {
         const SurfaceDescriptorGralloc& desc = img->get_SurfaceDescriptor().get_SurfaceDescriptorGralloc();
         sp<GraphicBuffer> graphicBuffer = GrallocBufferActor::GetFrom(desc);
         mSize = gfxIntSize(graphicBuffer->getWidth(), graphicBuffer->getHeight());
+        mPictureRect = nsIntRect(0, 0, desc.size().width, desc.size().height);
         if (!mExternalBufferTexture.IsAllocated()) {
           mExternalBufferTexture.Allocate(gl());
         }
         gl()->MakeCurrent();
         gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
         gl()->BindExternalBuffer(mExternalBufferTexture.GetTextureID(), graphicBuffer->getNativeBuffer());
         mImageVersion = imgVersion;
     }
@@ -1020,24 +1021,27 @@ ShadowImageLayerOGL::RenderLayer(int aPr
     gl()->fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, mExternalBufferTexture.GetTextureID());
 
     ShaderProgramOGL *program = mOGLManager->GetProgram(RGBAExternalLayerProgramType, GetMaskLayer());
 
     gl()->ApplyFilterToBoundTexture(LOCAL_GL_TEXTURE_EXTERNAL, mFilter);
 
     program->Activate();
     program->SetLayerQuadRect(nsIntRect(0, 0,
-                                        mSize.width, mSize.height));
+                                           mPictureRect.width,
+                                           mPictureRect.height));
     program->SetLayerTransform(GetEffectiveTransform());
     program->SetLayerOpacity(GetEffectiveOpacity());
     program->SetRenderOffset(aOffset);
     program->SetTextureUnit(0);
     program->LoadMask(GetMaskLayer());
 
-    mOGLManager->BindAndDrawQuad(program);
+    mOGLManager->BindAndDrawQuadWithTextureRect(program,
+                                                mPictureRect,
+                                                nsIntSize(mSize.width, mSize.height));
 
     // Make sure that we release the underlying external image
     gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
     gl()->fBindTexture(LOCAL_GL_TEXTURE_EXTERNAL, 0);
     mExternalBufferTexture.Release();
 #endif
   } else if (mSharedHandle) {
     GLContext::SharedHandleDetails handleDetails;