| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // GrGpuResource overrides | 79 // GrGpuResource overrides |
| 80 virtual size_t gpuMemorySize() const SK_OVERRIDE { return fPathRange->gpuMem
orySize(); } | 80 virtual size_t gpuMemorySize() const SK_OVERRIDE { return fPathRange->gpuMem
orySize(); } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 GlyphPathRange(GrContext* context, const SkDescriptor& desc, const SkStrokeR
ec& stroke) | 83 GlyphPathRange(GrContext* context, const SkDescriptor& desc, const SkStrokeR
ec& stroke) |
| 84 : INHERITED(context->getGpu(), false) | 84 : INHERITED(context->getGpu(), false) |
| 85 , fDesc(desc.copy()) | 85 , fDesc(desc.copy()) |
| 86 // We reserve a range of kMaxGlyphCount paths because of fallbacks fonts
. We | 86 // We reserve a range of kMaxGlyphCount paths because of fallbacks fonts
. We |
| 87 // can't know exactly how many glyphs we might need without preloading e
very | 87 // can't know exactly how many glyphs we might need without preloading e
very |
| 88 // fallback, which we don't want to do at this point. | 88 // fallback, which we don't want to do at this point. |
| 89 , fPathRange(context->getGpu()->createPathRange(kMaxGlyphCount, stroke))
{ | 89 , fPathRange(context->getGpu()->pathRendering()->createPathRange(kMaxGly
phCount, stroke)) { |
| 90 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs)); | 90 memset(fLoadedGlyphs, 0, sizeof(fLoadedGlyphs)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 ~GlyphPathRange() { | 93 ~GlyphPathRange() { |
| 94 this->release(); | 94 this->release(); |
| 95 SkDescriptor::Free(fDesc); | 95 SkDescriptor::Free(fDesc); |
| 96 } | 96 } |
| 97 | 97 |
| 98 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) /
kGlyphGroupSize; | 98 static const int kMaxGroupCount = (kMaxGlyphCount + (kGlyphGroupSize - 1)) /
kGlyphGroupSize; |
| 99 SkDescriptor* const fDesc; | 99 SkDescriptor* const fDesc; |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 SkSafeUnref(fGlyphs); | 444 SkSafeUnref(fGlyphs); |
| 445 fGlyphs = NULL; | 445 fGlyphs = NULL; |
| 446 fGlyphCache = NULL; | 446 fGlyphCache = NULL; |
| 447 | 447 |
| 448 fDrawTarget->drawState()->stencil()->setDisabled(); | 448 fDrawTarget->drawState()->stencil()->setDisabled(); |
| 449 fStateRestore.set(NULL); | 449 fStateRestore.set(NULL); |
| 450 fContext->setMatrix(fContextInitialMatrix); | 450 fContext->setMatrix(fContextInitialMatrix); |
| 451 GrTextContext::finish(); | 451 GrTextContext::finish(); |
| 452 } | 452 } |
| 453 | 453 |
| OLD | NEW |