Loading services/surfaceflinger/SurfaceFlinger.cpp +18 −13 Original line number Diff line number Diff line Loading @@ -2422,23 +2422,28 @@ void SurfaceFlinger::postComposition() { } } FloatRect SurfaceFlinger::getLayerClipBoundsForDisplay(const DisplayDevice& displayDevice) const { return displayDevice.getLayerStackSpaceRect().toFloatRect(); } void SurfaceFlinger::computeLayerBounds() { // Find the largest width and height among all the displays. int32_t maxDisplayWidth = 0; int32_t maxDisplayHeight = 0; for (const auto& pair : ON_MAIN_THREAD(mDisplays)) { const auto& displayDevice = pair.second; const auto display = displayDevice->getCompositionDisplay(); for (const auto& layer : mDrawingState.layersSortedByZ) { // Only consider the layers on this display. if (!display->includesLayer(layer->getOutputFilter())) { continue; int32_t width = displayDevice->getWidth(); int32_t height = displayDevice->getHeight(); if (width > maxDisplayWidth) { maxDisplayWidth = width; } if (height > maxDisplayHeight) { maxDisplayHeight = height; } layer->computeBounds(getLayerClipBoundsForDisplay(*displayDevice), ui::Transform(), 0.f /* shadowRadius */); } // Ignore display bounds for now since they will be computed later. Use a large Rect bound // to ensure it's bigger than an actual display will be. FloatRect maxBounds(-maxDisplayWidth * 10, -maxDisplayHeight * 10, maxDisplayWidth * 10, maxDisplayHeight * 10); for (const auto& layer : mDrawingState.layersSortedByZ) { layer->computeBounds(maxBounds, ui::Transform(), 0.f /* shadowRadius */); } } Loading services/surfaceflinger/SurfaceFlinger.h +0 −7 Original line number Diff line number Diff line Loading @@ -354,13 +354,6 @@ protected: std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks) REQUIRES(mStateLock); // Used internally by computeLayerBounds() to gets the clip rectangle to use for the // root layers on a particular display in layer-coordinate space. The // layers (and effectively their children) will be clipped against this // rectangle. The base behavior is to clip to the visible region of the // display. virtual FloatRect getLayerClipBoundsForDisplay(const DisplayDevice&) const; virtual void processDisplayAdded(const wp<IBinder>& displayToken, const DisplayDeviceState&) REQUIRES(mStateLock); Loading services/surfaceflinger/tests/EffectLayer_test.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,15 @@ TEST_F(EffectLayerTest, BlurEffectLayerIsVisible) { } } TEST_F(EffectLayerTest, EffectLayerWithColorNoCrop) { const auto display = SurfaceComposerClient::getInternalDisplayToken(); ui::DisplayMode mode; ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getActiveDisplayMode(display, &mode)); const ui::Size& resolution = mode.resolution; auto shot = screenshot(); shot->expectColor(Rect(0, 0, resolution.getWidth(), resolution.getHeight()), Color::RED); } } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +18 −13 Original line number Diff line number Diff line Loading @@ -2422,23 +2422,28 @@ void SurfaceFlinger::postComposition() { } } FloatRect SurfaceFlinger::getLayerClipBoundsForDisplay(const DisplayDevice& displayDevice) const { return displayDevice.getLayerStackSpaceRect().toFloatRect(); } void SurfaceFlinger::computeLayerBounds() { // Find the largest width and height among all the displays. int32_t maxDisplayWidth = 0; int32_t maxDisplayHeight = 0; for (const auto& pair : ON_MAIN_THREAD(mDisplays)) { const auto& displayDevice = pair.second; const auto display = displayDevice->getCompositionDisplay(); for (const auto& layer : mDrawingState.layersSortedByZ) { // Only consider the layers on this display. if (!display->includesLayer(layer->getOutputFilter())) { continue; int32_t width = displayDevice->getWidth(); int32_t height = displayDevice->getHeight(); if (width > maxDisplayWidth) { maxDisplayWidth = width; } if (height > maxDisplayHeight) { maxDisplayHeight = height; } layer->computeBounds(getLayerClipBoundsForDisplay(*displayDevice), ui::Transform(), 0.f /* shadowRadius */); } // Ignore display bounds for now since they will be computed later. Use a large Rect bound // to ensure it's bigger than an actual display will be. FloatRect maxBounds(-maxDisplayWidth * 10, -maxDisplayHeight * 10, maxDisplayWidth * 10, maxDisplayHeight * 10); for (const auto& layer : mDrawingState.layersSortedByZ) { layer->computeBounds(maxBounds, ui::Transform(), 0.f /* shadowRadius */); } } Loading
services/surfaceflinger/SurfaceFlinger.h +0 −7 Original line number Diff line number Diff line Loading @@ -354,13 +354,6 @@ protected: std::unordered_set<ListenerCallbacks, ListenerCallbacksHash>& listenerCallbacks) REQUIRES(mStateLock); // Used internally by computeLayerBounds() to gets the clip rectangle to use for the // root layers on a particular display in layer-coordinate space. The // layers (and effectively their children) will be clipped against this // rectangle. The base behavior is to clip to the visible region of the // display. virtual FloatRect getLayerClipBoundsForDisplay(const DisplayDevice&) const; virtual void processDisplayAdded(const wp<IBinder>& displayToken, const DisplayDeviceState&) REQUIRES(mStateLock); Loading
services/surfaceflinger/tests/EffectLayer_test.cpp +9 −0 Original line number Diff line number Diff line Loading @@ -176,6 +176,15 @@ TEST_F(EffectLayerTest, BlurEffectLayerIsVisible) { } } TEST_F(EffectLayerTest, EffectLayerWithColorNoCrop) { const auto display = SurfaceComposerClient::getInternalDisplayToken(); ui::DisplayMode mode; ASSERT_EQ(NO_ERROR, SurfaceComposerClient::getActiveDisplayMode(display, &mode)); const ui::Size& resolution = mode.resolution; auto shot = screenshot(); shot->expectColor(Rect(0, 0, resolution.getWidth(), resolution.getHeight()), Color::RED); } } // namespace android // TODO(b/129481165): remove the #pragma below and fix conversion issues Loading