From 832342d7ed17c3db7ca9e3e3a2510817614aabda Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Mon, 28 Mar 2022 19:59:42 +0000 Subject: Update the global light position based on the rotation of the surface. Vulkan enables clients like HWUI to manage buffer rotation directly, but in doing so HWUI must transform any point lights so that they end up in the correct place relative to the display. Bug: 195934485 Bug: 205493984 Test: atest CtsUiRenderingTestCases Change-Id: I84b43ad5f422b042c40e89477c31685b7726ce3f Merged-In: I84b43ad5f422b042c40e89477c31685b7726ce3f (cherry picked from commit 0784f240b8aac0c07a7894f283bd31c5bbbff632) --- libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp index 0e4a1f945b85..99fd463b0660 100644 --- a/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp +++ b/libs/hwui/pipeline/skia/SkiaVulkanPipeline.cpp @@ -74,7 +74,15 @@ bool SkiaVulkanPipeline::draw(const Frame& frame, const SkRect& screenDirty, con if (backBuffer.get() == nullptr) { return false; } - LightingInfo::updateLighting(lightGeometry, lightInfo); + + // update the coordinates of the global light position based on surface rotation + SkPoint lightCenter = mVkSurface->getCurrentPreTransform().mapXY(lightGeometry.center.x, + lightGeometry.center.y); + LightGeometry localGeometry = lightGeometry; + localGeometry.center.x = lightCenter.fX; + localGeometry.center.y = lightCenter.fY; + + LightingInfo::updateLighting(localGeometry, lightInfo); renderFrame(*layerUpdateQueue, dirty, renderNodes, opaque, contentDrawBounds, backBuffer, mVkSurface->getCurrentPreTransform()); -- cgit v1.2.3-59-g8ed1b