Reland "Convert the CPU path case to use prepareForDrawing"
This is a reland of 8be917af43
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>
Change-Id: I307792b443d4738ee2ccb545cc40256bc94cacee
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/207887
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Herb Derby <herb@google.com>
This commit is contained in:
parent
69f54f8f0f
commit
33233a09fe
@ -166,22 +166,43 @@ void SkGlyphRunListPainter::drawForBitmapDevice(
|
||||
// The sub-pixel position will always happen when transforming to the screen.
|
||||
pathFont.setSubpixel(false);
|
||||
|
||||
auto pathCache = SkStrikeCache::FindOrCreateStrikeExclusive(
|
||||
pathFont, pathPaint, props,
|
||||
fScalerContextFlags, SkMatrix::I());
|
||||
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);
|
||||
|
||||
SkTDArray<SkPathPos> pathsAndPositions;
|
||||
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});
|
||||
}
|
||||
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});
|
||||
} else {
|
||||
// TODO: this is here to have chrome layout tests pass. Remove this when
|
||||
// fallback for CPU works.
|
||||
if (check_glyph_position(position)
|
||||
&& !glyph.isEmpty()
|
||||
&& strike->decideCouldDrawFromPath(glyph))
|
||||
{
|
||||
pathsAndPositions.push_back(SkPathPos{glyph.path(), position});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user