diff options
author | Mathias Agopian <mathias@google.com> | 2012-09-28 01:00:47 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-09-28 13:34:26 -0700 |
commit | bae92d0d605e99a14731add4f11b72413b2835e5 (patch) | |
tree | d0fcccabcc250eb6d82bc00a1281f01f41494d0a | |
parent | c01a79d77b829e7de86ef137694e8ad708470ca1 (diff) | |
download | frameworks_native-bae92d0d605e99a14731add4f11b72413b2835e5.zip frameworks_native-bae92d0d605e99a14731add4f11b72413b2835e5.tar.gz frameworks_native-bae92d0d605e99a14731add4f11b72413b2835e5.tar.bz2 |
reset GL viewport and project when caputring the screen
Bug: 7241739
Change-Id: I3bb5214b070384de9be2026647865c6c236a4331
-rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 18 | ||||
-rw-r--r-- | services/surfaceflinger/DisplayDevice.h | 2 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 2 |
3 files changed, 15 insertions, 7 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 47dd073..f3acbc5 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -259,18 +259,22 @@ EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, if (sur != hw->mSurface) { result = eglMakeCurrent(dpy, hw->mSurface, hw->mSurface, ctx); if (result == EGL_TRUE) { - GLsizei w = hw->mDisplayWidth; - GLsizei h = hw->mDisplayHeight; - glViewport(0, 0, w, h); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - // put the origin in the left-bottom corner - glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h + setViewportAndProjection(hw); } } return result; } +void DisplayDevice::setViewportAndProjection(const sp<const DisplayDevice>& hw) { + GLsizei w = hw->mDisplayWidth; + GLsizei h = hw->mDisplayHeight; + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + // put the origin in the left-bottom corner + glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h +} + // ---------------------------------------------------------------------------- void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<LayerBase> >& layers) { diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h index 1d77154..058680b 100644 --- a/services/surfaceflinger/DisplayDevice.h +++ b/services/surfaceflinger/DisplayDevice.h @@ -125,6 +125,8 @@ public: static EGLBoolean makeCurrent(EGLDisplay dpy, const sp<const DisplayDevice>& hw, EGLContext ctx); + static void setViewportAndProjection(const sp<const DisplayDevice>& hw); + /* ------------------------------------------------------------------------ * blank / unblank management */ diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 8cfaa31..eea0e6b 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2510,6 +2510,8 @@ status_t SurfaceFlinger::renderScreenToTextureLocked(uint32_t layerStack, glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tname, 0); + DisplayDevice::setViewportAndProjection(hw); + // redraw the screen entirely... glDisable(GL_TEXTURE_EXTERNAL_OES); glDisable(GL_TEXTURE_2D); |