| 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 25 matching lines...) Expand all Loading... |
| 36 GrResourceKey resourceKey(GrCacheID(gGlyphPathRangeDomain, key), | 36 GrResourceKey resourceKey(GrCacheID(gGlyphPathRangeDomain, key), |
| 37 GrPathRange::resourceType(), 0); | 37 GrPathRange::resourceType(), 0); |
| 38 SkAutoTUnref<GlyphPathRange> glyphs( | 38 SkAutoTUnref<GlyphPathRange> glyphs( |
| 39 static_cast<GlyphPathRange*>(context->findAndRefCachedResource(resou
rceKey))); | 39 static_cast<GlyphPathRange*>(context->findAndRefCachedResource(resou
rceKey))); |
| 40 | 40 |
| 41 if (NULL == glyphs || | 41 if (NULL == glyphs || |
| 42 !glyphs->fDesc->equals(cache->getDescriptor() /*checksum collision*/
)) { | 42 !glyphs->fDesc->equals(cache->getDescriptor() /*checksum collision*/
)) { |
| 43 glyphs.reset(SkNEW_ARGS(GlyphPathRange, (context, cache->getDescript
or(), stroke))); | 43 glyphs.reset(SkNEW_ARGS(GlyphPathRange, (context, cache->getDescript
or(), stroke))); |
| 44 context->addResourceToCache(resourceKey, glyphs); | 44 context->addResourceToCache(resourceKey, glyphs); |
| 45 } | 45 } |
| 46 glyphs->registerWithCache(); |
| 46 | 47 |
| 47 return glyphs.detach(); | 48 return glyphs.detach(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 const GrPathRange* pathRange() const { return fPathRange.get(); } | 51 const GrPathRange* pathRange() const { return fPathRange.get(); } |
| 51 | 52 |
| 52 void preloadGlyph(uint16_t glyphID, SkGlyphCache* cache) { | 53 void preloadGlyph(uint16_t glyphID, SkGlyphCache* cache) { |
| 53 const uint16_t groupIndex = glyphID / kGlyphGroupSize; | 54 const uint16_t groupIndex = glyphID / kGlyphGroupSize; |
| 54 const uint16_t groupByte = groupIndex >> 3; | 55 const uint16_t groupByte = groupIndex >> 3; |
| 55 const uint8_t groupBit = 1 << (groupIndex & 7); | 56 const uint8_t groupBit = 1 << (groupIndex & 7); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 SkSafeUnref(fGlyphs); | 444 SkSafeUnref(fGlyphs); |
| 444 fGlyphs = NULL; | 445 fGlyphs = NULL; |
| 445 fGlyphCache = NULL; | 446 fGlyphCache = NULL; |
| 446 | 447 |
| 447 fDrawTarget->drawState()->stencil()->setDisabled(); | 448 fDrawTarget->drawState()->stencil()->setDisabled(); |
| 448 fStateRestore.set(NULL); | 449 fStateRestore.set(NULL); |
| 449 fContext->setMatrix(fContextInitialMatrix); | 450 fContext->setMatrix(fContextInitialMatrix); |
| 450 GrTextContext::finish(); | 451 GrTextContext::finish(); |
| 451 } | 452 } |
| 452 | 453 |
| OLD | NEW |