Bug 1382104 - Set viewport and colormask for draw-blit. - r=daoshengmu draft
authorJeff Gilbert <jgilbert@mozilla.com>
Fri, 21 Jul 2017 16:22:27 -0700
changeset 649180 bf83e8c198e5a3aff9cb83fa63713cfda13a7827
parent 649179 b9d88fce260d240bba6bf6666dbdb031b8c189e7
child 649181 28b10bf80399cc9a9e07979c33e87a4f06758533
push id74978
push userbmo:jgilbert@mozilla.com
push dateFri, 18 Aug 2017 19:07:35 +0000
reviewersdaoshengmu
bugs1382104
milestone57.0a1
Bug 1382104 - Set viewport and colormask for draw-blit. - r=daoshengmu MozReview-Commit-ID: HdIclDeh9ql
gfx/gl/GLBlitHelper.cpp
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -895,29 +895,31 @@ GLBlitHelper::DrawBlitTextureToFramebuff
     default:
         MOZ_CRASH("GFX: Fatal Error: Bad `srcTarget`.");
         break;
     }
 
     ScopedGLDrawState autoStates(mGL);
     const ScopedBindFramebuffer bindFB(mGL, destFB);
 
+    mGL->fColorMask(1, 1, 1, 1);
+
     // Does destructive things to (only!) what we just saved above.
     bool good = UseTexQuadProgram(type, srcSize);
     if (!good) {
         // We're up against the wall, so bail.
         MOZ_DIAGNOSTIC_ASSERT(false,
                               "Error: Failed to prepare to blit texture->framebuffer.\n");
         mGL->fScissor(0, 0, destSize.width, destSize.height);
-        mGL->fColorMask(1, 1, 1, 1);
         mGL->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
         return;
     }
 
     const ScopedBindTexture bindTex(mGL, srcTex, srcTarget);
+    mGL->fViewport(0, 0, destSize.width, destSize.height);
     mGL->fDrawArrays(LOCAL_GL_TRIANGLE_STRIP, 0, 4);
 }
 
 void
 GLBlitHelper::BlitFramebufferToTexture(GLuint srcFB, GLuint destTex,
                                        const gfx::IntSize& srcSize,
                                        const gfx::IntSize& destSize,
                                        GLenum destTarget)