Rename SkStrikeSpecStorage -> SkStrikeSpec

SkStrikeSpecStorage was a temporary name until all uses of
SkStrikeSpec were cleaned up. Do the final rename.

Change-Id: Iaba987ecdfe46ca9eee8d530d5095840cdca300d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/219209
Reviewed-by: Herb Derby <herb@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2019-06-06 10:50:56 -04:00 committed by Skia Commit-Bot
parent 11697dcdfb
commit 36a54c1b1a
18 changed files with 95 additions and 99 deletions

View File

@ -47,7 +47,7 @@ private:
void onDelayedSetup() override {
SkFont defaultFont;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(defaultFont);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(defaultFont);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
for (int i = 0; i < kNumGlyphs; ++i) {
SkPackedGlyphID id(defaultFont.unicharToGlyph(kGlyphs[i]));

View File

@ -21,7 +21,7 @@ static void do_font_stuff(SkFont* font) {
SkPaint defaultPaint;
for (SkScalar i = 8; i < 64; i++) {
font->setSize(i);
auto strikeSpec = SkStrikeSpecStorage::MakeMask(
auto strikeSpec = SkStrikeSpec::MakeMask(
*font, defaultPaint, SkSurfaceProps(0, kUnknown_SkPixelGeometry),
SkScalerContextFlags::kNone, SkMatrix::I());
auto cache = strikeSpec.findOrCreateExclusiveStrike();

View File

@ -512,7 +512,7 @@ private:
friend class SkFontPriv;
friend class SkGlyphRunListPainter;
friend class SkTextBlobCacheDiffCanvas;
friend class SkStrikeSpecStorage;
friend class SkStrikeSpec;
};
#endif

View File

@ -34,7 +34,7 @@ public:
void onOnceBeforeDraw() final {
SkFont defaultFont;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(defaultFont);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(defaultFont);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
SkPath glyphPaths[52];
for (int i = 0; i < 52; ++i) {

View File

@ -231,7 +231,7 @@ using SmallPointsArray = SkAutoSTArray<kTypicalGlyphCount, SkPoint>;
SkScalar SkFont::measureText(const void* text, size_t length, SkTextEncoding encoding,
SkRect* bounds, const SkPaint* paint) const {
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(*this, paint);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(*this, paint);
SkAutoToGlyphs atg(*this, text, length, encoding);
const int count = atg.count();
@ -293,7 +293,7 @@ void VisitGlyphs(const SkFont& origFont, const SkPaint* paint, const SkGlyphID g
return;
}
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(origFont, paint);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(origFont, paint);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
handler(cache.get(), glyphs, count, strikeSpec.strikeToSourceRatio());
@ -314,7 +314,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar width
}
});
} else if (widths) {
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(*this, paint);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(*this, paint);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
SmallPointsArray advances{count};
cache->getAdvances(SkSpan<const SkGlyphID>{glyphs, SkTo<size_t>(count)}, advances.get());
@ -326,7 +326,7 @@ void SkFont::getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar width
void SkFont::getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin) const {
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(*this);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(*this);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
SmallPointsArray advances{count};
cache->getAdvances(SkSpan<const SkGlyphID>{glyphs, SkTo<size_t>(count)}, advances.get());
@ -340,7 +340,7 @@ void SkFont::getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint
void SkFont::getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin) const {
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(*this);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(*this);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
SmallPointsArray advances{count};
cache->getAdvances(SkSpan<const SkGlyphID>{glyphs, SkTo<size_t>(count)}, advances.get());
@ -357,7 +357,7 @@ void SkFont::getPaths(const SkGlyphID glyphs[], int count,
SkScalar scale = font.setupForAsPaths(nullptr);
const SkMatrix mx = SkMatrix::MakeScale(scale, scale);
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(font);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(font);
auto exclusive = strikeSpec.findOrCreateExclusiveStrike();
auto cache = exclusive.get();
@ -384,7 +384,7 @@ bool SkFont::getPath(SkGlyphID glyphID, SkPath* path) const {
SkScalar SkFont::getMetrics(SkFontMetrics* metrics) const {
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(*this, nullptr);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(*this, nullptr);
SkFontMetrics storage;
if (nullptr == metrics) {

View File

@ -310,7 +310,7 @@ void SkGlyphRunBuilder::simplifyDrawText(
if (!glyphIDs.empty()) {
fScratchAdvances.resize(runSize);
{
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(font);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(font);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
cache->getAdvances(glyphIDs, fScratchAdvances.data());
}

View File

@ -142,11 +142,11 @@ void SkGlyphRunListPainter::drawForBitmapDevice(
const SkFont& runFont = glyphRun.font();
auto runSize = glyphRun.runSize();
if (SkStrikeSpecStorage::ShouldDrawAsPath(runPaint, runFont, deviceMatrix)) {
if (SkStrikeSpec::ShouldDrawAsPath(runPaint, runFont, deviceMatrix)) {
SkMatrix::MakeTrans(origin.x(), origin.y()).mapPoints(
fPositions, glyphRun.positions().data(), runSize);
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePath(
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePath(
runFont, runPaint, props, fScalerContextFlags);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -190,9 +190,8 @@ void SkGlyphRunListPainter::drawForBitmapDevice(
SkSpan<const SkPathPos>{pathsAndPositions.begin(), pathsAndPositions.size()},
strikeSpec.strikeToSourceRatio(), pathPaint);
} else {
SkStrikeSpecStorage strikeSpec =
SkStrikeSpecStorage::MakeMask(runFont, runPaint,
props, fScalerContextFlags, deviceMatrix);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeMask(
runFont, runPaint, props, fScalerContextFlags, deviceMatrix);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -284,9 +283,8 @@ void SkGlyphRunListPainter::processARGBFallback(SkScalar maxSourceGlyphDimension
point.fY = SkScalarFloorToScalar(point.fY);
}
SkStrikeSpecStorage strikeSpec =
SkStrikeSpecStorage::MakeMask(runFont, runPaint,
fDeviceProps, fScalerContextFlags, viewMatrix);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeMask(
runFont, runPaint, fDeviceProps, fScalerContextFlags, viewMatrix);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -306,7 +304,7 @@ void SkGlyphRunListPainter::processARGBFallback(SkScalar maxSourceGlyphDimension
// If the matrix is complicated or if scaling is used to fit the glyphs in the cache,
// then this case is used.
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeSourceFallback(
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeSourceFallback(
runFont, runPaint, fDeviceProps, fScalerContextFlags, maxSourceGlyphDimension);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -364,9 +362,9 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
.mapPoints(fPositions, glyphRun.positions().data(), glyphRun.runSize());
SkScalar minScale, maxScale;
SkStrikeSpecStorage strikeSpec;
SkStrikeSpec strikeSpec;
std::tie(strikeSpec, minScale, maxScale) =
SkStrikeSpecStorage::MakeSDFT(
SkStrikeSpec::MakeSDFT(
runFont, runPaint,fDeviceProps, viewMatrix, options);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -431,13 +429,13 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
this->processARGBFallback(maxFallbackDimension * strikeSpec.strikeToSourceRatio(),
runPaint, runFont, viewMatrix, process);
}
} else if (SkStrikeSpecStorage::ShouldDrawAsPath(runPaint, runFont, viewMatrix)) {
} else if (SkStrikeSpec::ShouldDrawAsPath(runPaint, runFont, viewMatrix)) {
// Translate all glyphs to the origin.
SkMatrix::MakeTrans(origin.x(), origin.y()).mapPoints(
fPositions, glyphRun.positions().data(), glyphRun.runSize());
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePath(
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePath(
runFont, runPaint, fDeviceProps, fScalerContextFlags);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -480,8 +478,8 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
}
} else {
SkStrikeSpecStorage strikeSpec =
SkStrikeSpecStorage::MakeMask(runFont, runPaint,
SkStrikeSpec strikeSpec =
SkStrikeSpec::MakeMask(runFont, runPaint,
fDeviceProps, fScalerContextFlags, viewMatrix);
SkScopedStrike strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
@ -785,7 +783,7 @@ void GrTextBlob::startRun(const SkGlyphRun& glyphRun, bool useSDFT) {
}
void GrTextBlob::processDeviceMasks(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) {
const SkStrikeSpec& strikeSpec) {
Run* run = this->currentRun();
this->setHasBitmap();
run->setupFont(strikeSpec);
@ -798,7 +796,7 @@ void GrTextBlob::processDeviceMasks(SkSpan<const SkGlyphPos> masks,
}
void GrTextBlob::processSourcePaths(SkSpan<const SkGlyphPos> paths,
const SkStrikeSpecStorage& strikeSpec) {
const SkStrikeSpec& strikeSpec) {
Run* run = this->currentRun();
this->setHasBitmap();
run->setupFont(strikeSpec);
@ -824,7 +822,7 @@ void GrTextBlob::processDevicePaths(SkSpan<const SkGlyphPos> paths) {
}
void GrTextBlob::processSourceSDFT(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
const SkFont& runFont,
SkScalar minScale,
SkScalar maxScale,
@ -845,7 +843,7 @@ void GrTextBlob::processSourceSDFT(SkSpan<const SkGlyphPos> masks,
}
void GrTextBlob::processSourceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
bool hasW) {
Run* run = this->currentRun();
@ -863,7 +861,7 @@ void GrTextBlob::processSourceFallback(SkSpan<const SkGlyphPos> masks,
}
void GrTextBlob::processDeviceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) {
const SkStrikeSpec& strikeSpec) {
Run* run = this->currentRun();
this->setHasBitmap();
sk_sp<GrTextStrike> grStrike = strikeSpec.findOrCreateGrStrike(fStrikeCache);

View File

@ -21,7 +21,7 @@ class GrRenderTargetContext;
#endif
class SkGlyphRunPainterInterface;
class SkStrikeSpecStorage;
class SkStrikeSpec;
class SkStrikeCommon {
public:
@ -143,26 +143,26 @@ public:
virtual void startRun(const SkGlyphRun& glyphRun, bool useSDFT) = 0;
virtual void processDeviceMasks(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) = 0;
const SkStrikeSpec& strikeSpec) = 0;
virtual void processSourcePaths(SkSpan<const SkGlyphPos> paths,
const SkStrikeSpecStorage& strikeSpec) = 0;
const SkStrikeSpec& strikeSpec) = 0;
virtual void processDevicePaths(SkSpan<const SkGlyphPos> paths) = 0;
virtual void processSourceSDFT(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
const SkFont& runFont,
SkScalar minScale,
SkScalar maxScale,
bool hasWCoord) = 0;
virtual void processSourceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
bool hasW) = 0;
virtual void processDeviceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) = 0;
const SkStrikeSpec& strikeSpec) = 0;
};

View File

@ -13,21 +13,21 @@
#include "src/core/SkStrikeCache.h"
#include "src/core/SkTLazy.h"
SkStrikeSpecStorage SkStrikeSpecStorage::MakeMask(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& deviceMatrix) {
SkStrikeSpecStorage storage;
SkStrikeSpec SkStrikeSpec::MakeMask(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& deviceMatrix) {
SkStrikeSpec storage;
storage.commonSetup(font, paint, surfaceProps, scalerContextFlags, deviceMatrix);
return storage;
}
SkStrikeSpecStorage SkStrikeSpecStorage::MakePath(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags) {
SkStrikeSpecStorage storage;
SkStrikeSpec SkStrikeSpec::MakePath(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags) {
SkStrikeSpec storage;
// setup our std runPaint, in hopes of getting hits in the cache
SkPaint pathPaint{paint};
@ -45,13 +45,13 @@ SkStrikeSpecStorage SkStrikeSpecStorage::MakePath(const SkFont& font, const SkPa
return storage;
}
SkStrikeSpecStorage SkStrikeSpecStorage::MakeSourceFallback(
SkStrikeSpec SkStrikeSpec::MakeSourceFallback(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
SkScalar maxSourceGlyphDimension) {
SkStrikeSpecStorage storage;
SkStrikeSpec storage;
// Subtract 2 to account for the bilerp pad around the glyph
SkScalar maxAtlasDimension = SkStrikeCommon::kSkSideTooBigForAtlas - 2;
@ -76,9 +76,8 @@ SkStrikeSpecStorage SkStrikeSpecStorage::MakeSourceFallback(
return storage;
}
SkStrikeSpecStorage SkStrikeSpecStorage::MakeCanonicalized(
const SkFont& font, const SkPaint* paint) {
SkStrikeSpecStorage storage;
SkStrikeSpec SkStrikeSpec::MakeCanonicalized(const SkFont& font, const SkPaint* paint) {
SkStrikeSpec storage;
SkPaint canonicalizedPaint;
if (paint != nullptr) {
@ -101,12 +100,12 @@ SkStrikeSpecStorage SkStrikeSpecStorage::MakeCanonicalized(
return storage;
}
SkStrikeSpecStorage SkStrikeSpecStorage::MakeDefault() {
SkStrikeSpec SkStrikeSpec::MakeDefault() {
SkFont defaultFont;
return MakeCanonicalized(defaultFont);
}
bool SkStrikeSpecStorage::ShouldDrawAsPath(
bool SkStrikeSpec::ShouldDrawAsPath(
const SkPaint& paint, const SkFont& font, const SkMatrix& viewMatrix) {
// hairline glyphs are fast enough so we don't need to cache them
@ -134,7 +133,7 @@ bool SkStrikeSpecStorage::ShouldDrawAsPath(
|| distance(SkMatrix::kMSkewX, SkMatrix::kMScaleY) > maxSizeSquared;
}
SkStrikeSpecStorage SkStrikeSpecStorage::MakePDFVector(const SkTypeface& typeface, int* size) {
SkStrikeSpec SkStrikeSpec::MakePDFVector(const SkTypeface& typeface, int* size) {
SkFont font;
font.setHinting(SkFontHinting::kNone);
font.setEdging(SkFont::Edging::kAlias);
@ -148,7 +147,7 @@ SkStrikeSpecStorage SkStrikeSpecStorage::MakePDFVector(const SkTypeface& typefac
}
font.setSize((SkScalar)unitsPerEm);
SkStrikeSpecStorage storage;
SkStrikeSpec storage;
storage.commonSetup(font,
SkPaint(),
SkSurfaceProps(0, kUnknown_SkPixelGeometry),
@ -159,11 +158,11 @@ SkStrikeSpecStorage SkStrikeSpecStorage::MakePDFVector(const SkTypeface& typefac
}
#if SK_SUPPORT_GPU
std::tuple<SkStrikeSpecStorage, SkScalar, SkScalar>
SkStrikeSpecStorage::MakeSDFT(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps, const SkMatrix& deviceMatrix,
const GrTextContext::Options& options) {
SkStrikeSpecStorage storage;
std::tuple<SkStrikeSpec, SkScalar, SkScalar>
SkStrikeSpec::MakeSDFT(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps, const SkMatrix& deviceMatrix,
const GrTextContext::Options& options) {
SkStrikeSpec storage;
SkPaint dfPaint = GrTextContext::InitDistanceFieldPaint(paint);
SkFont dfFont = GrTextContext::InitDistanceFieldFont(
@ -182,15 +181,15 @@ SkStrikeSpecStorage::MakeSDFT(const SkFont& font, const SkPaint& paint,
return std::tie(storage, minScale, maxScale);
}
sk_sp<GrTextStrike> SkStrikeSpecStorage::findOrCreateGrStrike(GrStrikeCache* cache) const {
sk_sp<GrTextStrike> SkStrikeSpec::findOrCreateGrStrike(GrStrikeCache* cache) const {
return cache->getStrike(*fAutoDescriptor.getDesc());
}
#endif
void SkStrikeSpecStorage::commonSetup(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& deviceMatrix) {
void SkStrikeSpec::commonSetup(const SkFont& font, const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& deviceMatrix) {
SkScalerContextEffects effects;
SkScalerContext::CreateDescriptorAndEffectsUsingPaint(
@ -202,12 +201,12 @@ void SkStrikeSpecStorage::commonSetup(const SkFont& font, const SkPaint& paint,
fTypeface = font.refTypefaceOrDefault();
}
SkScopedStrike SkStrikeSpecStorage::findOrCreateScopedStrike(SkStrikeCacheInterface* cache) const {
SkScopedStrike SkStrikeSpec::findOrCreateScopedStrike(SkStrikeCacheInterface* cache) const {
SkScalerContextEffects effects{fPathEffect.get(), fMaskFilter.get()};
return cache->findOrCreateScopedStrike(*fAutoDescriptor.getDesc(), effects, *fTypeface);
}
SkExclusiveStrikePtr SkStrikeSpecStorage::findOrCreateExclusiveStrike(SkStrikeCache* cache) const {
SkExclusiveStrikePtr SkStrikeSpec::findOrCreateExclusiveStrike(SkStrikeCache* cache) const {
SkScalerContextEffects effects{fPathEffect.get(), fMaskFilter.get()};
return cache->findOrCreateStrikeExclusive(*fAutoDescriptor.getDesc(), effects, *fTypeface);
}

View File

@ -22,11 +22,10 @@ class SkPaint;
class SkStrikeCache;
class SkSurfaceProps;
// TODO: rename to SkStrikeSpec when the current SkStrikeSpec is remove from the code.
class SkStrikeSpecStorage {
class SkStrikeSpec {
public:
// Create a strike spec for mask style cache entries.
static SkStrikeSpecStorage MakeMask(
static SkStrikeSpec MakeMask(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
@ -34,31 +33,31 @@ public:
const SkMatrix& deviceMatrix);
// Create a strike spec for path style cache entries.
static SkStrikeSpecStorage MakePath(
static SkStrikeSpec MakePath(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags);
static SkStrikeSpecStorage MakeSourceFallback(const SkFont& font,
static SkStrikeSpec MakeSourceFallback(const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,
SkScalerContextFlags scalerContextFlags,
SkScalar maxSourceGlyphDimension);
// Create a canonical strike spec for device-less measurements.
static SkStrikeSpecStorage MakeCanonicalized(
static SkStrikeSpec MakeCanonicalized(
const SkFont& font, const SkPaint* paint = nullptr);
// Make a canonical strike spec for device-less measurements using default typeface and size.
static SkStrikeSpecStorage MakeDefault();
static SkStrikeSpec MakeDefault();
// Make a strike spec for PDF Vector strikes
static SkStrikeSpecStorage MakePDFVector(const SkTypeface& typeface, int* size);
static SkStrikeSpec MakePDFVector(const SkTypeface& typeface, int* size);
#if SK_SUPPORT_GPU
// Create a strike spec for scaled distance field text.
static std::tuple<SkStrikeSpecStorage, SkScalar, SkScalar> MakeSDFT(
static std::tuple<SkStrikeSpec, SkScalar, SkScalar> MakeSDFT(
const SkFont& font,
const SkPaint& paint,
const SkSurfaceProps& surfaceProps,

View File

@ -918,7 +918,7 @@ TextInterceptsIter::TextInterceptsIter(const SkGlyphID glyphs[],
fPaint.setStyle(SkPaint::kFill_Style);
fPaint.setPathEffect(nullptr);
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakeCanonicalized(fFont, &fPaint);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakeCanonicalized(fFont, &fPaint);
fCache = strikeSpec.findOrCreateExclusiveStrike();
fPaint.setStyle(prevStyle);

View File

@ -59,7 +59,7 @@ sk_sp<GrTextBlob> GrTextBlob::Make(int glyphCount,
return blob;
}
void GrTextBlob::Run::setupFont(const SkStrikeSpecStorage& strikeSpec) {
void GrTextBlob::Run::setupFont(const SkStrikeSpec& strikeSpec) {
if (fFallbackStrikeSpec != nullptr) {
*fFallbackStrikeSpec = strikeSpec;

View File

@ -276,7 +276,7 @@ private:
class SubRun {
public:
SubRun(Run* run, const SkStrikeSpecStorage& strikeSpec, GrColor color)
SubRun(Run* run, const SkStrikeSpec& strikeSpec, GrColor color)
: fColor{color}
, fRun{run}
, fStrikeSpec{strikeSpec} {}
@ -349,7 +349,7 @@ private:
void setFallback() { fFlags.argbFallback = true; }
bool isFallback() { return fFlags.argbFallback; }
const SkStrikeSpecStorage& strikeSpec() const { return fStrikeSpec; }
const SkStrikeSpec& strikeSpec() const { return fStrikeSpec; }
private:
GrDrawOpAtlas::BulkUseTokenUpdater fBulkUseToken;
@ -374,7 +374,7 @@ private:
bool argbFallback:1;
} fFlags{false, false, false, false, false, false};
Run* const fRun;
const SkStrikeSpecStorage& fStrikeSpec;
const SkStrikeSpec& fStrikeSpec;
}; // SubRunInfo
/*
@ -416,7 +416,7 @@ private:
// inits the override descriptor on the current run. All following subruns must use this
// descriptor
SubRun* initARGBFallback() {
fFallbackStrikeSpec.reset(new SkStrikeSpecStorage{});
fFallbackStrikeSpec.reset(new SkStrikeSpec{});
// Push back a new subrun to fill and set the override descriptor
SubRun* subRun = this->pushBackSubRun(*fFallbackStrikeSpec, fColor);
subRun->setMaskFormat(kARGB_GrMaskFormat);
@ -446,7 +446,7 @@ private:
SkPoint origin,
SkScalar textScale);
void setupFont(const SkStrikeSpecStorage& strikeSpec);
void setupFont(const SkStrikeSpec& strikeSpec);
void setRunFontAntiAlias(bool aa) {
fAntiAlias = aa;
@ -461,7 +461,7 @@ private:
subRun.setHasWCoord(hasWCoord);
}
SubRun* pushBackSubRun(const SkStrikeSpecStorage& desc, GrColor color) {
SubRun* pushBackSubRun(const SkStrikeSpec& desc, GrColor color) {
// Forward glyph / vertex information to seed the new sub run
SubRun& newSubRun = fSubRunInfo.emplace_back(this, desc, color);
@ -489,13 +489,13 @@ private:
};
SkSTArray<1, SubRun> fSubRunInfo;
SkStrikeSpecStorage fStrikeSpec;
SkStrikeSpec fStrikeSpec;
// Distance field text cannot draw coloremoji, and so has to fall back. However,
// though the distance field text and the coloremoji may share the same run, they
// will have different descriptors. If fFallbackStrikeSpec is non-nullptr, then it
// will be used in place of the run's descriptor to regen texture coords
std::unique_ptr<SkStrikeSpecStorage> fFallbackStrikeSpec;
std::unique_ptr<SkStrikeSpec> fFallbackStrikeSpec;
SkTArray<PathGlyph> fPathGlyphs;
@ -519,26 +519,26 @@ private:
void startRun(const SkGlyphRun& glyphRun, bool useSDFT) override;
void processDeviceMasks(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) override;
const SkStrikeSpec& strikeSpec) override;
void processSourcePaths(SkSpan<const SkGlyphPos> paths,
const SkStrikeSpecStorage& strikeSpec) override;
const SkStrikeSpec& strikeSpec) override;
void processDevicePaths(SkSpan<const SkGlyphPos> paths) override;
void processSourceSDFT(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
const SkFont& runFont,
SkScalar minScale,
SkScalar maxScale,
bool hasWCoord) override;
void processSourceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec,
const SkStrikeSpec& strikeSpec,
bool hasW) override;
void processDeviceFallback(SkSpan<const SkGlyphPos> masks,
const SkStrikeSpecStorage& strikeSpec) override;
const SkStrikeSpec& strikeSpec) override;
struct StrokeInfo {
SkScalar fFrameWidth;

View File

@ -164,7 +164,7 @@ bool GrTextBlob::VertexRegenerator::doRegen(GrTextBlob::VertexRegenerator::Resul
if (regenTexCoords) {
fSubRun->resetBulkUseToken();
const SkStrikeSpecStorage& strikeSpec = fSubRun->strikeSpec();
const SkStrikeSpec& strikeSpec = fSubRun->strikeSpec();
if (!*fLazyStrike || (*fLazyStrike)->getDescriptor() != strikeSpec.descriptor()) {
*fLazyStrike =

View File

@ -829,7 +829,7 @@ void SkPDFDevice::internalDrawGlyphRun(
SkClusterator clusterator(glyphRun);
int emSize;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePDFVector(*typeface, &emSize);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*typeface, &emSize);
auto glyphCache = strikeSpec.findOrCreateExclusiveStrike();
SkScalar textSize = glyphRunFont.getSize();

View File

@ -374,7 +374,7 @@ static void emit_subset_type0(const SkPDFFont& font, SkPDFDocument* doc) {
int16_t defaultWidth = 0;
{
int emSize;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePDFVector(*face, &emSize);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*face, &emSize);
auto glyphCache = strikeSpec.findOrCreateExclusiveStrike();
std::unique_ptr<SkPDFArray> widths = SkPDFMakeCIDGlyphWidthsArray(
glyphCache.get(), &font.glyphUsage(), SkToS16(emSize), &defaultWidth);
@ -529,7 +529,7 @@ static void emit_subset_type3(const SkPDFFont& pdfFont, SkPDFDocument* doc) {
--lastGlyphID;
}
int unitsPerEm;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePDFVector(*typeface, &unitsPerEm);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*typeface, &unitsPerEm);
auto cache = strikeSpec.findOrCreateExclusiveStrike();
SkASSERT(cache);
SkScalar emSize = (SkScalar)unitsPerEm;

View File

@ -300,7 +300,7 @@ void SkPDFEmitType1Font(const SkPDFFont& pdfFont, SkPDFDocument* doc) {
font.insertInt("LastChar", (size_t)glyphCount);
{
int emSize;
SkStrikeSpecStorage strikeSpec = SkStrikeSpecStorage::MakePDFVector(*typeface, &emSize);
SkStrikeSpec strikeSpec = SkStrikeSpec::MakePDFVector(*typeface, &emSize);
auto glyphCache = strikeSpec.findOrCreateExclusiveStrike();
auto widths = SkPDFMakeArray();

View File

@ -451,7 +451,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SkRemoteGlyphCache_DrawTextAsPath, reporter,
paint.setStyle(SkPaint::kStroke_Style);
paint.setStrokeWidth(0);
REPORTER_ASSERT(reporter,
SkStrikeSpecStorage::ShouldDrawAsPath(paint, SkFont(), SkMatrix::I()));
SkStrikeSpec::ShouldDrawAsPath(paint, SkFont(), SkMatrix::I()));
// Server.
auto serverTf = SkTypeface::MakeFromName("monospace", SkFontStyle());
@ -492,7 +492,7 @@ sk_sp<SkTextBlob> make_blob_causing_fallback(
font.setTypeface(targetTf);
REPORTER_ASSERT(reporter,
!SkStrikeSpecStorage::ShouldDrawAsPath(SkPaint(), font, SkMatrix::I()));
!SkStrikeSpec::ShouldDrawAsPath(SkPaint(), font, SkMatrix::I()));
char s[] = "Skia";
int runSize = strlen(s);