OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrStencilAndCoverTextContext.h" | 8 #include "GrStencilAndCoverTextContext.h" |
9 #include "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
10 #include "GrBitmapTextContext.h" | |
11 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
12 #include "GrGpu.h" | 11 #include "GrGpu.h" |
13 #include "GrPath.h" | 12 #include "GrPath.h" |
14 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
15 #include "SkAutoKern.h" | 14 #include "SkAutoKern.h" |
16 #include "SkDraw.h" | 15 #include "SkDraw.h" |
17 #include "SkDrawProcs.h" | 16 #include "SkDrawProcs.h" |
18 #include "SkGlyphCache.h" | 17 #include "SkGlyphCache.h" |
19 #include "SkGpuDevice.h" | 18 #include "SkGpuDevice.h" |
20 #include "SkPath.h" | 19 #include "SkPath.h" |
21 #include "SkTextMapStateProc.h" | 20 #include "SkTextMapStateProc.h" |
22 #include "SkTextFormatParams.h" | 21 #include "SkTextFormatParams.h" |
23 | 22 |
24 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context, | 23 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context, |
25 SkGpuDevice* gpuDevic
e, | 24 SkGpuDevice* gpuDevic
e, |
26 const SkDevicePropert
ies& properties) | 25 const SkDevicePropert
ies& properties) |
27 : GrTextContext(context, gpuDevice, properties) | 26 : GrTextContext(context, gpuDevice, properties) |
28 , fStroke(SkStrokeRec::kFill_InitStyle) | 27 , fStroke(SkStrokeRec::kFill_InitStyle) |
29 , fQueuedGlyphCount(0) | 28 , fQueuedGlyphCount(0) |
30 , fFallbackGlyphsIdx(kGlyphBufferSize) { | 29 , fFallbackGlyphsIdx(kGlyphBufferSize) { |
31 } | 30 } |
32 | 31 |
33 GrStencilAndCoverTextContext* | 32 GrStencilAndCoverTextContext* |
34 GrStencilAndCoverTextContext::Create(GrContext* context, SkGpuDevice* gpuDevice, | 33 GrStencilAndCoverTextContext::Create(GrContext* context, SkGpuDevice* gpuDevice, |
35 const SkDeviceProperties& props) { | 34 const SkDeviceProperties& props) { |
36 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText
Context, | 35 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText
Context, |
37 (context, gpuDevice,
props)); | 36 (context, gpuDevice,
props)); |
38 #ifdef USE_BITMAP_TEXTBLOBS | |
39 textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, gpuD
evice, props, | 37 textContext->fFallbackTextContext = GrAtlasTextContext::Create(context, gpuD
evice, props, |
40 false); | 38 false); |
41 #else | |
42 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu
Device, props); | |
43 #endif | |
44 | 39 |
45 return textContext; | 40 return textContext; |
46 } | 41 } |
47 | 42 |
48 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { | 43 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { |
49 } | 44 } |
50 | 45 |
51 bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt, | 46 bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt, |
52 const GrClip& clip, | 47 const GrClip& clip, |
53 const GrPaint& paint, | 48 const GrPaint& paint, |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 | 475 |
481 SkGlyphCache::AttachCache(fGlyphCache); | 476 SkGlyphCache::AttachCache(fGlyphCache); |
482 fGlyphCache = NULL; | 477 fGlyphCache = NULL; |
483 | 478 |
484 fPipelineBuilder.stencil()->setDisabled(); | 479 fPipelineBuilder.stencil()->setDisabled(); |
485 fStateRestore.set(NULL); | 480 fStateRestore.set(NULL); |
486 fViewMatrix = fContextInitialMatrix; | 481 fViewMatrix = fContextInitialMatrix; |
487 GrTextContext::finish(); | 482 GrTextContext::finish(); |
488 } | 483 } |
489 | 484 |
OLD | NEW |