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 "GrDrawTarget.h" | 9 #include "GrDrawTarget.h" |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // fallback, which we don't want to do at this point. | 87 // fallback, which we don't want to do at this point. |
88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke))
{ | 88 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke))
{ |
89 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs)); | 89 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs)); |
90 } | 90 } |
91 | 91 |
92 ~GlyphPathRange() { | 92 ~GlyphPathRange() { |
93 this->release(); | 93 this->release(); |
94 SkDescriptor::Free(fDesc); | 94 SkDescriptor::Free(fDesc); |
95 } | 95 } |
96 | 96 |
97 virtual void onRelease() SK_OVERRIDE { | |
98 INHERITED::onRelease(); | |
99 fPathRange.reset(NULL); | |
100 } | |
101 | |
102 virtual void onAbandon() SK_OVERRIDE { | |
103 INHERITED::onAbandon(); | |
104 fPathRange->abandon(); | |
105 fPathRange.reset(NULL); | |
106 } | |
107 | |
108 | |
109 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) /
kGlyphGroupSize; | 97 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) /
kGlyphGroupSize; |
110 SkDescriptor* const fDesc; | 98 SkDescriptor* const fDesc; |
111 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group | 99 uint8_t fLoadedGlyphs[(kMaxGroupCount + 7) >> 3]; // One bit per glyph group |
112 SkAutoTUnref<GrPathRange> fPathRange; | 100 SkAutoTUnref<GrPathRange> fPathRange; |
113 | 101 |
114 typedef GrGpuResource INHERITED; | 102 typedef GrGpuResource INHERITED; |
115 }; | 103 }; |
116 | 104 |
117 | 105 |
118 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext( | 106 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext( |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 SkSafeUnref(fGlyphs); | 443 SkSafeUnref(fGlyphs); |
456 fGlyphs = NULL; | 444 fGlyphs = NULL; |
457 fGlyphCache = NULL; | 445 fGlyphCache = NULL; |
458 | 446 |
459 fDrawTarget->drawState()->stencil()->setDisabled(); | 447 fDrawTarget->drawState()->stencil()->setDisabled(); |
460 fStateRestore.set(NULL); | 448 fStateRestore.set(NULL); |
461 fContext->setMatrix(fContextInitialMatrix); | 449 fContext->setMatrix(fContextInitialMatrix); |
462 GrTextContext::finish(); | 450 GrTextContext::finish(); |
463 } | 451 } |
464 | 452 |
OLD | NEW |