Index: src/gpu/text/GrTextContext.cpp |
diff --git a/src/gpu/text/GrTextContext.cpp b/src/gpu/text/GrTextContext.cpp |
index 8ff2523a73b49d5e7c1d2cc45bb802684987c47e..7f5ad55b091e62db87e8d690d03e0dfa30b91127 100644 |
--- a/src/gpu/text/GrTextContext.cpp |
+++ b/src/gpu/text/GrTextContext.cpp |
@@ -6,75 +6,15 @@ |
*/ |
#include "GrTextContext.h" |
-#include "GrContext.h" |
#include "GrFontScaler.h" |
-#include "GrTextUtils.h" |
-#include "SkDrawFilter.h" |
#include "SkGlyphCache.h" |
-#include "SkGrPriv.h" |
-#include "SkTextBlobRunIterator.h" |
GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfaceProps) |
- : fFallbackTextContext(nullptr) |
- , fContext(context) |
+ : fContext(context) |
, fSurfaceProps(surfaceProps) { |
} |
-GrTextContext::~GrTextContext() { |
- delete fFallbackTextContext; |
-} |
- |
-void GrTextContext::drawText(GrDrawContext* dc, |
- const GrClip& clip, const GrPaint& paint, |
- const SkPaint& skPaint, const SkMatrix& viewMatrix, |
- const char text[], size_t byteLength, |
- SkScalar x, SkScalar y, const SkIRect& clipBounds) { |
- if (fContext->abandoned()) { |
- return; |
- } |
- |
- GrTextContext* textContext = this; |
- do { |
- if (textContext->canDraw(skPaint, viewMatrix)) { |
- textContext->onDrawText(dc, clip, paint, skPaint, viewMatrix, |
- text, byteLength, x, y, clipBounds); |
- return; |
- } |
- textContext = textContext->fFallbackTextContext; |
- } while (textContext); |
- |
- // fall back to drawing as a path |
- GrTextUtils::DrawTextAsPath(fContext, dc, clip, skPaint, viewMatrix, text, byteLength, x, y, |
- clipBounds); |
-} |
- |
-void GrTextContext::drawPosText(GrDrawContext* dc, |
- const GrClip& clip, const GrPaint& paint, |
- const SkPaint& skPaint, const SkMatrix& viewMatrix, |
- const char text[], size_t byteLength, |
- const SkScalar pos[], int scalarsPerPosition, |
- const SkPoint& offset, const SkIRect& clipBounds) { |
- if (fContext->abandoned()) { |
- return; |
- } |
- |
- GrTextContext* textContext = this; |
- do { |
- if (textContext->canDraw(skPaint, viewMatrix)) { |
- textContext->onDrawPosText(dc, clip, paint, skPaint, viewMatrix, |
- text, byteLength, pos, |
- scalarsPerPosition, offset, clipBounds); |
- return; |
- } |
- textContext = textContext->fFallbackTextContext; |
- } while (textContext); |
- |
- // fall back to drawing as a path |
- GrTextUtils::DrawPosTextAsPath(fContext, dc, fSurfaceProps, clip, skPaint, viewMatrix, text, |
- byteLength, pos, scalarsPerPosition, offset, clipBounds); |
-} |
- |
bool GrTextContext::ShouldDisableLCD(const SkPaint& paint) { |
if (!SkXfermode::AsMode(paint.getXfermode(), nullptr) || |
paint.getMaskFilter() || |
@@ -103,58 +43,6 @@ uint32_t GrTextContext::FilterTextFlags(const SkSurfaceProps& surfaceProps, cons |
return flags; |
} |
-void GrTextContext::drawTextBlob(GrDrawContext* dc, |
- const GrClip& clip, const SkPaint& skPaint, |
- const SkMatrix& viewMatrix, const SkTextBlob* blob, |
- SkScalar x, SkScalar y, |
- SkDrawFilter* drawFilter, const SkIRect& clipBounds) { |
- SkPaint runPaint = skPaint; |
- |
- SkTextBlobRunIterator it(blob); |
- for (;!it.done(); it.next()) { |
- size_t textLen = it.glyphCount() * sizeof(uint16_t); |
- const SkPoint& offset = it.offset(); |
- // applyFontToPaint() always overwrites the exact same attributes, |
- // so it is safe to not re-seed the paint for this reason. |
- it.applyFontToPaint(&runPaint); |
- |
- if (drawFilter && !drawFilter->filter(&runPaint, SkDrawFilter::kText_Type)) { |
- // A false return from filter() means we should abort the current draw. |
- runPaint = skPaint; |
- continue; |
- } |
- |
- runPaint.setFlags(FilterTextFlags(fSurfaceProps, runPaint)); |
- |
- GrPaint grPaint; |
- if (!SkPaintToGrPaint(fContext, runPaint, viewMatrix, &grPaint)) { |
- return; |
- } |
- |
- switch (it.positioning()) { |
- case SkTextBlob::kDefault_Positioning: |
- this->drawText(dc, clip, grPaint, runPaint, viewMatrix, (const char *)it.glyphs(), |
- textLen, x + offset.x(), y + offset.y(), clipBounds); |
- break; |
- case SkTextBlob::kHorizontal_Positioning: |
- this->drawPosText(dc, clip, grPaint, runPaint, viewMatrix, (const char*)it.glyphs(), |
- textLen, it.pos(), 1, SkPoint::Make(x, y + offset.y()), clipBounds); |
- break; |
- case SkTextBlob::kFull_Positioning: |
- this->drawPosText(dc, clip, grPaint, runPaint, viewMatrix, (const char*)it.glyphs(), |
- textLen, it.pos(), 2, SkPoint::Make(x, y), clipBounds); |
- break; |
- default: |
- SkFAIL("unhandled positioning mode"); |
- } |
- |
- if (drawFilter) { |
- // A draw filter may change the paint arbitrarily, so we must re-seed in this case. |
- runPaint = skPaint; |
- } |
- } |
-} |
- |
static void GlyphCacheAuxProc(void* data) { |
GrFontScaler* scaler = (GrFontScaler*)data; |
SkSafeUnref(scaler); |