From f4c13166de2ad3c67a4a391d8595b5c8fa04ad4d Mon Sep 17 00:00:00 2001 From: Jim Van Verth Date: Thu, 11 Jan 2018 16:40:24 -0500 Subject: Begin support for large color emoji glyphs Bug: skia: Change-Id: I10184a0c2ffae9baf3adb3c670d5e61ceeaf90ff Reviewed-on: https://skia-review.googlesource.com/93360 Reviewed-by: Brian Salomon Commit-Queue: Jim Van Verth --- src/gpu/text/GrAtlasTextBlob.cpp | 40 ++++----- src/gpu/text/GrAtlasTextBlob.h | 28 +++--- src/gpu/text/GrAtlasTextContext.cpp | 166 +++++++++++++++--------------------- src/gpu/text/GrAtlasTextContext.h | 10 +-- src/gpu/text/GrTextUtils.cpp | 20 ++--- src/gpu/text/GrTextUtils.h | 6 +- 6 files changed, 122 insertions(+), 148 deletions(-) (limited to 'src') diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp index 02f3ab0a21..df848db6f7 100644 --- a/src/gpu/text/GrAtlasTextBlob.cpp +++ b/src/gpu/text/GrAtlasTextBlob.cpp @@ -79,7 +79,7 @@ void GrAtlasTextBlob::appendGlyph(int runIndex, // If the glyph is too large we fall back to paths if (glyph->fTooLargeForAtlas) { - this->appendLargeGlyph(glyph, cache, skGlyph, x, y, scale, treatAsBMP); + this->appendBigGlyph(glyph, cache, skGlyph, x, y, scale, treatAsBMP); return; } @@ -139,7 +139,7 @@ void GrAtlasTextBlob::appendGlyph(int runIndex, subRun->glyphAppended(); } -void GrAtlasTextBlob::appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph, +void GrAtlasTextBlob::appendBigGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph, SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP) { if (nullptr == glyph->fPath) { const SkPath* glyphPath = cache->findPath(skGlyph); @@ -367,11 +367,11 @@ void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrTextUtils::Target* ta } } -void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrTextUtils::Target* target, - const SkSurfaceProps& props, const SkTextBlobRunIterator& it, - const GrClip& clip, const GrTextUtils::Paint& paint, - SkDrawFilter* drawFilter, const SkMatrix& viewMatrix, - const SkIRect& clipBounds, SkScalar x, SkScalar y) { +void GrAtlasTextBlob::flushBigRun(GrContext* context, GrTextUtils::Target* target, + const SkSurfaceProps& props, const SkTextBlobRunIterator& it, + const GrClip& clip, const GrTextUtils::Paint& paint, + SkDrawFilter* drawFilter, const SkMatrix& viewMatrix, + const SkIRect& clipBounds, SkScalar x, SkScalar y) { size_t textLen = it.glyphCount() * sizeof(uint16_t); const SkPoint& offset = it.offset(); @@ -382,19 +382,19 @@ void GrAtlasTextBlob::flushRunAsPaths(GrContext* context, GrTextUtils::Target* t switch (it.positioning()) { case SkTextBlob::kDefault_Positioning: - GrTextUtils::DrawTextAsPath(context, target, clip, runPaint, viewMatrix, - (const char*)it.glyphs(), textLen, x + offset.x(), - y + offset.y(), clipBounds); + GrTextUtils::DrawBigText(context, target, clip, runPaint, viewMatrix, + (const char*)it.glyphs(), textLen, x + offset.x(), + y + offset.y(), clipBounds); break; case SkTextBlob::kHorizontal_Positioning: - GrTextUtils::DrawPosTextAsPath(context, target, props, clip, runPaint, viewMatrix, - (const char*)it.glyphs(), textLen, it.pos(), 1, - SkPoint::Make(x, y + offset.y()), clipBounds); + GrTextUtils::DrawBigPosText(context, target, props, clip, runPaint, viewMatrix, + (const char*)it.glyphs(), textLen, it.pos(), 1, + SkPoint::Make(x, y + offset.y()), clipBounds); break; case SkTextBlob::kFull_Positioning: - GrTextUtils::DrawPosTextAsPath(context, target, props, clip, runPaint, viewMatrix, - (const char*)it.glyphs(), textLen, it.pos(), 2, - SkPoint::Make(x, y), clipBounds); + GrTextUtils::DrawBigPosText(context, target, props, clip, runPaint, viewMatrix, + (const char*)it.glyphs(), textLen, it.pos(), 2, + SkPoint::Make(x, y), clipBounds); break; } } @@ -409,9 +409,9 @@ void GrAtlasTextBlob::flushCached(GrContext* context, GrTextUtils::Target* targe // it as paths SkTextBlobRunIterator it(blob); for (int run = 0; !it.done(); it.next(), run++) { - if (fRuns[run].fDrawAsPaths) { - this->flushRunAsPaths(context, target, props, it, clip, paint, drawFilter, viewMatrix, - clipBounds, x, y); + if (fRuns[run].fTooBigForAtlas) { + this->flushBigRun(context, target, props, it, clip, paint, drawFilter, viewMatrix, + clipBounds, x, y); continue; } this->flushRun(target, clip, run, viewMatrix, x, y, paint, props, distanceAdjustTable, @@ -504,7 +504,7 @@ void GrAtlasTextBlob::AssertEqual(const GrAtlasTextBlob& l, const GrAtlasTextBlo // color can be changed //SkASSERT(lRun.fColor == rRun.fColor); SkASSERT_RELEASE(lRun.fInitialized == rRun.fInitialized); - SkASSERT_RELEASE(lRun.fDrawAsPaths == rRun.fDrawAsPaths); + SkASSERT_RELEASE(lRun.fTooBigForAtlas == rRun.fTooBigForAtlas); SkASSERT_RELEASE(lRun.fSubRunInfo.count() == rRun.fSubRunInfo.count()); for(int j = 0; j < lRun.fSubRunInfo.count(); j++) { diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index 1b8a264440..b93632fcfe 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -143,8 +143,8 @@ public: subRun.setHasWCoord(hasWCoord); } - void setRunDrawAsPaths(int runIndex) { - fRuns[runIndex].fDrawAsPaths = true; + void setRunTooBigForAtlas(int runIndex) { + fRuns[runIndex].fTooBigForAtlas = true; } void setMinAndMaxScale(SkScalar scaledMax, SkScalar scaledMin) { @@ -286,8 +286,8 @@ private: , fMinMaxScale(SK_ScalarMax) , fTextType(0) {} - void appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph, - SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP); + void appendBigGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph, + SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP); inline void flushRun(GrTextUtils::Target*, const GrClip&, int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const GrTextUtils::Paint& paint, @@ -299,11 +299,11 @@ private: const SkPaint& paint, const SkMatrix& viewMatrix, SkScalar x, SkScalar y, const SkIRect& clipBounds); - void flushRunAsPaths(GrContext* context, GrTextUtils::Target*, const SkSurfaceProps& props, - const SkTextBlobRunIterator& it, const GrClip& clip, - const GrTextUtils::Paint& paint, SkDrawFilter* drawFilter, - const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x, - SkScalar y); + void flushBigRun(GrContext* context, GrTextUtils::Target*, const SkSurfaceProps& props, + const SkTextBlobRunIterator& it, const GrClip& clip, + const GrTextUtils::Paint& paint, SkDrawFilter* drawFilter, + const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x, + SkScalar y); // This function will only be called when we are generating a blob from scratch. We record the // initial view matrix and initial offsets(x,y), because we record vertex bounds relative to @@ -338,19 +338,19 @@ private: * practice, the vast majority of runs have only a single subrun. * * Finally, for runs where the entire thing is too large for the GrAtlasTextContext to - * handle, we have a bit to mark the run as flushable via rendering as paths. It is worth - * pointing. It would be a bit expensive to figure out ahead of time whether or not a run + * handle, we have a bit to mark the run as flushable via rendering as paths or as scaled + * glyphs. It would be a bit expensive to figure out ahead of time whether or not a run * can flush in this manner, so we always allocate vertices for the run, regardless of * whether or not it is too large. The benefit of this strategy is that we can always reuse * a blob allocation regardless of viewmatrix changes. We could store positions for these - * glyphs. However, its not clear if this is a win because we'd still have to either go the + * glyphs, however, it's not clear if this is a win because we'd still have to either go to the * glyph cache to get the path at flush time, or hold onto the path in the cache, which * would greatly increase the memory of these cached items. */ struct Run { Run() : fInitialized(false) - , fDrawAsPaths(false) { + , fTooBigForAtlas(false) { // To ensure we always have one subrun, we push back a fresh run here fSubRunInfo.push_back(); } @@ -498,7 +498,7 @@ private: // will be used in place of the run's descriptor to regen texture coords std::unique_ptr fOverrideDescriptor; // df properties bool fInitialized; - bool fDrawAsPaths; + bool fTooBigForAtlas; }; // Run inline std::unique_ptr makeOp( diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp index 73a27100d3..41072ee296 100644 --- a/src/gpu/text/GrAtlasTextContext.cpp +++ b/src/gpu/text/GrAtlasTextContext.cpp @@ -229,7 +229,7 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob, } } } else if (SkDraw::ShouldDrawTextAsPaths(runPaint, viewMatrix)) { - cacheBlob->setRunDrawAsPaths(run); + cacheBlob->setRunTooBigForAtlas(run); } else { switch (it.positioning()) { case SkTextBlob::kDefault_Positioning: @@ -240,12 +240,12 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob, case SkTextBlob::kHorizontal_Positioning: DrawBmpPosText(cacheBlob, run, fontCache, props, runPaint, scalerContextFlags, viewMatrix, (const char*)it.glyphs(), textLen, it.pos(), 1, - SkPoint::Make(x, y + offset.y())); + SkPoint::Make(x, y + offset.y()), SK_Scalar1); break; case SkTextBlob::kFull_Positioning: DrawBmpPosText(cacheBlob, run, fontCache, props, runPaint, scalerContextFlags, viewMatrix, (const char*)it.glyphs(), textLen, it.pos(), 2, - SkPoint::Make(x, y)); + SkPoint::Make(x, y), SK_Scalar1); break; } } @@ -303,7 +303,7 @@ GrAtlasTextContext::makeDrawPosTextBlob(GrTextBlobCache* blobCache, text, byteLength, pos, scalarsPerPosition, offset); } else { DrawBmpPosText(blob.get(), 0, fontCache, props, paint, scalerContextFlags, viewMatrix, text, - byteLength, pos, scalarsPerPosition, offset); + byteLength, pos, scalarsPerPosition, offset, SK_Scalar1); } return blob; } @@ -330,9 +330,9 @@ void GrAtlasTextContext::drawText(GrContext* context, GrTextUtils::Target* targe return; } - // fall back to drawing as a path - GrTextUtils::DrawTextAsPath(context, target, clip, paint, viewMatrix, text, byteLength, x, y, - regionClipBounds); + // fall back to drawing as a path or scaled glyph + GrTextUtils::DrawBigText(context, target, clip, paint, viewMatrix, text, byteLength, x, y, + regionClipBounds); } void GrAtlasTextContext::drawPosText(GrContext* context, GrTextUtils::Target* target, @@ -357,9 +357,9 @@ void GrAtlasTextContext::drawPosText(GrContext* context, GrTextUtils::Target* ta return; } - // fall back to drawing as a path - GrTextUtils::DrawPosTextAsPath(context, target, props, clip, paint, viewMatrix, text, - byteLength, pos, scalarsPerPosition, offset, regionClipBounds); + // fall back to drawing as a path or scaled glyph + GrTextUtils::DrawBigPosText(context, target, props, clip, paint, viewMatrix, text, + byteLength, pos, scalarsPerPosition, offset, regionClipBounds); } void GrAtlasTextContext::DrawBmpText(GrAtlasTextBlob* blob, int runIndex, @@ -387,7 +387,8 @@ void GrAtlasTextContext::DrawBmpText(GrAtlasTextBlob* blob, int runIndex, BmpAppendGlyph(blob, runIndex, fontCache, &currStrike, glyph, SkScalarFloorToInt(position.fX), SkScalarFloorToInt(position.fY), - paint.filteredPremulColor(), cache); + paint.filteredPremulColor(), cache, + SK_Scalar1); }); SkGlyphCache::AttachCache(cache); @@ -398,7 +399,8 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex, const GrTextUtils::Paint& paint, uint32_t scalerContextFlags, const SkMatrix& viewMatrix, const char text[], size_t byteLength, const SkScalar pos[], - int scalarsPerPosition, const SkPoint& offset) { + int scalarsPerPosition, const SkPoint& offset, + SkScalar textRatio) { SkASSERT(byteLength == 0 || text != nullptr); SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); @@ -421,7 +423,7 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex, position += rounding; BmpAppendGlyph(blob, runIndex, fontCache, &currStrike, glyph, SkScalarFloorToInt(position.fX), SkScalarFloorToInt(position.fY), - paint.filteredPremulColor(), cache); + paint.filteredPremulColor(), cache, textRatio); }); SkGlyphCache::AttachCache(cache); @@ -430,34 +432,36 @@ void GrAtlasTextContext::DrawBmpPosText(GrAtlasTextBlob* blob, int runIndex, void GrAtlasTextContext::BmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrAtlasGlyphCache* fontCache, GrAtlasTextStrike** strike, const SkGlyph& skGlyph, int vx, int vy, GrColor color, - SkGlyphCache* cache) { + SkGlyphCache* glyphCache, SkScalar textRatio) { if (!*strike) { - *strike = fontCache->getStrike(cache); + *strike = fontCache->getStrike(glyphCache); } GrGlyph::PackedID id = GrGlyph::Pack(skGlyph.getGlyphID(), skGlyph.getSubXFixed(), skGlyph.getSubYFixed(), GrGlyph::kCoverage_MaskStyle); - GrGlyph* glyph = (*strike)->getGlyph(skGlyph, id, cache); + GrGlyph* glyph = (*strike)->getGlyph(skGlyph, id, glyphCache); if (!glyph) { return; } - int x = vx + glyph->fBounds.fLeft; - int y = vy + glyph->fBounds.fTop; + SkScalar dx = SkIntToScalar(glyph->fBounds.fLeft); + SkScalar dy = SkIntToScalar(glyph->fBounds.fTop); + SkScalar width = SkIntToScalar(glyph->fBounds.width()); + SkScalar height = SkIntToScalar(glyph->fBounds.height()); + SkScalar sx = SkIntToScalar(vx); + SkScalar sy = SkIntToScalar(vy); - int width = glyph->fBounds.width(); - int height = glyph->fBounds.height(); + dx *= textRatio; + dy *= textRatio; + width *= textRatio; + height *= textRatio; - SkRect r; - r.fLeft = SkIntToScalar(x); - r.fTop = SkIntToScalar(y); - r.fRight = r.fLeft + SkIntToScalar(width); - r.fBottom = r.fTop + SkIntToScalar(height); + SkRect glyphRect = SkRect::MakeXYWH(sx + dx, sy + dy, width, height); - blob->appendGlyph(runIndex, r, color, *strike, glyph, cache, skGlyph, SkIntToScalar(vx), - SkIntToScalar(vy), 1.0f, true); + blob->appendGlyph(runIndex, glyphRect, color, *strike, glyph, glyphCache, skGlyph, sx, sy, + textRatio, true); } bool GrAtlasTextContext::canDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix, @@ -668,56 +672,34 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, const char* stop = text + byteLength; - if (SkPaint::kLeft_Align == dfPaint.getTextAlign()) { - while (text < stop) { - const char* lastText = text; - // the last 2 parameters are ignored - const SkGlyph& glyph = glyphCacheProc(cache, &text); - - if (glyph.fWidth) { - SkScalar x = offset.x() + pos[0]; - SkScalar y = offset.y() + (2 == scalarsPerPosition ? pos[1] : 0); - - if (!DfAppendGlyph(blob, runIndex, fontCache, &currStrike, glyph, x, y, - paint.filteredPremulColor(), cache, textRatio, viewMatrix)) { - // couldn't append, send to fallback - fallbackTxt.append(SkToInt(text - lastText), lastText); - *fallbackPos.append() = pos[0]; - if (2 == scalarsPerPosition) { - *fallbackPos.append() = pos[1]; - } - } - } - pos += scalarsPerPosition; - } - } else { - SkScalar alignMul = - SkPaint::kCenter_Align == dfPaint.getTextAlign() ? SK_ScalarHalf : SK_Scalar1; - while (text < stop) { - const char* lastText = text; - // the last 2 parameters are ignored - const SkGlyph& glyph = glyphCacheProc(cache, &text); - - if (glyph.fWidth) { - SkScalar x = offset.x() + pos[0]; - SkScalar y = offset.y() + (2 == scalarsPerPosition ? pos[1] : 0); - - SkScalar advanceX = SkFloatToScalar(glyph.fAdvanceX) * alignMul * textRatio; - SkScalar advanceY = SkFloatToScalar(glyph.fAdvanceY) * alignMul * textRatio; - - if (!DfAppendGlyph(blob, runIndex, fontCache, &currStrike, glyph, x - advanceX, - y - advanceY, paint.filteredPremulColor(), cache, textRatio, - viewMatrix)) { - // couldn't append, send to fallback - fallbackTxt.append(SkToInt(text - lastText), lastText); - *fallbackPos.append() = pos[0]; - if (2 == scalarsPerPosition) { - *fallbackPos.append() = pos[1]; - } + SkPaint::Align align = dfPaint.getTextAlign(); + SkScalar alignMul = SkPaint::kCenter_Align == align ? SK_ScalarHalf : + (SkPaint::kRight_Align == align ? SK_Scalar1 : 0); + while (text < stop) { + const char* lastText = text; + // the last 2 parameters are ignored + const SkGlyph& glyph = glyphCacheProc(cache, &text); + + if (glyph.fWidth) { + SkScalar x = offset.x() + pos[0]; + SkScalar y = offset.y() + (2 == scalarsPerPosition ? pos[1] : 0); + + SkScalar advanceX = SkFloatToScalar(glyph.fAdvanceX) * alignMul * textRatio; + SkScalar advanceY = SkFloatToScalar(glyph.fAdvanceY) * alignMul * textRatio; + + if (glyph.fMaskFormat != SkMask::kARGB32_Format) { + DfAppendGlyph(blob, runIndex, fontCache, &currStrike, glyph, x - advanceX, + y - advanceY, paint.filteredPremulColor(), cache, textRatio); + } else { + // can't append color glyph to SDF batch, send to fallback + fallbackTxt.append(SkToInt(text - lastText), lastText); + *fallbackPos.append() = pos[0]; + if (2 == scalarsPerPosition) { + *fallbackPos.append() = pos[1]; } } - pos += scalarsPerPosition; } + pos += scalarsPerPosition; } SkGlyphCache::AttachCache(cache); @@ -726,15 +708,16 @@ void GrAtlasTextContext::drawDFPosText(GrAtlasTextBlob* blob, int runIndex, GrAtlasTextContext::DrawBmpPosText(blob, runIndex, fontCache, props, paint, scalerContextFlags, viewMatrix, fallbackTxt.begin(), fallbackTxt.count(), fallbackPos.begin(), - scalarsPerPosition, offset); + scalarsPerPosition, offset, SK_Scalar1); } } -bool GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, +// TODO: merge with BmpAppendGlyph +void GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrAtlasGlyphCache* cache, GrAtlasTextStrike** strike, const SkGlyph& skGlyph, SkScalar sx, SkScalar sy, - GrColor color, SkGlyphCache* glyphCache, SkScalar textRatio, - const SkMatrix& viewMatrix) { + GrColor color, SkGlyphCache* glyphCache, + SkScalar textRatio) { if (!*strike) { *strike = cache->getStrike(glyphCache); } @@ -745,12 +728,7 @@ bool GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrGlyph::kDistance_MaskStyle); GrGlyph* glyph = (*strike)->getGlyph(skGlyph, id, glyphCache); if (!glyph) { - return true; - } - - // fallback to color glyph support - if (kA8_GrMaskFormat != glyph->fMaskFormat) { - return false; + return; } SkScalar dx = SkIntToScalar(glyph->fBounds.fLeft + SK_DistanceFieldInset); @@ -758,18 +736,14 @@ bool GrAtlasTextContext::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, SkScalar width = SkIntToScalar(glyph->fBounds.width() - 2 * SK_DistanceFieldInset); SkScalar height = SkIntToScalar(glyph->fBounds.height() - 2 * SK_DistanceFieldInset); - SkScalar scale = textRatio; - dx *= scale; - dy *= scale; - width *= scale; - height *= scale; - sx += dx; - sy += dy; - SkRect glyphRect = SkRect::MakeXYWH(sx, sy, width, height); - - blob->appendGlyph(runIndex, glyphRect, color, *strike, glyph, glyphCache, skGlyph, sx - dx, - sy - dy, scale, false); - return true; + dx *= textRatio; + dy *= textRatio; + width *= textRatio; + height *= textRatio; + SkRect glyphRect = SkRect::MakeXYWH(sx + dx, sy + dy, width, height); + + blob->appendGlyph(runIndex, glyphRect, color, *strike, glyph, glyphCache, skGlyph, sx, sy, + textRatio, false); } /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/text/GrAtlasTextContext.h b/src/gpu/text/GrAtlasTextContext.h index 52c8dfcb87..9c44128f52 100644 --- a/src/gpu/text/GrAtlasTextContext.h +++ b/src/gpu/text/GrAtlasTextContext.h @@ -107,7 +107,8 @@ private: const SkSurfaceProps&, const GrTextUtils::Paint& paint, uint32_t scalerContextFlags, const SkMatrix& viewMatrix, const char text[], size_t byteLength, const SkScalar pos[], - int scalarsPerPosition, const SkPoint& offset); + int scalarsPerPosition, const SkPoint& offset, + SkScalar textRatio); // functions for appending distance field text bool canDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix, @@ -131,12 +132,11 @@ private: static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrAtlasGlyphCache*, GrAtlasTextStrike**, const SkGlyph&, int left, int top, - GrColor color, SkGlyphCache*); + GrColor color, SkGlyphCache*, SkScalar textRatio); - static bool DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrAtlasGlyphCache*, + static void DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrAtlasGlyphCache*, GrAtlasTextStrike**, const SkGlyph&, SkScalar sx, SkScalar sy, - GrColor color, SkGlyphCache* cache, SkScalar textRatio, - const SkMatrix& viewMatrix); + GrColor color, SkGlyphCache* cache, SkScalar textRatio); const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAdjustTable.get(); } diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp index 999cf8d690..20a3a5c52c 100644 --- a/src/gpu/text/GrTextUtils.cpp +++ b/src/gpu/text/GrTextUtils.cpp @@ -78,10 +78,10 @@ bool GrTextUtils::ShouldDisableLCD(const SkPaint& paint) { paint.isFakeBoldText() || paint.getStyle() != SkPaint::kFill_Style; } -void GrTextUtils::DrawTextAsPath(GrContext* context, GrTextUtils::Target* target, - const GrClip& clip, const SkPaint& paint, - const SkMatrix& viewMatrix, const char text[], size_t byteLength, - SkScalar x, SkScalar y, const SkIRect& clipBounds) { +void GrTextUtils::DrawBigText(GrContext* context, GrTextUtils::Target* target, + const GrClip& clip, const SkPaint& paint, + const SkMatrix& viewMatrix, const char text[], size_t byteLength, + SkScalar x, SkScalar y, const SkIRect& clipBounds) { if (!paint.countText(text, byteLength)) { return; } @@ -104,12 +104,12 @@ void GrTextUtils::DrawTextAsPath(GrContext* context, GrTextUtils::Target* target } } -void GrTextUtils::DrawPosTextAsPath(GrContext* context, GrTextUtils::Target* target, - const SkSurfaceProps& props, const GrClip& clip, - const SkPaint& origPaint, const SkMatrix& viewMatrix, - const char text[], size_t byteLength, const SkScalar pos[], - int scalarsPerPosition, const SkPoint& offset, - const SkIRect& clipBounds) { +void GrTextUtils::DrawBigPosText(GrContext* context, GrTextUtils::Target* target, + const SkSurfaceProps& props, const GrClip& clip, + const SkPaint& origPaint, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, const SkScalar pos[], + int scalarsPerPosition, const SkPoint& offset, + const SkIRect& clipBounds) { if (!origPaint.countText(text, byteLength)) { return; } diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h index f72102d6cf..3b1968decd 100644 --- a/src/gpu/text/GrTextUtils.h +++ b/src/gpu/text/GrTextUtils.h @@ -128,13 +128,13 @@ public: static bool ShouldDisableLCD(const SkPaint& paint); - // Functions for drawing text as paths - static void DrawTextAsPath(GrContext*, GrTextUtils::Target*, const GrClip& clip, + // Functions for drawing large text either as paths or (for color emoji) as scaled glyphs + static void DrawBigText(GrContext*, GrTextUtils::Target*, const GrClip& clip, const SkPaint& paint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x, SkScalar y, const SkIRect& clipBounds); - static void DrawPosTextAsPath(GrContext* context, GrTextUtils::Target*, + static void DrawBigPosText(GrContext* context, GrTextUtils::Target*, const SkSurfaceProps& props, const GrClip& clip, const SkPaint& paint, const SkMatrix& viewMatrix, const char text[], size_t byteLength, const SkScalar pos[], -- cgit v1.2.3