* commit 'f8e5c37bc59c70b0a0388f8a690d0d4bead9cc6f': save/restore viewport properly when taking screenshot
This commit is contained in:
commit
4c5158639b
@ -273,6 +273,7 @@ void DisplayDevice::setViewportAndProjection(const sp<const DisplayDevice>& hw)
|
|||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
// put the origin in the left-bottom corner
|
// put the origin in the left-bottom corner
|
||||||
glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h
|
glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h
|
||||||
|
glMatrixMode(GL_MODELVIEW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@ -2597,6 +2597,8 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp<IBinder>& display,
|
|||||||
if (status == GL_FRAMEBUFFER_COMPLETE_OES) {
|
if (status == GL_FRAMEBUFFER_COMPLETE_OES) {
|
||||||
|
|
||||||
// invert everything, b/c glReadPixel() below will invert the FB
|
// invert everything, b/c glReadPixel() below will invert the FB
|
||||||
|
GLint viewport[4];
|
||||||
|
glGetIntegerv(GL_VIEWPORT, viewport);
|
||||||
glViewport(0, 0, sw, sh);
|
glViewport(0, 0, sw, sh);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
@ -2645,7 +2647,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp<IBinder>& display,
|
|||||||
result = NO_MEMORY;
|
result = NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
glViewport(0, 0, hw_w, hw_h);
|
glViewport(viewport[0], viewport[1], viewport[2], viewport[3]);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
|
Loading…
Reference in New Issue
Block a user