summaryrefslogtreecommitdiff
path: root/libs/hwui/OpenGLReadback.cpp
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2017-11-14 12:31:11 -0800
committerXin Li <delphij@google.com>2017-11-14 12:31:11 -0800
commit220871a697290529278ed16db508eda8e12f3fc7 (patch)
treebc13101b63c6fe39a9d92706ecb7ded7f98f5a9c /libs/hwui/OpenGLReadback.cpp
parent802f191b2b84a1b1b82c7f6f3268846084b35dfb (diff)
parent98e12851336b7db16e583f9afac63ecc97465980 (diff)
Merge commit '98e12851336b7db16e583f9afac63ecc97465980' from
oc-mr1-dev-plus-aosp-without-vendor into stage-aosp-master. Change-Id: Ia7b8da4a00d215160e4a4fa40f6044208d1297b7 Merged-In: I19846d2a3ee27aecbae2367a74ee49082eea154d
Diffstat (limited to 'libs/hwui/OpenGLReadback.cpp')
-rw-r--r--libs/hwui/OpenGLReadback.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp
index 19d5d9d2250e..2687410897ac 100644
--- a/libs/hwui/OpenGLReadback.cpp
+++ b/libs/hwui/OpenGLReadback.cpp
@@ -85,11 +85,6 @@ CopyResult OpenGLReadback::copyGraphicBufferInto(GraphicBuffer* graphicBuffer,
uint32_t width = graphicBuffer->getWidth();
uint32_t height = graphicBuffer->getHeight();
- // If this is a 90 or 270 degree rotation we need to swap width/height
- // This is a fuzzy way of checking that.
- if (texTransform[Matrix4::kSkewX] >= 0.5f || texTransform[Matrix4::kSkewX] <= -0.5f) {
- std::swap(width, height);
- }
CopyResult copyResult = copyImageInto(sourceImage, texTransform, width, height,
srcRect, bitmap);
@@ -233,11 +228,12 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState,
.build();
Matrix4 ortho;
ortho.loadOrtho(destWidth, destHeight);
- renderState.render(glop, ortho);
+ renderState.render(glop, ortho, false);
// TODO: We should convert to linear space when the target is RGBA16F
glReadPixels(0, 0, bitmap->width(), bitmap->height(), format,
type, bitmap->getPixels());
+ bitmap->notifyPixelsChanged();
}
// Cleanup
@@ -253,6 +249,12 @@ CopyResult OpenGLReadbackImpl::copyImageInto(EGLImageKHR eglImage,
const Matrix4& imgTransform, int imgWidth, int imgHeight, const Rect& srcRect,
SkBitmap* bitmap) {
+ // If this is a 90 or 270 degree rotation we need to swap width/height
+ // This is a fuzzy way of checking that.
+ if (imgTransform[Matrix4::kSkewX] >= 0.5f || imgTransform[Matrix4::kSkewX] <= -0.5f) {
+ std::swap(imgWidth, imgHeight);
+ }
+
Caches& caches = Caches::getInstance();
GLuint sourceTexId;
// Create a 2D texture to sample from the EGLImage
@@ -278,6 +280,11 @@ CopyResult OpenGLReadbackImpl::copyImageInto(EGLImageKHR eglImage,
bool OpenGLReadbackImpl::copyLayerInto(renderthread::RenderThread& renderThread,
GlLayer& layer, SkBitmap* bitmap) {
+ if (!layer.isRenderable()) {
+ // layer has never been updated by DeferredLayerUpdater, abort copy
+ return false;
+ }
+
return CopyResult::Success == copyTextureInto(Caches::getInstance(),
renderThread.renderState(), layer.getTexture(), layer.getTexTransform(),
Rect(), bitmap);