Revert "Convert the CPU path case to use prepareForDrawing"
This reverts commit 8be917af4313f6021b9b8e5d2b3f4d5712967aa9.
Reason for revert: Causes layout tests to draw problem
Original change's description:
> Convert the CPU path case to use prepareForDrawing
>
> Change-Id: I5babfc7f1fa9784d81896d5c036e3b50c2af8ca0
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207760
> Reviewed-by: Ben Wagner <bungeman@google.com>
> Commit-Queue: Herb Derby <herb@google.com>
TBR=bungeman@google.com,herb@google.com
Change-Id: I8ec1e8fed49571cc70b0acac750cbbf302f551fe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207886
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp
index 2429379..ba0a6be 100644
--- a/src/core/SkGlyphRunPainter.cpp
+++ b/src/core/SkGlyphRunPainter.cpp
@@ -187,35 +187,23 @@
// The sub-pixel position will always happen when transforming to the screen.
pathFont.setSubpixel(false);
- SkAutoDescriptor ad;
- SkScalerContextEffects effects;
- SkScalerContext::CreateDescriptorAndEffectsUsingPaint(pathFont,
- pathPaint,
- props,
- fScalerContextFlags,
- SkMatrix::I(),
- &ad,
- &effects);
-
- SkScopedStrike strike =
- fStrikeCache->findOrCreateScopedStrike(
- *ad.getDesc(), effects,*pathFont.getTypefaceOrDefault());
-
- auto glyphPosSpan = strike->prepareForDrawing(
- glyphRun.glyphsIDs().data(), fPositions, glyphRun.runSize(), 0, fGlyphPos);
+ auto pathCache = SkStrikeCache::FindOrCreateStrikeExclusive(
+ pathFont, pathPaint, props,
+ fScalerContextFlags, SkMatrix::I());
SkTDArray<SkPathPos> pathsAndPositions;
- pathsAndPositions.setReserve(glyphPosSpan.size());
- for (const SkGlyphPos& glyphPos : glyphPosSpan) {
- const SkGlyph& glyph = *glyphPos.glyph;
- SkPoint position = glyphPos.position;
- if (check_glyph_position(position)
- && !glyph.isEmpty()
- && glyph.fMaskFormat != SkMask::kARGB32_Format
- && strike->decideCouldDrawFromPath(glyph))
- {
- // Only draw a path if it exists, and this is not a color glyph.
- pathsAndPositions.push_back(SkPathPos{glyph.path(), position});
+ pathsAndPositions.setReserve(runSize);
+ SkPoint* positionCursor = fPositions;
+ for (auto glyphID : glyphRun.glyphsIDs()) {
+ SkPoint position = *positionCursor++;
+ if (check_glyph_position(position)) {
+ const SkGlyph& glyph = pathCache->getGlyphMetrics(glyphID, {0, 0});
+ if (!glyph.isEmpty()) {
+ const SkPath* path = pathCache->findPath(glyph);
+ if (path != nullptr) {
+ pathsAndPositions.push_back(SkPathPos{path, position});
+ }
+ }
}
}