Make glyph paths calculation positions from original data
The CTM of the path did not include the translate for the origin. Directly transform outlines from original position instead of positions relative to the initialOrigin. This allows the CTM to have the drawOrigin translation, and the glyphMatrix to have the glyph origin translation. Change-Id: I5b1595b2a8358f054f4cacd3e48fac78712c6980 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/264681 Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
c43f2a0898
commit
7b186101c3
@ -43,6 +43,21 @@ void SkDrawableGlyphBuffer::startSource(
|
||||
SkDEBUGCODE(fPhase = kInput);
|
||||
}
|
||||
|
||||
void SkDrawableGlyphBuffer::startPaths(const SkZip<const SkGlyphID, const SkPoint> &source) {
|
||||
fInputSize = source.size();
|
||||
fDrawableSize = 0;
|
||||
|
||||
auto positions = source.get<1>();
|
||||
memcpy(fPositions, positions.data(), positions.size() * sizeof(SkPoint));
|
||||
|
||||
// Convert from SkGlyphIDs to SkPackedGlyphIDs.
|
||||
SkGlyphVariant* packedIDCursor = fMultiBuffer;
|
||||
for (auto t : source) {
|
||||
*packedIDCursor++ = SkPackedGlyphID{std::get<0>(t)};
|
||||
}
|
||||
SkDEBUGCODE(fPhase = kInput);
|
||||
}
|
||||
|
||||
void SkDrawableGlyphBuffer::startDevice(
|
||||
const SkZip<const SkGlyphID, const SkPoint>& source,
|
||||
SkPoint origin, const SkMatrix& viewMatrix,
|
||||
|
@ -146,6 +146,9 @@ public:
|
||||
// Load the buffer with SkPackedGlyphIDs and positions in source space.
|
||||
void startSource(const SkZip<const SkGlyphID, const SkPoint>& source, SkPoint origin);
|
||||
|
||||
// Use the original glyphIDs and positions.
|
||||
void startPaths(const SkZip<const SkGlyphID, const SkPoint>& source);
|
||||
|
||||
// Load the buffer with SkPackedGlyphIDs and positions using the device transform.
|
||||
void startDevice(
|
||||
const SkZip<const SkGlyphID, const SkPoint>& source,
|
||||
|
@ -212,7 +212,7 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
|
||||
if (!strikeSpec.isEmpty()) {
|
||||
SkScopedStrikeForGPU strike = strikeSpec.findOrCreateScopedStrike(fStrikeCache);
|
||||
|
||||
fDrawable.startSource(fRejects.source(), origin);
|
||||
fDrawable.startPaths(fRejects.source());
|
||||
strike->prepareForPathDrawing(&fDrawable, &fRejects);
|
||||
fRejects.flipRejectsToSource();
|
||||
maxDimensionInSourceSpace =
|
||||
|
@ -481,17 +481,13 @@ void GrTextBlob::flush(GrTextTarget* target, const SkSurfaceProps& props,
|
||||
|| style.applies()
|
||||
|| runPaint.getMaskFilter();
|
||||
|
||||
// The origin for the blob may have changed, so figure out the delta.
|
||||
SkVector originShift = drawOrigin - fInitialOrigin;
|
||||
|
||||
for (const auto& pathGlyph : subRun->fPaths) {
|
||||
SkMatrix ctm{drawMatrix};
|
||||
ctm.preTranslate(drawOrigin.x(), drawOrigin.y());
|
||||
SkMatrix pathMatrix = SkMatrix::MakeScale(
|
||||
subRun->fStrikeSpec.strikeToSourceRatio());
|
||||
// Shift the original glyph location in source space to the position of the new
|
||||
// blob.
|
||||
pathMatrix.postTranslate(originShift.x() + pathGlyph.fOrigin.x(),
|
||||
originShift.y() + pathGlyph.fOrigin.y());
|
||||
pathMatrix.postTranslate(pathGlyph.fOrigin.x(), pathGlyph.fOrigin.y());
|
||||
|
||||
// TmpPath must be in the same scope as GrShape shape below.
|
||||
SkTLazy<SkPath> tmpPath;
|
||||
|
Loading…
Reference in New Issue
Block a user