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(); | |
47 | 46 |
48 return glyphs.detach(); | 47 return glyphs.detach(); |
49 } | 48 } |
50 | 49 |
51 const GrPathRange* pathRange() const { return fPathRange.get(); } | 50 const GrPathRange* pathRange() const { return fPathRange.get(); } |
52 | 51 |
53 void preloadGlyph(uint16_t glyphID, SkGlyphCache* cache) { | 52 void preloadGlyph(uint16_t glyphID, SkGlyphCache* cache) { |
54 const uint16_t groupIndex = glyphID / kGlyphGroupSize; | 53 const uint16_t groupIndex = glyphID / kGlyphGroupSize; |
55 const uint16_t groupByte = groupIndex >> 3; | 54 const uint16_t groupByte = groupIndex >> 3; |
56 const uint8_t groupBit = 1 << (groupIndex & 7); | 55 const uint8_t groupBit = 1 << (groupIndex & 7); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 SkSafeUnref(fGlyphs); | 443 SkSafeUnref(fGlyphs); |
445 fGlyphs = NULL; | 444 fGlyphs = NULL; |
446 fGlyphCache = NULL; | 445 fGlyphCache = NULL; |
447 | 446 |
448 fDrawTarget->drawState()->stencil()->setDisabled(); | 447 fDrawTarget->drawState()->stencil()->setDisabled(); |
449 fStateRestore.set(NULL); | 448 fStateRestore.set(NULL); |
450 fContext->setMatrix(fContextInitialMatrix); | 449 fContext->setMatrix(fContextInitialMatrix); |
451 GrTextContext::finish(); | 450 GrTextContext::finish(); |
452 } | 451 } |
453 | 452 |
OLD | NEW |