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:
parent
2885ac3fe4
commit
2984d2601e
@ -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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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,62 +241,39 @@ 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
|
// Positions and outlines are in source space.
|
||||||
// space based on fPreTransformed.
|
ctm = viewMatrix;
|
||||||
if (!pathGlyph.fPreTransformed) {
|
|
||||||
// Positions and outlines are in source space.
|
|
||||||
|
|
||||||
ctm = viewMatrix;
|
SkMatrix pathMatrix = SkMatrix::MakeScale(pathGlyph.fScale, pathGlyph.fScale);
|
||||||
|
|
||||||
SkMatrix pathMatrix = SkMatrix::MakeScale(pathGlyph.fScale, pathGlyph.fScale);
|
// The origin for the blob may have changed, so figure out the delta.
|
||||||
|
SkVector originShift = SkPoint{x, y} - SkPoint{fInitialX, fInitialY};
|
||||||
|
|
||||||
// The origin for the blob may have changed, so figure out the delta.
|
// Shift the original glyph location in source space to the position of the new
|
||||||
SkVector originShift = SkPoint{x, y} - SkPoint{fInitialX, fInitialY};
|
// blob.
|
||||||
|
pathMatrix.postTranslate(originShift.x() + pathGlyph.fX,
|
||||||
// Shift the original glyph location in source space to the position of the new
|
originShift.y() + pathGlyph.fY);
|
||||||
// blob.
|
|
||||||
pathMatrix.postTranslate(originShift.x() + pathGlyph.fX,
|
|
||||||
originShift.y() + pathGlyph.fY);
|
|
||||||
|
|
||||||
// If there are shaders, blurs or styles, the path must be scaled into source
|
|
||||||
// space independently of the CTM. This allows the CTM to be correct for the
|
|
||||||
// different effects.
|
|
||||||
GrStyle style(runPaint);
|
|
||||||
bool scalePath = runPaint.getShader()
|
|
||||||
|| style.applies()
|
|
||||||
|| runPaint.getMaskFilter();
|
|
||||||
if (!scalePath) {
|
|
||||||
// Scale can be applied to CTM -- no effects.
|
|
||||||
|
|
||||||
ctm.preConcat(pathMatrix);
|
|
||||||
} else {
|
|
||||||
// Scale the outline into source space.
|
|
||||||
|
|
||||||
// Transform the path form the normalized outline to source space. This
|
|
||||||
// way the CTM will remain the same so it can be used by the effects.
|
|
||||||
SkPath* sourceOutline = tmpPath.init();
|
|
||||||
path->transform(pathMatrix, sourceOutline);
|
|
||||||
sourceOutline->setIsVolatile(true);
|
|
||||||
path = sourceOutline;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// If there are shaders, blurs or styles, the path must be scaled into source
|
||||||
|
// space independently of the CTM. This allows the CTM to be correct for the
|
||||||
|
// different effects.
|
||||||
|
GrStyle style(runPaint);
|
||||||
|
bool scalePath = runPaint.getShader()
|
||||||
|
|| style.applies()
|
||||||
|
|| runPaint.getMaskFilter();
|
||||||
|
if (!scalePath) {
|
||||||
|
// Scale can be applied to CTM -- no effects.
|
||||||
|
|
||||||
|
ctm.preConcat(pathMatrix);
|
||||||
} else {
|
} else {
|
||||||
// Positions and outlines are in device space.
|
// Scale the outline into source space.
|
||||||
|
|
||||||
SkPoint originalOrigin = {fInitialX, fInitialY};
|
// Transform the path form the normalized outline to source space. This
|
||||||
fInitialViewMatrix.mapPoints(&originalOrigin, 1);
|
// way the CTM will remain the same so it can be used by the effects.
|
||||||
|
SkPath* sourceOutline = tmpPath.init();
|
||||||
SkPoint newOrigin = {x, y};
|
path->transform(pathMatrix, sourceOutline);
|
||||||
viewMatrix.mapPoints(&newOrigin, 1);
|
sourceOutline->setIsVolatile(true);
|
||||||
|
path = sourceOutline;
|
||||||
// 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
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user