Scale buffer to fit the layer boundary
Skia render engine incorrectly renders garbled video layer, due to lack of scaling to the layer's boundary.
Bug: 171404534
Test: adb root; adb shell setprop debug.renderengine.backend skiagl; adb shell stop; adb shell start
then take a screenshot from playing this video inside web browser with this url: https://www.reddit.com/r/Awww/comments/jjkvdm/if_a_cat_loves_you_sure_you_are_a_lovely_person/
Change-Id: I67da06f384345e300380f34afe1b60cfa2b5fe0b
diff --git a/libs/renderengine/skia/SkiaGLRenderEngine.cpp b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
index 03c8e80..e5f7539 100644
--- a/libs/renderengine/skia/SkiaGLRenderEngine.cpp
+++ b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
@@ -560,6 +560,10 @@
}
auto texMatrix = getSkM44(item.textureTransform).asM33();
+
+ // b/171404534, scale to fix the layer
+ matrix.postScale(bounds.getWidth() / bufferWidth, bounds.getHeight() / bufferHeight);
+
// textureTansform was intended to be passed directly into a shader, so when
// building the total matrix with the textureTransform we need to first
// normalize it, then apply the textureTransform, then scale back up.