Cleanup Skia RE display and layer colorTransforms
In the general case we don't set the display's colorMatrix on the paint
if we know it is the identity matrix. We also now abort early if
the layer has no alpha and no colortransform or colorspace conversion
will change that.
The layer's colortransform is now respected regardless of whether or
not color management is enabled for the RE instance
Also includes some small code refactors to avoid computing the same
values in multiple places.
Test: librenderengine_test
Bug: 180712498
Bug: 181028875
Change-Id: I6e236efc5987d00cb464e8798c48f2b3b21635c5
diff --git a/libs/renderengine/skia/SkiaGLRenderEngine.h b/libs/renderengine/skia/SkiaGLRenderEngine.h
index 5779ae6..ad26206 100644
--- a/libs/renderengine/skia/SkiaGLRenderEngine.h
+++ b/libs/renderengine/skia/SkiaGLRenderEngine.h
@@ -92,11 +92,12 @@
void initCanvas(SkCanvas* canvas, const DisplaySettings& display);
void drawShadow(SkCanvas* canvas, const SkRect& casterRect, float casterCornerRadius,
const ShadowSettings& shadowSettings);
- // If mUseColorManagement is correct and layer needsLinearEffect, it returns a linear runtime
- // shader. Otherwise it returns the input shader.
+ // If requiresLinearEffect is true or the layer has a stretchEffect a new shader is returned.
+ // Otherwise it returns the input shader.
sk_sp<SkShader> createRuntimeEffectShader(sk_sp<SkShader> shader, const LayerSettings* layer,
const DisplaySettings& display,
- bool undoPremultipliedAlpha);
+ bool undoPremultipliedAlpha,
+ bool requiresLinearEffect);
EGLDisplay mEGLDisplay;
EGLContext mEGLContext;