aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAtlasTextBlob.cpp24
-rw-r--r--src/gpu/GrAtlasTextBlob.h9
-rw-r--r--src/gpu/GrAtlasTextContext.cpp34
-rw-r--r--src/gpu/GrAtlasTextContext.h3
4 files changed, 35 insertions, 35 deletions
diff --git a/src/gpu/GrAtlasTextBlob.cpp b/src/gpu/GrAtlasTextBlob.cpp
index 1cd25e74de..aa50cbf254 100644
--- a/src/gpu/GrAtlasTextBlob.cpp
+++ b/src/gpu/GrAtlasTextBlob.cpp
@@ -11,7 +11,16 @@ void GrAtlasTextBlob::appendGlyph(int runIndex,
const SkRect& positions,
GrColor color,
GrBatchTextStrike* strike,
- GrGlyph* glyph) {
+ GrGlyph* glyph,
+ GrFontScaler* scaler, const SkGlyph& skGlyph,
+ SkScalar x, SkScalar y, SkScalar scale, bool applyVM) {
+
+ // If the glyph is too large we fall back to paths
+ if (glyph->fTooLargeForAtlas) {
+ this->appendLargeGlyph(glyph, scaler, skGlyph, x, y, scale, applyVM);
+ return;
+ }
+
Run& run = fRuns[runIndex];
GrMaskFormat format = glyph->fMaskFormat;
@@ -86,6 +95,19 @@ void GrAtlasTextBlob::appendGlyph(int runIndex,
subRun->glyphAppended();
}
+void GrAtlasTextBlob::appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, const SkGlyph& skGlyph,
+ SkScalar x, SkScalar y, SkScalar scale, bool applyVM) {
+ if (nullptr == glyph->fPath) {
+ const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
+ if (!glyphPath) {
+ return;
+ }
+
+ glyph->fPath = new SkPath(*glyphPath);
+ }
+ fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, applyVM));
+}
+
bool GrAtlasTextBlob::mustRegenerate(SkScalar* outTransX, SkScalar* outTransY,
const SkPaint& paint,
GrColor color, const SkMaskFilter::BlurRec& blurRec,
diff --git a/src/gpu/GrAtlasTextBlob.h b/src/gpu/GrAtlasTextBlob.h
index 3ec3c44999..35f642883f 100644
--- a/src/gpu/GrAtlasTextBlob.h
+++ b/src/gpu/GrAtlasTextBlob.h
@@ -283,11 +283,15 @@ struct GrAtlasTextBlob : public SkNVRefCnt<GrAtlasTextBlob> {
}
}
+ // Appends a glyph to the blob. If the glyph is too large, the glyph will be appended
+ // as a path.
void appendGlyph(int runIndex,
const SkRect& positions,
GrColor color,
GrBatchTextStrike* strike,
- GrGlyph* glyph);
+ GrGlyph* glyph,
+ GrFontScaler* scaler, const SkGlyph& skGlyph,
+ SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
static size_t GetVertexStride(GrMaskFormat maskFormat) {
switch (maskFormat) {
@@ -314,6 +318,9 @@ struct GrAtlasTextBlob : public SkNVRefCnt<GrAtlasTextBlob> {
static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&);
size_t fSize;
#endif
+private:
+ void appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, const SkGlyph& skGlyph,
+ SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
};
#endif
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index 615f7091cd..153d0fe516 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -889,19 +889,14 @@ void GrAtlasTextContext::bmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
int width = glyph->fBounds.width();
int height = glyph->fBounds.height();
- // If the glyph is too large we fall back to paths
- if (glyph->fTooLargeForAtlas) {
- this->appendGlyphPath(blob, glyph, scaler, skGlyph, SkIntToScalar(vx), SkIntToScalar(vy));
- return;
- }
-
SkRect r;
r.fLeft = SkIntToScalar(x);
r.fTop = SkIntToScalar(y);
r.fRight = r.fLeft + SkIntToScalar(width);
r.fBottom = r.fTop + SkIntToScalar(height);
- blob->appendGlyph(runIndex, r, color, fCurrStrike, glyph);
+ blob->appendGlyph(runIndex, r, color, fCurrStrike, glyph, scaler, skGlyph,
+ SkIntToScalar(vx), SkIntToScalar(vy), 1.0f, false);
}
bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
@@ -941,32 +936,11 @@ bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
sy += dy;
SkRect glyphRect = SkRect::MakeXYWH(sx, sy, width, height);
- // TODO combine with the above
- // If the glyph is too large we fall back to paths
- if (glyph->fTooLargeForAtlas) {
- this->appendGlyphPath(blob, glyph, scaler, skGlyph, sx - dx, sy - dy, scale, true);
- return true;
- }
-
- blob->appendGlyph(runIndex, glyphRect, color, fCurrStrike, glyph);
+ blob->appendGlyph(runIndex, glyphRect, color, fCurrStrike, glyph, scaler, skGlyph,
+ sx - dx, sy - dy, scale, true);
return true;
}
-inline void GrAtlasTextContext::appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph,
- GrFontScaler* scaler, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y, SkScalar scale,
- bool applyVM) {
- if (nullptr == glyph->fPath) {
- const SkPath* glyphPath = scaler->getGlyphPath(skGlyph);
- if (!glyphPath) {
- return;
- }
-
- glyph->fPath = new SkPath(*glyphPath);
- }
- blob->fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, applyVM));
-}
-
void GrAtlasTextContext::flushRunAsPaths(GrDrawContext* dc,
const SkTextBlobRunIterator& it,
const GrClip& clip, const SkPaint& skPaint,
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index c85740d9e0..20f747ff15 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -62,9 +62,6 @@ private:
bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, SkScalar sx, SkScalar sy,
GrColor color, GrFontScaler*, SkScalar textRatio,
const SkMatrix& viewMatrix);
- inline void appendGlyphPath(GrAtlasTextBlob*, GrGlyph*, GrFontScaler*, const SkGlyph&,
- SkScalar x, SkScalar y, SkScalar scale = 1.0f,
- bool applyVM = false);
inline void flushRunAsPaths(GrDrawContext*,
const SkTextBlobRunIterator&, const GrClip& clip,