Fixing cosmetic kinks
- Adding back rounded corners crop to Skia RE
- Add a translation to the texture transform for the SkImage so
that the correct layer contents are drawn in the correct part of
the screen.
Bug: 175141036
Test: Open Chrome. Slowly slide into recents. The address bar does
not show defects anymore. Also observe the bottom of the crop,
it doesn't split anymore. Camera resizing looks good, too.
Test: Open Camera. Check that there are no defects in the camera
view.
Test: Open Dialog Activity test app. Notice that the dialog is now
present during the start up of the app.
Change-Id: I4410fd7759c2ad9f2809af5485348d67fd269556
diff --git a/libs/renderengine/skia/SkiaGLRenderEngine.cpp b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
index 4e9c5af..28d7adc 100644
--- a/libs/renderengine/skia/SkiaGLRenderEngine.cpp
+++ b/libs/renderengine/skia/SkiaGLRenderEngine.cpp
@@ -587,6 +587,10 @@
if (!texMatrix.invert(&matrix)) {
matrix = texMatrix;
}
+ // The shader does not respect the translation, so we add it to the texture
+ // transform for the SkImage. This will make sure that the correct layer contents
+ // are drawn in the correct part of the screen.
+ matrix.postTranslate(layer->geometry.boundaries.left, layer->geometry.boundaries.top);
sk_sp<SkShader> shader;
@@ -649,12 +653,11 @@
drawShadow(canvas, rect, layer->geometry.roundedCornersRadius, layer->shadow);
}
+ // Push the clipRRect onto the clip stack. Draw the image. Pop the clip.
if (layer->geometry.roundedCornersRadius > 0) {
- canvas->drawRRect(getRoundedRect(layer), paint);
- } else {
- canvas->drawRect(dest, paint);
+ canvas->clipRRect(getRoundedRect(layer), true);
}
-
+ canvas->drawRect(dest, paint);
canvas->restore();
}
canvas->restore();
@@ -698,7 +701,7 @@
}
inline SkRRect SkiaGLRenderEngine::getRoundedRect(const LayerSettings* layer) {
- const auto rect = getSkRect(layer->geometry.boundaries);
+ const auto rect = getSkRect(layer->geometry.roundedCornersCrop);
const auto cornerRadius = layer->geometry.roundedCornersRadius;
return SkRRect::MakeRectXY(rect, cornerRadius, cornerRadius);
}