diff options
author | Khushal <khushalsagar@chromium.org> | 2018-05-29 13:00:01 -0700 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-29 20:36:37 +0000 |
commit | 4f078f7cfac6580dce6e213c022708922739ac6d (patch) | |
tree | c146db765e866320e3714910f3d82e448b9367c8 /src/core/SkRemoteGlyphCache.cpp | |
parent | 8363be1a00b154082e6be178f37de4b8fa78dde0 (diff) |
fonts: Use correct SurfaceProps in analysis canvas for remoting.
SaveLayer may not preserve the behaviour for lcd text, in which case
the surfaceProps used for desc generation are inconsistent.
R=herb@google.com
Bug: 829622
Change-Id: I3adfc6780f26e4eb333a8aff76eaa4b5a9f0a0a7
Reviewed-on: https://skia-review.googlesource.com/129557
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.cpp')
-rw-r--r-- | src/core/SkRemoteGlyphCache.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp index a987e5bdde..f9c38dd11e 100644 --- a/src/core/SkRemoteGlyphCache.cpp +++ b/src/core/SkRemoteGlyphCache.cpp @@ -198,7 +198,6 @@ SkTextBlobCacheDiffCanvas::SkTextBlobCacheDiffCanvas(int width, int height, SkStrikeServer* strikeSever, Settings settings) : SkNoDrawCanvas{sk_make_sp<TrackLayerDevice>(SkIRect::MakeWH(width, height), props)} , fDeviceMatrix{deviceMatrix} - , fSurfaceProps{props} , fStrikeServer{strikeSever} , fSettings{settings} { SkASSERT(fStrikeServer); @@ -284,9 +283,9 @@ void SkTextBlobCacheDiffCanvas::processGlyphRun( options.fMinDistanceFieldFontSize = fSettings.fMinDistanceFieldFontSize; options.fMaxDistanceFieldFontSize = fSettings.fMaxDistanceFieldFontSize; GrTextContext::SanitizeOptions(&options); - if (GrTextContext::CanDrawAsDistanceFields(runPaint, runMatrix, fSurfaceProps, - fSettings.fContextSupportsDistanceFieldText, - options)) { + if (GrTextContext::CanDrawAsDistanceFields(runPaint, runMatrix, surfaceProps(), + fSettings.fContextSupportsDistanceFieldText, + options)) { SkScalar textRatio; SkPaint dfPaint(runPaint); SkScalerContextFlags flags; @@ -358,7 +357,7 @@ void SkTextBlobCacheDiffCanvas::processGlyphRun( SkScalerContextEffects effects; auto* glyphCacheState = static_cast<SkStrikeServer*>(fStrikeServer) - ->getOrCreateCache(runPaint, &fSurfaceProps, &runMatrix, + ->getOrCreateCache(runPaint, &this->surfaceProps(), &runMatrix, SkScalerContextFlags::kFakeGammaAndBoostContrast, &deviceSpecificRec, &effects); SkASSERT(glyphCacheState); @@ -397,7 +396,7 @@ void SkTextBlobCacheDiffCanvas::processGlyphRunForPaths(const SkTextBlobRunItera SkScalerContextEffects effects; auto* glyphCacheState = static_cast<SkStrikeServer*>(fStrikeServer) - ->getOrCreateCache(pathPaint, &fSurfaceProps, nullptr, + ->getOrCreateCache(pathPaint, &this->surfaceProps(), nullptr, SkScalerContextFlags::kFakeGammaAndBoostContrast, &deviceSpecificRec, &effects); @@ -418,8 +417,8 @@ void SkTextBlobCacheDiffCanvas::processGlyphRunForDFT(const SkTextBlobRunIterato SkScalerContextRec deviceSpecificRec; SkScalerContextEffects effects; auto* glyphCacheState = static_cast<SkStrikeServer*>(fStrikeServer) - ->getOrCreateCache(runPaint, &fSurfaceProps, nullptr, flags, - &deviceSpecificRec, &effects); + ->getOrCreateCache(runPaint, &this->surfaceProps(), nullptr, + flags, &deviceSpecificRec, &effects); const bool asPath = false; const SkIPoint subPixelPos{0, 0}; @@ -432,6 +431,13 @@ void SkTextBlobCacheDiffCanvas::processGlyphRunForDFT(const SkTextBlobRunIterato } } +const SkSurfaceProps& SkTextBlobCacheDiffCanvas::surfaceProps() const { + // SaveLayers can change the SurfaceProps used, and we ensure that the props used by the top + // device for the layer is correct. This is done by ensuring that TrackLayerDevice used by this + // canvas propagates them correctly when a new device is created for a layer. + return this->getTopDevice()->surfaceProps(); +} + struct StrikeSpec { StrikeSpec() {} StrikeSpec(SkFontID typefaceID_, SkDiscardableHandleId discardableHandleId_) |