OSDN Git Service

fix a small bug that caused screenshot to show garbage in some cases (DO NOT MERGE)
authorMathias Agopian <mathias@google.com>
Fri, 17 Dec 2010 02:46:17 +0000 (18:46 -0800)
committerMathias Agopian <mathias@google.com>
Tue, 25 Jan 2011 22:18:58 +0000 (14:18 -0800)
we were not clearing the screen entirely, which caused garbage when
the screen wasn't entirely covered by windows.

Change-Id: Ia7aa13c36a8a314e0e8427d419b16b9aa2165ddf

services/surfaceflinger/SurfaceFlinger.cpp

index 664e5ad..50f4914 100644 (file)
@@ -2114,6 +2114,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
 
         // invert everything, b/c glReadPixel() below will invert the FB
         glViewport(0, 0, sw, sh);
+        glScissor(0, 0, sw, sh);
         glMatrixMode(GL_PROJECTION);
         glPushMatrix();
         glLoadIdentity();
@@ -2123,6 +2124,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
         // redraw the screen entirely...
         glClearColor(0,0,0,1);
         glClear(GL_COLOR_BUFFER_BIT);
+
         const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ);
         const size_t count = layers.size();
         for (size_t i=0 ; i<count ; ++i) {
@@ -2157,7 +2159,6 @@ status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy,
                 result = NO_MEMORY;
             }
         }
-
         glEnable(GL_SCISSOR_TEST);
         glViewport(0, 0, hw_w, hw_h);
         glMatrixMode(GL_PROJECTION);