diff options
-rw-r--r-- | include/gpu/GrContextOptions.h | 6 | ||||
-rw-r--r-- | src/gpu/GrContext.cpp | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/gpu/GrContextOptions.h b/include/gpu/GrContextOptions.h index b94b5cee5f..471195a589 100644 --- a/include/gpu/GrContextOptions.h +++ b/include/gpu/GrContextOptions.h @@ -56,6 +56,12 @@ struct GrContextOptions { bool fEnableInstancedRendering = false; /** + * Disables distance field rendering for paths. Distance field computation can be expensive, + * and yields no benefit if a path is not rendered multiple times with different transforms. + */ + bool fDisableDistanceFieldPaths = false; + + /** * If true this allows path mask textures to be cached. This is only really useful if paths * are commonly rendered at the same scale and fractional translation. */ diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 8714b20da7..907f82c51b 100644 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -197,6 +197,9 @@ bool GrContext::init(const GrContextOptions& options) { GrPathRendererChain::Options prcOptions; prcOptions.fAllowPathMaskCaching = options.fAllowPathMaskCaching; prcOptions.fGpuPathRenderers = options.fGpuPathRenderers; + if (options.fDisableDistanceFieldPaths) { + prcOptions.fGpuPathRenderers &= ~GrContextOptions::GpuPathRenderers::kDistanceField; + } fDrawingManager.reset(new GrDrawingManager(this, prcOptions, &fSingleOwner)); fAtlasGlyphCache = new GrAtlasGlyphCache(this, options.fGlyphCacheTextureMaximumBytes); |