aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/text
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/text')
-rw-r--r--src/gpu/text/GrTextContext.cpp36
-rw-r--r--src/gpu/text/GrTextContext.h3
-rw-r--r--src/gpu/text/GrTextUtils.h3
3 files changed, 24 insertions, 18 deletions
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp
index 7b15abc666..6017742707 100644
--- a/src/gpu/text/GrTextContext.cpp
+++ b/src/gpu/text/GrTextContext.cpp
@@ -92,7 +92,8 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps& props,
- const SkGlyphRunList& glyphRunList) const {
+ const SkGlyphRunList& glyphRunList,
+ SkGlyphRunListDrawer* glyphDrawer) {
SkPoint origin = glyphRunList.origin();
cacheBlob->initReusableBlob(paint.luminanceColor(), viewMatrix, origin.x(), origin.y());
@@ -193,19 +194,17 @@ void GrTextContext::regenerateGlyphRunList(GrTextBlob* cacheBlob,
sk_sp<GrTextStrike> currStrike;
auto cache = cacheBlob->setupCache(
runIndex, props, scalerContextFlags, runPaint, &viewMatrix);
- SkFindAndPlaceGlyph::ProcessPosText(
- SkPaint::kGlyphID_TextEncoding,
- (const char*) glyphRun.shuntGlyphsIDs().data(),
- glyphRun.shuntGlyphsIDs().size() * sizeof(SkGlyphID),
- origin, viewMatrix, (const SkScalar*) glyphRun.positions().data(), 2, cache.get(),
- [&](const SkGlyph& glyph, SkPoint position, SkPoint rounding) {
- position += rounding;
- BmpAppendGlyph(cacheBlob, runIndex, glyphCache, &currStrike, glyph,
- SkScalarFloorToScalar(position.fX),
- SkScalarFloorToScalar(position.fY),
- runPaint.filteredPremulColor(), cache.get(), SK_Scalar1, false);
- }
- );
+
+ auto drawOneGlyph =
+ [cacheBlob, runIndex, glyphCache, &currStrike, runPaint, cache{cache.get()}]
+ (const SkMask& mask, const SkGlyph& glyph, SkPoint position) {
+ BmpAppendGlyph(cacheBlob, runIndex, glyphCache, &currStrike, glyph,
+ SkScalarFloorToScalar(position.fX),
+ SkScalarFloorToScalar(position.fY),
+ runPaint.filteredPremulColor(), cache, SK_Scalar1, false);
+ };
+
+ glyphDrawer->drawUsingMasks(cache.get(), glyphRun, origin, viewMatrix, drawOneGlyph);
}
runIndex += 1;
}
@@ -270,7 +269,8 @@ void GrTextContext::drawGlyphRunList(
cacheBlob = textBlobCache->makeCachedBlob(glyphRunList, key, blurRec, skPaint);
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, glyphRunList);
+ scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
} else {
textBlobCache->makeMRU(cacheBlob.get());
@@ -281,7 +281,8 @@ void GrTextContext::drawGlyphRunList(
sanityBlob->setupKey(key, blurRec, skPaint);
this->regenerateGlyphRunList(
sanityBlob.get(), glyphCache, *context->contextPriv().caps()->shaderCaps(),
- paint, scalerContextFlags, viewMatrix, props, glyphRunList);
+ paint, scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
GrTextBlob::AssertEqual(*sanityBlob, *cacheBlob);
}
}
@@ -293,7 +294,8 @@ void GrTextContext::drawGlyphRunList(
}
this->regenerateGlyphRunList(cacheBlob.get(), glyphCache,
*context->contextPriv().caps()->shaderCaps(), paint,
- scalerContextFlags, viewMatrix, props, glyphRunList);
+ scalerContextFlags, viewMatrix, props, glyphRunList,
+ target->glyphDrawer());
}
cacheBlob->flush(target, props, fDistanceAdjustTable.get(), paint,
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index 2794a84b82..908e6419b8 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -158,7 +158,8 @@ private:
SkScalerContextFlags scalerContextFlags,
const SkMatrix& viewMatrix,
const SkSurfaceProps&,
- const SkGlyphRunList& glyphRunList) const;
+ const SkGlyphRunList& glyphRunList,
+ SkGlyphRunListDrawer* glyphDrawer);
sk_sp<GrTextBlob> makeDrawPosTextBlob(GrTextBlobCache*, GrGlyphCache*,
const GrShaderCaps&,
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h
index 05fbf6f35e..a02cebf7dd 100644
--- a/src/gpu/text/GrTextUtils.h
+++ b/src/gpu/text/GrTextUtils.h
@@ -27,6 +27,7 @@ class GrPaint;
class GrShaderCaps;
class SkColorSpace;
class SkGlyph;
+class SkGlyphRunListDrawer;
class SkMatrix;
struct SkIRect;
struct SkPoint;
@@ -58,6 +59,8 @@ public:
virtual GrContext* getContext() = 0;
+ virtual SkGlyphRunListDrawer* glyphDrawer() = 0;
+
protected:
Target(int width, int height, const GrColorSpaceInfo& colorSpaceInfo)
: fWidth(width), fHeight(height), fColorSpaceInfo(colorSpaceInfo) {}