diff options
author | kkinnunen <kkinnunen@nvidia.com> | 2014-06-24 00:12:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-06-24 00:12:27 -0700 |
commit | c6cb56f36c4aad8ed45486a3bb4de614bb822f1b (patch) | |
tree | d231e40d459dfd1f5545e489fcf004318e82c2e4 /src/gpu/GrContext.cpp | |
parent | 6fc763e3c2b1e539510cb18ece8b97e183099ab1 (diff) |
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
Diffstat (limited to 'src/gpu/GrContext.cpp')
-rwxr-xr-x[-rw-r--r--] | src/gpu/GrContext.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index 6c90c178d3..d59d2e8d40 100644..100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -16,6 +16,7 @@ #include "GrAARectRenderer.h" #include "GrBufferAllocPool.h" #include "GrGpu.h" +#include "GrDistanceFieldTextContext.h" #include "GrDrawTargetCaps.h" #include "GrIndexBuffer.h" #include "GrInOrderDrawBuffer.h" @@ -26,6 +27,7 @@ #include "GrResourceCache.h" #include "GrSoftwarePathRenderer.h" #include "GrStencilBuffer.h" +#include "GrStencilAndCoverTextContext.h" #include "GrStrokeInfo.h" #include "GrTextStrike.h" #include "GrTraceMarker.h" @@ -236,6 +238,19 @@ void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) } } +GrTextContext* GrContext::createTextContext(GrRenderTarget* renderTarget, + const SkDeviceProperties& + leakyProperties, + bool enableDistanceFieldFonts) { + if (fGpu->caps()->pathRenderingSupport()) { + if (renderTarget->getStencilBuffer() && renderTarget->isMultisampled()) { + return SkNEW_ARGS(GrStencilAndCoverTextContext, (this, leakyProperties)); + } + } + return SkNEW_ARGS(GrDistanceFieldTextContext, (this, leakyProperties, + enableDistanceFieldFonts)); +} + //////////////////////////////////////////////////////////////////////////////// GrTexture* GrContext::findAndRefTexture(const GrTextureDesc& desc, |