summaryrefslogtreecommitdiff
path: root/libs/surfaceflinger/LayerBuffer.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2010-01-20 15:08:33 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2010-01-20 15:08:33 -0800
commit8f17896782b874d49cfefc29a46d38c2110ecf8a (patch)
treeaa64093317df178cde7b8252e600039826e7f7bd /libs/surfaceflinger/LayerBuffer.cpp
parent54b2f26d113a4f27f56a60a06d54e88060d8ed40 (diff)
parent5fdea8d5b0a015433e01849a6c862c147e16346c (diff)
Merge "fix [2363362] [Sapphire] Corrupted raw picture displayed during snapshot"
Diffstat (limited to 'libs/surfaceflinger/LayerBuffer.cpp')
-rw-r--r--libs/surfaceflinger/LayerBuffer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libs/surfaceflinger/LayerBuffer.cpp b/libs/surfaceflinger/LayerBuffer.cpp
index 1dbfe34892..091856f9dc 100644
--- a/libs/surfaceflinger/LayerBuffer.cpp
+++ b/libs/surfaceflinger/LayerBuffer.cpp
@@ -503,6 +503,16 @@ status_t LayerBuffer::BufferSource::initTempBuffer() const
int t = w; w = h; h = t;
}
+ // we're in the copybit case, so make sure we can handle this blit
+ // we don't have to keep the aspect ratio here
+ copybit_device_t* copybit = mLayer.mBlitEngine;
+ const int down = copybit->get(copybit, COPYBIT_MINIFICATION_LIMIT);
+ const int up = copybit->get(copybit, COPYBIT_MAGNIFICATION_LIMIT);
+ if (buffers.w > w*down) w = buffers.w / down;
+ else if (w > buffers.w*up) w = buffers.w*up;
+ if (buffers.h > h*down) h = buffers.h / down;
+ else if (h > buffers.h*up) h = buffers.h*up;
+
if (mTexture.image != EGL_NO_IMAGE_KHR) {
// we have an EGLImage, make sure the needed size didn't change
if (w!=mTexture.width || h!= mTexture.height) {