| Index: src/gpu/GrTextContext.cpp
 | 
| diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
 | 
| index 7ce7a3163ca0e130b0a3f7efa132f13b65814206..8ff2523a73b49d5e7c1d2cc45bb802684987c47e 100644
 | 
| --- a/src/gpu/GrTextContext.cpp
 | 
| +++ b/src/gpu/GrTextContext.cpp
 | 
| @@ -6,20 +6,14 @@
 | 
|   */
 | 
|  
 | 
|  #include "GrTextContext.h"
 | 
| -#include "GrBlurUtils.h"
 | 
|  #include "GrContext.h"
 | 
| -#include "GrDrawContext.h"
 | 
|  #include "GrFontScaler.h"
 | 
| +#include "GrTextUtils.h"
 | 
|  
 | 
| -#include "SkAutoKern.h"
 | 
|  #include "SkDrawFilter.h"
 | 
| -#include "SkDrawProcs.h"
 | 
|  #include "SkGlyphCache.h"
 | 
| -#include "SkGpuDevice.h"
 | 
|  #include "SkGrPriv.h"
 | 
|  #include "SkTextBlobRunIterator.h"
 | 
| -#include "SkTextMapStateProc.h"
 | 
| -#include "SkTextToPathIter.h"
 | 
|  
 | 
|  GrTextContext::GrTextContext(GrContext* context, const SkSurfaceProps& surfaceProps)
 | 
|      : fFallbackTextContext(nullptr)
 | 
| @@ -51,7 +45,8 @@ void GrTextContext::drawText(GrDrawContext* dc,
 | 
|      } while (textContext);
 | 
|  
 | 
|      // fall back to drawing as a path
 | 
| -    this->drawTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, x, y, clipBounds);
 | 
| +    GrTextUtils::DrawTextAsPath(fContext, dc, clip, skPaint, viewMatrix, text, byteLength, x, y,
 | 
| +                                clipBounds);
 | 
|  }
 | 
|  
 | 
|  void GrTextContext::drawPosText(GrDrawContext* dc,
 | 
| @@ -76,8 +71,8 @@ void GrTextContext::drawPosText(GrDrawContext* dc,
 | 
|      } while (textContext);
 | 
|  
 | 
|      // fall back to drawing as a path
 | 
| -    this->drawPosTextAsPath(dc, clip, skPaint, viewMatrix, text, byteLength, pos,
 | 
| -                            scalarsPerPosition, offset, clipBounds);
 | 
| +    GrTextUtils::DrawPosTextAsPath(fContext, dc, fSurfaceProps, clip, skPaint, viewMatrix, text,
 | 
| +                                   byteLength, pos, scalarsPerPosition, offset, clipBounds);
 | 
|  }
 | 
|  
 | 
|  bool GrTextContext::ShouldDisableLCD(const SkPaint& paint) {
 | 
| @@ -160,105 +155,6 @@ void GrTextContext::drawTextBlob(GrDrawContext* dc,
 | 
|      }
 | 
|  }
 | 
|  
 | 
| -void GrTextContext::drawTextAsPath(GrDrawContext* dc,
 | 
| -                                   const GrClip& clip,
 | 
| -                                   const SkPaint& skPaint, const SkMatrix& viewMatrix,
 | 
| -                                   const char text[], size_t byteLength, SkScalar x, SkScalar y,
 | 
| -                                   const SkIRect& clipBounds) {
 | 
| -    SkTextToPathIter iter(text, byteLength, skPaint, true);
 | 
| -
 | 
| -    SkMatrix    matrix;
 | 
| -    matrix.setScale(iter.getPathScale(), iter.getPathScale());
 | 
| -    matrix.postTranslate(x, y);
 | 
| -
 | 
| -    const SkPath* iterPath;
 | 
| -    SkScalar xpos, prevXPos = 0;
 | 
| -
 | 
| -    while (iter.next(&iterPath, &xpos)) {
 | 
| -        matrix.postTranslate(xpos - prevXPos, 0);
 | 
| -        if (iterPath) {
 | 
| -            const SkPaint& pnt = iter.getPaint();
 | 
| -            GrBlurUtils::drawPathWithMaskFilter(fContext, dc, clip, *iterPath,
 | 
| -                                                pnt, viewMatrix, &matrix, clipBounds, false);
 | 
| -        }
 | 
| -        prevXPos = xpos;
 | 
| -    }
 | 
| -}
 | 
