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 "GrBitmapTextContext.h" | 9 #include "GrBitmapTextContext.h" |
10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText
Context, | 35 GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverText
Context, |
36 (context, gpuDevice,
props)); | 36 (context, gpuDevice,
props)); |
37 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu
Device, props); | 37 textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpu
Device, props); |
38 | 38 |
39 return textContext; | 39 return textContext; |
40 } | 40 } |
41 | 41 |
42 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { | 42 GrStencilAndCoverTextContext::~GrStencilAndCoverTextContext() { |
43 } | 43 } |
44 | 44 |
45 bool GrStencilAndCoverTextContext::canDraw(const SkPaint& paint, const SkMatrix&
viewMatrix) { | 45 bool GrStencilAndCoverTextContext::canDraw(const GrRenderTarget* rt, |
46 if (paint.getRasterizer()) { | 46 const GrClip& clip, |
| 47 const GrPaint& paint, |
| 48 const SkPaint& skPaint, |
| 49 const SkMatrix& viewMatrix) { |
| 50 if (skPaint.getRasterizer()) { |
47 return false; | 51 return false; |
48 } | 52 } |
49 if (paint.getMaskFilter()) { | 53 if (skPaint.getMaskFilter()) { |
50 return false; | 54 return false; |
51 } | 55 } |
52 if (paint.getPathEffect()) { | 56 if (skPaint.getPathEffect()) { |
53 return false; | 57 return false; |
54 } | 58 } |
55 | 59 |
56 // No hairlines unless we can map the 1 px width to the object space. | 60 // No hairlines unless we can map the 1 px width to the object space. |
57 if (paint.getStyle() == SkPaint::kStroke_Style | 61 if (skPaint.getStyle() == SkPaint::kStroke_Style |
58 && paint.getStrokeWidth() == 0 | 62 && skPaint.getStrokeWidth() == 0 |
59 && viewMatrix.hasPerspective()) { | 63 && viewMatrix.hasPerspective()) { |
60 return false; | 64 return false; |
61 } | 65 } |
62 | 66 |
63 // No color bitmap fonts. | 67 // No color bitmap fonts. |
64 SkScalerContext::Rec rec; | 68 SkScalerContext::Rec rec; |
65 SkScalerContext::MakeRec(paint, &fDeviceProperties, NULL, &rec); | 69 SkScalerContext::MakeRec(skPaint, &fDeviceProperties, NULL, &rec); |
66 return rec.getFormat() != SkMask::kARGB32_Format; | 70 return rec.getFormat() != SkMask::kARGB32_Format; |
67 } | 71 } |
68 | 72 |
69 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, | 73 void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt, |
70 const GrClip& clip, | 74 const GrClip& clip, |
71 const GrPaint& paint, | 75 const GrPaint& paint, |
72 const SkPaint& skPaint, | 76 const SkPaint& skPaint, |
73 const SkMatrix& viewMatrix, | 77 const SkMatrix& viewMatrix, |
74 const char text[], | 78 const char text[], |
75 size_t byteLength, | 79 size_t byteLength, |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 474 |
471 SkGlyphCache::AttachCache(fGlyphCache); | 475 SkGlyphCache::AttachCache(fGlyphCache); |
472 fGlyphCache = NULL; | 476 fGlyphCache = NULL; |
473 | 477 |
474 fPipelineBuilder.stencil()->setDisabled(); | 478 fPipelineBuilder.stencil()->setDisabled(); |
475 fStateRestore.set(NULL); | 479 fStateRestore.set(NULL); |
476 fViewMatrix = fContextInitialMatrix; | 480 fViewMatrix = fContextInitialMatrix; |
477 GrTextContext::finish(); | 481 GrTextContext::finish(); |
478 } | 482 } |
479 | 483 |
OLD | NEW |