diff options
author | Brian Salomon <bsalomon@google.com> | 2017-10-25 15:12:19 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-10-25 19:32:20 +0000 |
commit | 4cbb6e6d551e8bea2c040b1aa9dce253cffb9af0 (patch) | |
tree | a93401716e0f5d45760da36b49c8cf8ea8e1cc21 /src/gpu/text/GrTextUtils.h | |
parent | 291af4f17e0630f78a8c4d22f304243fb28ae42b (diff) |
Pass GrRenderTargetContext's GrColorSpaceInfo to SkShader and SkColorFilter.
Also to SkColorTo(Premul|Unpremul)GrColor4f.
This can avoid cache lookups to find GrColorSpaceXforms as the xform pointer is stored in GrColorSpaceInfo after the first lookup.
Also uses GrColorSpaceInfo to construct GrTextUtils::Paint.
Bug: skia:
Change-Id: Idf19d512a60d2269e6921c7fb54d93aee499a70d
Reviewed-on: https://skia-review.googlesource.com/63660
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'src/gpu/text/GrTextUtils.h')
-rw-r--r-- | src/gpu/text/GrTextUtils.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h index 0a6b2ccbbf..bd0a1ad2ea 100644 --- a/src/gpu/text/GrTextUtils.h +++ b/src/gpu/text/GrTextUtils.h @@ -48,10 +48,8 @@ public: */ class Paint { public: - explicit Paint(const SkPaint* paint, const GrColorSpaceInfo& dstColorSpaceInfo) - : fPaint(paint) - , fDstColorSpace(dstColorSpaceInfo.colorSpace()) - , fColorXformFromSRGB(dstColorSpaceInfo.colorSpaceXformFromSRGB()) { + explicit Paint(const SkPaint* paint, const GrColorSpaceInfo* dstColorSpaceInfo) + : fPaint(paint), fDstColorSpaceInfo(dstColorSpaceInfo) { this->initFilteredColor(); } @@ -67,15 +65,13 @@ public: GrPaint*) const; // Just for RunPaint's constructor - SkColorSpace* dstColorSpace() const { return fDstColorSpace; } - GrColorSpaceXform* colorXformFromSRGB() const { return fColorXformFromSRGB; } + const GrColorSpaceInfo* dstColorSpaceInfo() const { return fDstColorSpaceInfo; } protected: void initFilteredColor(); Paint() = default; const SkPaint* fPaint; - SkColorSpace* fDstColorSpace; - GrColorSpaceXform* fColorXformFromSRGB; + const GrColorSpaceInfo* fDstColorSpaceInfo; // This is the paint's color run through its color filter, if present. This color should // be used except when rendering bitmap text, in which case the bitmap must be filtered in // the fragment shader. @@ -93,8 +89,7 @@ public: : fOriginalPaint(paint), fFilter(filter), fProps(props) { // Initially we represent the original paint. fPaint = &fOriginalPaint->skPaint(); - fDstColorSpace = fOriginalPaint->dstColorSpace(); - fColorXformFromSRGB = fOriginalPaint->colorXformFromSRGB(); + fDstColorSpaceInfo = fOriginalPaint->dstColorSpaceInfo(); fFilteredPremulColor = fOriginalPaint->filteredPremulColor(); } |