Bug fix: use legacy SkCanvas regardless of color space tag
Test: Added unit test. CtsGraphicsModule.
Bug: 32984164
Change-Id: If72e1e31c98e01f97f3a05d763f5d4c71cf88313
diff --git a/libs/hwui/SkiaCanvas.cpp b/libs/hwui/SkiaCanvas.cpp
index ed6e522..d95acff 100644
--- a/libs/hwui/SkiaCanvas.cpp
+++ b/libs/hwui/SkiaCanvas.cpp
@@ -60,7 +60,8 @@
SkiaCanvas::SkiaCanvas(const SkBitmap& bitmap) {
sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
- mCanvasOwned = std::unique_ptr<SkCanvas>(new SkCanvas(bitmap));
+ mCanvasOwned =
+ std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
mCanvasWrapper = SkCreateColorSpaceXformCanvas(mCanvasOwned.get(),
cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));
mCanvas = mCanvasWrapper.get();
@@ -83,7 +84,8 @@
void SkiaCanvas::setBitmap(const SkBitmap& bitmap) {
sk_sp<SkColorSpace> cs = bitmap.refColorSpace();
- std::unique_ptr<SkCanvas> newCanvas = std::unique_ptr<SkCanvas>(new SkCanvas(bitmap));
+ std::unique_ptr<SkCanvas> newCanvas =
+ std::unique_ptr<SkCanvas>(new SkCanvas(bitmap, SkCanvas::ColorBehavior::kLegacy));
std::unique_ptr<SkCanvas> newCanvasWrapper = SkCreateColorSpaceXformCanvas(newCanvas.get(),
cs == nullptr ? SkColorSpace::MakeSRGB() : std::move(cs));