Bug 1250710 - Save and restore state, since this is used by WebGL. - r=ethlin
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 20 Jun 2016 14:09:31 -0700
changeset 388859 c70eb1338bf4621388b0187510dd288ca2be6591
parent 388858 2fee18feb6231e4e5453e98ed05b42a71ab0de98
child 388860 40e9d24fd8eab4cd9d9e434ca3d5e815148a7b3f
push id23247
push userbmo:jgilbert@mozilla.com
push dateMon, 18 Jul 2016 06:13:58 +0000
reviewersethlin
bugs1250710
milestone50.0a1
Bug 1250710 - Save and restore state, since this is used by WebGL. - r=ethlin MozReview-Commit-ID: 3KZdIMpcRch
gfx/gl/GLBlitHelper.cpp
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -898,19 +898,23 @@ GLBlitHelper::BlitImageToFramebuffer(lay
     mGL->fViewport(0, 0, destSize.width, destSize.height);
 
     switch (type) {
 #ifdef MOZ_WIDGET_GONK
     case ConvertGralloc:
         return BlitGrallocImage(static_cast<layers::GrallocImage*>(srcImage));
 #endif
 
-    case ConvertPlanarYCbCr:
-        mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1);
-        return BlitPlanarYCbCrImage(static_cast<PlanarYCbCrImage*>(srcImage));
+    case ConvertPlanarYCbCr: {
+            const auto saved = mGL->GetIntAs<GLint>(LOCAL_GL_UNPACK_ALIGNMENT);
+            mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, 1);
+            const auto ret = BlitPlanarYCbCrImage(static_cast<PlanarYCbCrImage*>(srcImage));
+            mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, saved);
+            return ret;
+        }
 
 #ifdef MOZ_WIDGET_ANDROID
     case ConvertSurfaceTexture:
         return BlitSurfaceTextureImage(static_cast<layers::SurfaceTextureImage*>(srcImage));
 
     case ConvertEGLImage:
         return BlitEGLImageImage(static_cast<layers::EGLImageImage*>(srcImage));
 #endif