From 88a11f2640cffb3fdfc3d0c7081f118a59507d0f Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Wed, 28 Nov 2018 18:30:57 -0800 Subject: SF: User buffer size instead of layer size when calculating size - Change the remaining references to layer size with buffer size - Fail SurfaceFlinger::createLayer if the caller provides a buffer size and the layer is a color or container layer - Update Transation_test to explicitly set crop for buffer-less layers Bug:114413815 Test: go/wm-smoke Test: mmma frameworks/native/services/surfaceflinger/tests/ && \ mmma frameworks/native/libs/gui/tests/ && adb sync data && \ adb shell /data/nativetest64/libgui_test/libgui_test && \ adb shell /data/nativetest64/libsurfaceflinger_unittest/libsurfaceflinger_unittest && \ adb shell /data/nativetest64/SurfaceFlinger_test/SurfaceFlinger_test && \ adb shell /data/nativetest64/SurfaceParcelable_test/SurfaceParcelable_test && \ echo "ALL TESTS PASSED" Change-Id: Ic40a2ea3e629ce774891075afaf9a4d05e95ca4d --- services/surfaceflinger/BufferLayer.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'services/surfaceflinger/BufferLayer.cpp') diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp index ade62bf68f..7caae989cd 100644 --- a/services/surfaceflinger/BufferLayer.cpp +++ b/services/surfaceflinger/BufferLayer.cpp @@ -501,7 +501,7 @@ Region BufferLayer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime // FIXME: postedRegion should be dirty & bounds // transform the dirty region to window-manager space - return getTransform().transform(Region(Rect(getActiveWidth(s), getActiveHeight(s)))); + return getTransform().transform(Region(getBufferSize(s))); } // transaction @@ -624,11 +624,13 @@ void BufferLayer::drawWithOpenGL(const RenderArea& renderArea, bool useIdentityT ui::Transform t = getTransform(); Rect win = bounds; + const int bufferWidth = getBufferSize(s).getWidth(); + const int bufferHeight = getBufferSize(s).getHeight(); - float left = float(win.left) / float(getActiveWidth(s)); - float top = float(win.top) / float(getActiveHeight(s)); - float right = float(win.right) / float(getActiveWidth(s)); - float bottom = float(win.bottom) / float(getActiveHeight(s)); + const float left = float(win.left) / float(bufferWidth); + const float top = float(win.top) / float(bufferHeight); + const float right = float(win.right) / float(bufferWidth); + const float bottom = float(win.bottom) / float(bufferHeight); // TODO: we probably want to generate the texture coords with the mesh // here we assume that we only have 4 vertices -- cgit v1.2.3-59-g8ed1b