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
This commit is contained in:
Derek Sollenberger 2022-03-28 19:59:42 +00:00
parent 0681492cd0
commit 0784f240b8

View File

@ -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());