diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index f3acbc500..ff1af8355 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -273,6 +273,7 @@ void DisplayDevice::setViewportAndProjection(const sp& hw) glLoadIdentity(); // put the origin in the left-bottom corner glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h + glMatrixMode(GL_MODELVIEW); } // ---------------------------------------------------------------------------- diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index eea0e6bf3..a8d20bb1b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2597,6 +2597,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp& display, if (status == GL_FRAMEBUFFER_COMPLETE_OES) { // invert everything, b/c glReadPixel() below will invert the FB + GLint viewport[4]; + glGetIntegerv(GL_VIEWPORT, viewport); glViewport(0, 0, sw, sh); glMatrixMode(GL_PROJECTION); glPushMatrix(); @@ -2645,7 +2647,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp& display, result = NO_MEMORY; } } - glViewport(0, 0, hw_w, hw_h); + glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW);