| 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 "GrBitmapTextContext.h" | 9 #include "GrBitmapTextContext.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 const SkTypeface* typeface, | 205 const SkTypeface* typeface, |
| 206 const SkDescriptor* desc, | 206 const SkDescriptor* desc, |
| 207 const SkStrokeRec& stroke) { | 207 const SkStrokeRec& stroke) { |
| 208 static const GrCacheID::Domain gGlyphsDomain = GrCacheID::GenerateDomain(); | 208 static const GrCacheID::Domain gGlyphsDomain = GrCacheID::GenerateDomain(); |
| 209 | 209 |
| 210 GrCacheID::Key key; | 210 GrCacheID::Key key; |
| 211 uint64_t* keyData = key.fData64; | 211 uint64_t* keyData = key.fData64; |
| 212 keyData[0] = desc ? desc->getChecksum() : 0; | 212 keyData[0] = desc ? desc->getChecksum() : 0; |
| 213 keyData[0] = (keyData[0] << 32) | (typeface ? typeface->uniqueID() : 0); | 213 keyData[0] = (keyData[0] << 32) | (typeface ? typeface->uniqueID() : 0); |
| 214 keyData[1] = GrPath::ComputeStrokeKey(stroke); | 214 keyData[1] = GrPath::ComputeStrokeKey(stroke); |
| 215 GrResourceKey resourceKey = GrResourceKey(GrCacheID(gGlyphsDomain, key), | 215 GrResourceKey resourceKey = GrResourceKey(GrCacheID(gGlyphsDomain, key), 0); |
| 216 GrPathRange::resourceType(), 0); | |
| 217 | 216 |
| 218 SkAutoTUnref<GrPathRange> glyphs( | 217 SkAutoTUnref<GrPathRange> glyphs( |
| 219 static_cast<GrPathRange*>(ctx->findAndRefCachedResource(resourceKey))); | 218 static_cast<GrPathRange*>(ctx->findAndRefCachedResource(resourceKey))); |
| 220 if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) { | 219 if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) { |
| 221 glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc
, stroke)); | 220 glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc
, stroke)); |
| 222 ctx->addResourceToCache(resourceKey, glyphs); | 221 ctx->addResourceToCache(resourceKey, glyphs); |
| 223 } | 222 } |
| 224 | 223 |
| 225 return glyphs.detach(); | 224 return glyphs.detach(); |
| 226 } | 225 } |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 | 450 |
| 452 SkGlyphCache::AttachCache(fGlyphCache); | 451 SkGlyphCache::AttachCache(fGlyphCache); |
| 453 fGlyphCache = NULL; | 452 fGlyphCache = NULL; |
| 454 | 453 |
| 455 fDrawState.stencil()->setDisabled(); | 454 fDrawState.stencil()->setDisabled(); |
| 456 fStateRestore.set(NULL); | 455 fStateRestore.set(NULL); |
| 457 fViewMatrix = fContextInitialMatrix; | 456 fViewMatrix = fContextInitialMatrix; |
| 458 GrTextContext::finish(); | 457 GrTextContext::finish(); |
| 459 } | 458 } |
| 460 | 459 |
| OLD | NEW |