Remove device paths from SubRun

The ability to have device paths was removed a while ago.
Remove the code for device paths.

Change-Id: I09418eaa464b040c7bb13eac2e167997363e49d1
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255530
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
Herb Derby 2019-11-20 14:40:39 -05:00 committed by Skia Commit-Bot
parent 2885ac3fe4
commit 2984d2601e
3 changed files with 32 additions and 59 deletions

View File

@ -572,7 +572,7 @@ void GrTextBlob::processSourcePaths(const SkZip<SkGlyphVariant, SkPoint>& drawab
for (auto t : drawables) { for (auto t : drawables) {
const SkPath* path; SkPoint pos; const SkPath* path; SkPoint pos;
std::tie(path, pos) = t; std::tie(path, pos) = t;
run->appendPathGlyph(*path, pos, strikeSpec.strikeToSourceRatio(), false); run->appendPathGlyph(*path, pos, strikeSpec.strikeToSourceRatio());
} }
} }

View File

@ -68,9 +68,8 @@ void GrTextBlob::Run::setupFont(const SkStrikeSpec& strikeSpec) {
} }
} }
void GrTextBlob::Run::appendPathGlyph(const SkPath& path, SkPoint position, void GrTextBlob::Run::appendPathGlyph(const SkPath& path, SkPoint position, SkScalar scale) {
SkScalar scale, bool preTransformed) { fPathGlyphs.emplace_back(path, position.x(), position.y(), scale);
fPathGlyphs.push_back(PathGlyph(path, position.x(), position.y(), scale, preTransformed));
} }
bool GrTextBlob::mustRegenerate(const SkPaint& paint, bool anyRunHasSubpixelPosition, bool GrTextBlob::mustRegenerate(const SkPaint& paint, bool anyRunHasSubpixelPosition,
@ -242,11 +241,7 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props,
// TmpPath must be in the same scope as GrShape shape below. // TmpPath must be in the same scope as GrShape shape below.
SkTLazy<SkPath> tmpPath; SkTLazy<SkPath> tmpPath;
// The glyph positions and glyph outlines are either in device space or in source
// space based on fPreTransformed.
if (!pathGlyph.fPreTransformed) {
// Positions and outlines are in source space. // Positions and outlines are in source space.
ctm = viewMatrix; ctm = viewMatrix;
SkMatrix pathMatrix = SkMatrix::MakeScale(pathGlyph.fScale, pathGlyph.fScale); SkMatrix pathMatrix = SkMatrix::MakeScale(pathGlyph.fScale, pathGlyph.fScale);
@ -281,25 +276,6 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props,
path = sourceOutline; path = sourceOutline;
} }
} else {
// Positions and outlines are in device space.
SkPoint originalOrigin = {fInitialX, fInitialY};
fInitialViewMatrix.mapPoints(&originalOrigin, 1);
SkPoint newOrigin = {x, y};
viewMatrix.mapPoints(&newOrigin, 1);
// The origin shift in device space.
SkPoint originShift = newOrigin - originalOrigin;
// Shift the original glyph location in device space to the position of the
// new blob.
ctm = SkMatrix::MakeTrans(originShift.x() + pathGlyph.fX,
originShift.y() + pathGlyph.fY);
}
// TODO: we are losing the mutability of the path here // TODO: we are losing the mutability of the path here
GrShape shape(*path, paint); GrShape shape(*path, paint);

View File

@ -422,8 +422,7 @@ public:
} }
// Appends a glyph to the blob as a path only. // Appends a glyph to the blob as a path only.
void appendPathGlyph( void appendPathGlyph(const SkPath& path, SkPoint position, SkScalar scale);
const SkPath& path, SkPoint position, SkScalar scale, bool preTransformed);
// Append a glyph to the sub run taking care to switch the glyph if needed. // Append a glyph to the sub run taking care to switch the glyph if needed.
void switchSubRunIfNeededAndAppendGlyph(GrGlyph* glyph, void switchSubRunIfNeededAndAppendGlyph(GrGlyph* glyph,
@ -472,17 +471,15 @@ public:
// Any glyphs that can't be rendered with the base or override descriptor // Any glyphs that can't be rendered with the base or override descriptor
// are rendered as paths // are rendered as paths
struct PathGlyph { struct PathGlyph {
PathGlyph(const SkPath& path, SkScalar x, SkScalar y, SkScalar scale, bool preXformed) PathGlyph(const SkPath& path, SkScalar x, SkScalar y, SkScalar scale)
: fPath(path) : fPath(path)
, fX(x) , fX(x)
, fY(y) , fY(y)
, fScale(scale) , fScale(scale) { }
, fPreTransformed(preXformed) {}
SkPath fPath; SkPath fPath;
SkScalar fX; SkScalar fX;
SkScalar fY; SkScalar fY;
SkScalar fScale; SkScalar fScale;
bool fPreTransformed;
}; };
SkSTArray<1, SubRun> fSubRunInfo; SkSTArray<1, SubRun> fSubRunInfo;