Handle translating blob to origin in bulk
Move all the glyphs in bulk. Handling the origin translation will be needed to use the bulk APIs. Change-Id: Ic38ebc8504d874367e4a7291e26f3dfc2c59222b Reviewed-on: https://skia-review.googlesource.com/c/skia/+/206397 Auto-Submit: Herb Derby <herb@google.com> Commit-Queue: Ben Wagner <bungeman@google.com> Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
parent
4187ac5e47
commit
7a2ff3c9a8
@ -401,6 +401,10 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
|
||||
|
||||
if (useSDFT) {
|
||||
|
||||
// Translate all glyphs to the origin.
|
||||
SkMatrix translate = SkMatrix::MakeTrans(origin.x(), origin.y());
|
||||
translate.mapPoints(fPositions, glyphRun.positions().data(), glyphRun.runSize());
|
||||
|
||||
// Setup distance field runPaint and text ratio
|
||||
SkPaint dfPaint = GrTextContext::InitDistanceFieldPaint(runPaint);
|
||||
SkScalar cacheToSourceScale;
|
||||
@ -426,7 +430,7 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
|
||||
int glyphCount = 0;
|
||||
const SkPoint* positionCursor = glyphRun.positions().data();
|
||||
for (auto glyphID : glyphRun.glyphsIDs()) {
|
||||
SkPoint glyphSourcePosition = origin + *positionCursor++;
|
||||
SkPoint glyphSourcePosition = *positionCursor++;
|
||||
const SkGlyph& glyph = strike->getGlyphMetrics(glyphID, {0, 0});
|
||||
|
||||
if (glyph.isEmpty()) {
|
||||
@ -469,6 +473,10 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
|
||||
}
|
||||
} else if (SkGlyphRunListPainter::ShouldDrawAsPath(runPaint, runFont, viewMatrix)) {
|
||||
|
||||
// Translate all glyphs to the origin.
|
||||
SkMatrix translate = SkMatrix::MakeTrans(origin.x(), origin.y());
|
||||
translate.mapPoints(fPositions, glyphRun.positions().data(), glyphRun.runSize());
|
||||
|
||||
// setup our std runPaint, in hopes of getting hits in the cache
|
||||
SkPaint pathPaint{runPaint};
|
||||
SkFont pathFont{runFont};
|
||||
@ -493,7 +501,7 @@ void SkGlyphRunListPainter::processGlyphRunList(const SkGlyphRunList& glyphRunLi
|
||||
int glyphCount = 0;
|
||||
const SkPoint* positionCursor = glyphRun.positions().data();
|
||||
for (auto glyphID : glyphRun.glyphsIDs()) {
|
||||
SkPoint glyphSourcePosition = origin + *positionCursor++;
|
||||
SkPoint glyphSourcePosition = *positionCursor++;
|
||||
|
||||
// Use outline from {0, 0} because all transforms including subpixel translation
|
||||
// happen during drawing.
|
||||
|
Loading…
Reference in New Issue
Block a user