aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkRemoteGlyphCache.cpp
diff options
context:
space:
mode:
authorGravatar Khushal <khushalsagar@chromium.org>2018-05-31 13:38:57 -0700
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-31 22:43:44 +0000
commite70c5fb602047dc6ece0183ad49684c4d403ee0d (patch)
tree933e24d6f80ea1e8f464913ae0fa198a8e155764 /src/core/SkRemoteGlyphCache.cpp
parent13b8b676bee886cb2130d142d7a418cf50e2e401 (diff)
Reland fonts: Use correct SurfaceProps in analysis canvas for remoting.
This reverts commit cd21d676b782cf27a9ded17a69c0393e4d3e34cc. TBR=herb@google.com Bug: 829622 Change-Id: I515fdf67fde118db774ab170e021100eef13ce68 Reviewed-on: https://skia-review.googlesource.com/130701 Commit-Queue: Khusal Sagar <khushalsagar@chromium.org> Reviewed-by: Khusal Sagar <khushalsagar@chromium.org>
Diffstat (limited to 'src/core/SkRemoteGlyphCache.cpp')
-rw-r--r--src/core/SkRemoteGlyphCache.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/core/SkRemoteGlyphCache.cpp b/src/core/SkRemoteGlyphCache.cpp
index 1d52f46dbd..6e0c61e01f 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);
@@ -282,9 +281,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, this->surfaceProps(),
+ fSettings.fContextSupportsDistanceFieldText,
+ options)) {
SkScalar textRatio;
SkPaint dfPaint(runPaint);
SkScalerContextFlags flags;
@@ -329,7 +328,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);
@@ -368,7 +367,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);
@@ -389,8 +388,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};
@@ -403,6 +402,15 @@ 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.
+ const auto* device = this->getTopDevice();
+ SkASSERT(device);
+ return device->surfaceProps();
+}
+
struct StrikeSpec {
StrikeSpec() {}
StrikeSpec(SkFontID typefaceID_, SkDiscardableHandleId discardableHandleId_)