Index: src/gpu/GrDrawContext.cpp |
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp |
index 78615df6064987b4443a8ba49ce024450920fb2f..51aa535065b7f283d32d5cbc69ab991d54235f25 100644 |
--- a/src/gpu/GrDrawContext.cpp |
+++ b/src/gpu/GrDrawContext.cpp |
@@ -86,12 +86,18 @@ GrDrawContext::GrDrawContext(GrContext* context, |
, fContext(context) |
, fInstancedPipelineInfo(fRenderTarget.get()) |
, fColorSpace(std::move(colorSpace)) |
+ , fColorXformFromSRGB(nullptr) |
, fSurfaceProps(SkSurfacePropsCopyOrDefault(surfaceProps)) |
, fAuditTrail(auditTrail) |
#ifdef SK_DEBUG |
, fSingleOwner(singleOwner) |
#endif |
{ |
+ if (fColorSpace) { |
+ // sRGB sources are very common (SkColor, etc...), so we cache that gamut transformation |
+ auto srgbColorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); |
+ fColorXformFromSRGB = GrColorSpaceXform::Make(srgbColorSpace.get(), fColorSpace.get()); |
+ } |
SkDEBUGCODE(this->validate();) |
} |