Reland fonts: Use correct SurfaceProps in analysis canvas for remoting.
This reverts commit cd21d676b7
.
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>
This commit is contained in:
parent
13b8b676be
commit
e70c5fb602
@ -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_)
|
||||
|
@ -82,9 +82,9 @@ private:
|
||||
void processGlyphRunForPaths(const SkTextBlobRunIterator& it, const SkPaint& runPaint);
|
||||
void processGlyphRunForDFT(const SkTextBlobRunIterator& it, const SkPaint& runPaint,
|
||||
SkScalerContextFlags flags);
|
||||
const SkSurfaceProps& surfaceProps() const;
|
||||
|
||||
const SkMatrix fDeviceMatrix;
|
||||
const SkSurfaceProps fSurfaceProps;
|
||||
SkStrikeServer* const fStrikeServer;
|
||||
const Settings fSettings;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user