| -
 | 
| -void GrTextContext::drawPosTextAsPath(GrDrawContext* dc,
 | 
| -                                      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) {
 | 
| -    // setup our std paint, in hopes of getting hits in the cache
 | 
| -    SkPaint paint(origPaint);
 | 
| -    SkScalar matrixScale = paint.setupForAsPaths();
 | 
| -
 | 
| -    SkMatrix matrix;
 | 
| -    matrix.setScale(matrixScale, matrixScale);
 | 
| -
 | 
| -    // Temporarily jam in kFill, so we only ever ask for the raw outline from the cache.
 | 
| -    paint.setStyle(SkPaint::kFill_Style);
 | 
| -    paint.setPathEffect(nullptr);
 | 
| -
 | 
| -    SkDrawCacheProc     glyphCacheProc = paint.getDrawCacheProc();
 | 
| -    SkAutoGlyphCache    autoCache(paint, &fSurfaceProps, nullptr);
 | 
| -    SkGlyphCache*       cache = autoCache.getCache();
 | 
| -
 | 
| -    const char*        stop = text + byteLength;
 | 
| -    SkTextAlignProc    alignProc(paint.getTextAlign());
 | 
| -    SkTextMapStateProc tmsProc(SkMatrix::I(), offset, scalarsPerPosition);
 | 
| -
 | 
| -    // Now restore the original settings, so we "draw" with whatever style/stroking.
 | 
| -    paint.setStyle(origPaint.getStyle());
 | 
| -    paint.setPathEffect(origPaint.getPathEffect());
 | 
| -
 | 
| -    while (text < stop) {
 | 
| -        const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
 | 
| -        if (glyph.fWidth) {
 | 
| -            const SkPath* path = cache->findPath(glyph);
 | 
| -            if (path) {
 | 
| -                SkPoint tmsLoc;
 | 
| -                tmsProc(pos, &tmsLoc);
 | 
| -                SkPoint loc;
 | 
| -                alignProc(tmsLoc, glyph, &loc);
 | 
| -
 | 
| -                matrix[SkMatrix::kMTransX] = loc.fX;
 | 
| -                matrix[SkMatrix::kMTransY] = loc.fY;
 | 
| -                GrBlurUtils::drawPathWithMaskFilter(fContext, dc, clip, *path, paint,
 | 
| -                                                    viewMatrix, &matrix, clipBounds, false);
 | 
| -            }
 | 
| -        }
 | 
| -        pos += scalarsPerPosition;
 | 
| -    }
 | 
| -}
 | 
| -
 | 
| -// *** change to output positions?
 | 
| -int GrTextContext::MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc,
 | 
| -                                const char text[], size_t byteLength, SkVector* stopVector) {
 | 
| -    SkFixed     x = 0, y = 0;
 | 
| -    const char* stop = text + byteLength;
 | 
| -
 | 
| -    SkAutoKern  autokern;
 | 
| -
 | 
| -    int numGlyphs = 0;
 | 
| -    while (text < stop) {
 | 
| -        // don't need x, y here, since all subpixel variants will have the
 | 
| -        // same advance
 | 
| -        const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
 | 
| -
 | 
| -        x += autokern.adjust(glyph) + glyph.fAdvanceX;
 | 
| -        y += glyph.fAdvanceY;
 | 
| -        ++numGlyphs;
 | 
| -    }
 | 
| -    stopVector->set(SkFixedToScalar(x), SkFixedToScalar(y));
 | 
| -
 | 
| -    SkASSERT(text == stop);
 | 
| -    
 | 
| -    return numGlyphs;
 | 
| -}
 | 
| -
 | 
|  static void GlyphCacheAuxProc(void* data) {
 | 
|      GrFontScaler* scaler = (GrFontScaler*)data;
 | 
|      SkSafeUnref(scaler);
 | 
| 
 |