OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrBitmapTextContext.h" | 8 #include "GrBitmapTextContext.h" |
9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
10 #include "GrDefaultGeoProcFactory.h" | 10 #include "GrDefaultGeoProcFactory.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // position + local coord | 39 // position + local coord |
40 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | 40 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
41 | 41 |
42 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof
(SkIPoint16); | 42 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof
(SkIPoint16); |
43 | 43 |
44 static const int kVerticesPerGlyph = 4; | 44 static const int kVerticesPerGlyph = 4; |
45 static const int kIndicesPerGlyph = 6; | 45 static const int kIndicesPerGlyph = 6; |
46 }; | 46 }; |
47 | 47 |
48 GrBitmapTextContext::GrBitmapTextContext(GrContext* context, | 48 GrBitmapTextContext::GrBitmapTextContext(GrContext* context, |
| 49 SkGpuDevice* gpuDevice, |
49 const SkDeviceProperties& properties) | 50 const SkDeviceProperties& properties) |
50 : GrTextContext(context, properties) { | 51 : GrTextContext(context, gpuDevice, properties) { |
51 fStrike = NULL; | 52 fStrike = NULL; |
52 | 53 |
53 fCurrTexture = NULL; | 54 fCurrTexture = NULL; |
54 fEffectTextureUniqueID = SK_InvalidUniqueID; | 55 fEffectTextureUniqueID = SK_InvalidUniqueID; |
55 | 56 |
56 fVertices = NULL; | 57 fVertices = NULL; |
57 fCurrVertex = 0; | 58 fCurrVertex = 0; |
58 fAllocVertexCount = 0; | 59 fAllocVertexCount = 0; |
59 fTotalVertexCount = 0; | 60 fTotalVertexCount = 0; |
60 | 61 |
61 fVertexBounds.setLargestInverted(); | 62 fVertexBounds.setLargestInverted(); |
62 } | 63 } |
63 | 64 |
64 GrBitmapTextContext* GrBitmapTextContext::Create(GrContext* context, | 65 GrBitmapTextContext* GrBitmapTextContext::Create(GrContext* context, |
| 66 SkGpuDevice* gpuDevice, |
65 const SkDeviceProperties& props
) { | 67 const SkDeviceProperties& props
) { |
66 return SkNEW_ARGS(GrBitmapTextContext, (context, props)); | 68 return SkNEW_ARGS(GrBitmapTextContext, (context, gpuDevice, props)); |
67 } | 69 } |
68 | 70 |
69 bool GrBitmapTextContext::canDraw(const SkPaint& paint, const SkMatrix& viewMatr
ix) { | 71 bool GrBitmapTextContext::canDraw(const SkPaint& paint, const SkMatrix& viewMatr
ix) { |
70 return !SkDraw::ShouldDrawTextAsPaths(paint, viewMatrix); | 72 return !SkDraw::ShouldDrawTextAsPaths(paint, viewMatrix); |
71 } | 73 } |
72 | 74 |
73 inline void GrBitmapTextContext::init(GrRenderTarget* rt, const GrClip& clip, | 75 inline void GrBitmapTextContext::init(GrRenderTarget* rt, const GrClip& clip, |
74 const GrPaint& paint, const SkPaint& skPai
nt) { | 76 const GrPaint& paint, const SkPaint& skPai
nt) { |
75 GrTextContext::init(rt, clip, paint, skPaint); | 77 GrTextContext::init(rt, clip, paint, skPaint); |
76 | 78 |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 622 } |
621 } | 623 } |
622 | 624 |
623 inline void GrBitmapTextContext::finish() { | 625 inline void GrBitmapTextContext::finish() { |
624 this->flush(); | 626 this->flush(); |
625 fTotalVertexCount = 0; | 627 fTotalVertexCount = 0; |
626 | 628 |
627 GrTextContext::finish(); | 629 GrTextContext::finish(); |
628 } | 630 } |
629 | 631 |
OLD | NEW |