Implement text rendering with NVPR

Use path rendering to render the text from outlines if supported by the
GPU. Implement this in GrStencilAndCoverTextContext by copying chunks of code
from GrBitmapTextContext.

The drawing is implemented with "instanced" path drawing functions.

Moves the creation of the "main" text context from SkGpuDevice to the
GrContext::createTextContext. This is done because the decision of which text
renderer is optimal can be made only with the internal implementation-specific
information of the context.

Remove a windows assertion from SkScalerContext_GDI::getGDIGlyphPath.  The
GetGlyphOutlineW fails in fontmgr_match for the initial space char in the string
" [700] ...". According to MSDN, this is a known problem.  Just return that the
glyph has no path data in these cases.

R=jvanverth@google.com, bsalomon@google.com, mtklein@google.com

Author: kkinnunen@nvidia.com

Review URL: https://codereview.chromium.org/196133014
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 608ec50..af44aa7 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -38,6 +38,7 @@
 class GrResourceCache;
 class GrStencilBuffer;
 class GrTestTarget;
+class GrTextContext;
 class GrTextureParams;
 class GrVertexBuffer;
 class GrVertexBufferAllocPool;
@@ -194,6 +195,16 @@
      */
     GrCacheable* findAndRefCachedResource(const GrResourceKey&);
 
+    /**
+     * Creates a new text rendering context that is optimal for the
+     * render target and the context. Caller assumes the ownership
+     * of the returned object. The returned object must be deleted
+     * before the context is destroyed.
+     */
+    GrTextContext* createTextContext(GrRenderTarget*,
+                                     const SkDeviceProperties&,
+                                     bool enableDistanceFieldFonts);
+
     ///////////////////////////////////////////////////////////////////////////
     // Textures
 
@@ -1018,6 +1029,7 @@
     // addExistingTextureToCache
     friend class GrTexture;
     friend class GrStencilAndCoverPathRenderer;
+    friend class GrStencilAndCoverTextContext;
 
     // Add an existing texture to the texture cache. This is intended solely
     // for use with textures released from an GrAutoScratchTexture.
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 50a32a5..db9b8cc 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -214,6 +214,7 @@
     }
 
     friend class GrContext; // To access above two functions
+    friend class GrStencilAndCoverTextContext;  // To access above two functions
 
     SkSTArray<4, GrEffectStage> fColorStages;
     SkSTArray<2, GrEffectStage> fCoverageStages;