summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CanvasContext.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2020-02-05 15:41:51 -0500
committerDerek Sollenberger <djsollen@google.com>2020-02-06 07:41:50 -0500
commit1863d94e9a32a210cfb50d7c22bbac30dc33e010 (patch)
tree72e3c07f29692eaa994c888feaefc018b08e7dce /libs/hwui/renderthread/CanvasContext.cpp
parent929de647969cf5efa1778fe4b54ee968bff4d613 (diff)
Ensure SkiaPipeline always has a valid colorspace.
Previously we didn't assign a colorspace to the pipeline until it was provided a surface to render into. This resulted in undefined behavior if the application attempted to render an offscreen layer before the OS provided the main window with its surface. Now instead of deferring setting whether or not the application is wide gamut we do initialize it to a default setting when the pipeline is created. Bug: 148042673 Test: apct/device_boot_health_check_extra_postsubmit Change-Id: I84d743511e949ac977486470bb14eec936de7f88
Diffstat (limited to 'libs/hwui/renderthread/CanvasContext.cpp')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index c1435d1ea2d5..0f3901cb225b 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -161,9 +161,8 @@ void CanvasContext::setSurface(sp<Surface>&& surface, bool enableTimeout) {
mRenderAheadCapacity = mRenderAheadDepth;
}
- ColorMode colorMode = mWideColorGamut ? ColorMode::WideColorGamut : ColorMode::SRGB;
bool hasSurface = mRenderPipeline->setSurface(
- mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior, colorMode,
+ mNativeSurface ? mNativeSurface->getNativeWindow() : nullptr, mSwapBehavior,
mRenderAheadCapacity);
mFrameNumber = -1;
@@ -225,7 +224,8 @@ void CanvasContext::setOpaque(bool opaque) {
}
void CanvasContext::setWideGamut(bool wideGamut) {
- mWideColorGamut = wideGamut;
+ ColorMode colorMode = wideGamut ? ColorMode::WideColorGamut : ColorMode::SRGB;
+ mRenderPipeline->setSurfaceColorProperties(colorMode);
}
bool CanvasContext::makeCurrent() {