summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGowtham Tammana2018-01-17 18:09:10 -0600
committerPraneeth Bajjuri2018-04-22 03:23:23 -0500
commitee5a5656bfa604fc14db7f36ddc6b6f02c5f4add (patch)
treec5d5150e1cc73011b6d43f42c2c3f35e9cc4fad0
parent5232c48f850d7dd5b68f138a25023d7cfd72826f (diff)
downloadframeworks-native-ee5a5656bfa604fc14db7f36ddc6b6f02c5f4add.tar.gz
frameworks-native-ee5a5656bfa604fc14db7f36ddc6b6f02c5f4add.tar.xz
frameworks-native-ee5a5656bfa604fc14db7f36ddc6b6f02c5f4add.zip
gui: GLConsumer: Adjust crop rect as per scaling mode
Current crop rect is modified when scaling mode is set to SCALE_CROP. This change is not reflected in the GL transform matrix calculation causing incorrect cropping in SCALE_CROP mode for clients using GLConsumer. Fixing transform matrix calculation in this scenario. Change-Id: I876a45b2cdb532a42acb8ba7dfa1be7ca398dbb6 Signed-off-by: Gowtham Tammana <g-tammana@ti.com>
-rw-r--r--libs/gui/GLConsumer.cpp12
-rw-r--r--libs/gui/include/gui/GLConsumer.h3
2 files changed, 11 insertions, 4 deletions
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index 14d993714..1e6796cc3 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -812,8 +812,9 @@ void GLConsumer::computeCurrentTransformMatrixLocked() {
812 GLC_LOGD("computeCurrentTransformMatrixLocked: " 812 GLC_LOGD("computeCurrentTransformMatrixLocked: "
813 "mCurrentTextureImage is NULL"); 813 "mCurrentTextureImage is NULL");
814 } 814 }
815 Rect cropRect = getCurrentCropLocked();
815 computeTransformMatrix(mCurrentTransformMatrix, buf, 816 computeTransformMatrix(mCurrentTransformMatrix, buf,
816 isEglImageCroppable(mCurrentCrop) ? Rect::EMPTY_RECT : mCurrentCrop, 817 isEglImageCroppable(cropRect) ? Rect::EMPTY_RECT : cropRect,
817 mCurrentTransform, mFilteringEnabled); 818 mCurrentTransform, mFilteringEnabled);
818} 819}
819 820
@@ -943,9 +944,7 @@ sp<GraphicBuffer> GLConsumer::getCurrentBuffer(int* outSlot) const {
943 NULL : mCurrentTextureImage->graphicBuffer(); 944 NULL : mCurrentTextureImage->graphicBuffer();
944} 945}
945 946
946Rect GLConsumer::getCurrentCrop() const { 947Rect GLConsumer::getCurrentCropLocked() const {
947 Mutex::Autolock lock(mMutex);
948
949 Rect outCrop = mCurrentCrop; 948 Rect outCrop = mCurrentCrop;
950 if (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) { 949 if (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) {
951 uint32_t newWidth = static_cast<uint32_t>(mCurrentCrop.width()); 950 uint32_t newWidth = static_cast<uint32_t>(mCurrentCrop.width());
@@ -986,6 +985,11 @@ Rect GLConsumer::getCurrentCrop() const {
986 return outCrop; 985 return outCrop;
987} 986}
988 987
988Rect GLConsumer::getCurrentCrop() const {
989 Mutex::Autolock lock(mMutex);
990 return getCurrentCropLocked();
991}
992
989uint32_t GLConsumer::getCurrentTransform() const { 993uint32_t GLConsumer::getCurrentTransform() const {
990 Mutex::Autolock lock(mMutex); 994 Mutex::Autolock lock(mMutex);
991 return mCurrentTransform; 995 return mCurrentTransform;
diff --git a/libs/gui/include/gui/GLConsumer.h b/libs/gui/include/gui/GLConsumer.h
index 75f2ccaae..b65c478da 100644
--- a/libs/gui/include/gui/GLConsumer.h
+++ b/libs/gui/include/gui/GLConsumer.h
@@ -368,6 +368,9 @@ private:
368 // mCurrentTextureImage must not be NULL. 368 // mCurrentTextureImage must not be NULL.
369 void computeCurrentTransformMatrixLocked(); 369 void computeCurrentTransformMatrixLocked();
370 370
371 // getCurrentCrop returns the cropping rectangle of the current buffer.
372 Rect getCurrentCropLocked() const;
373
371 // doGLFenceWaitLocked inserts a wait command into the OpenGL ES command 374 // doGLFenceWaitLocked inserts a wait command into the OpenGL ES command
372 // stream to ensure that it is safe for future OpenGL ES commands to 375 // stream to ensure that it is safe for future OpenGL ES commands to
373 // access the current texture buffer. 376 // access the current texture buffer.