| 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 "GrAtlasTextContext.h" | 9 #include "GrAtlasTextContext.h" |
| 10 #include "GrDrawTarget.h" | 10 #include "GrDrawTarget.h" |
| 11 #include "GrGpu.h" | 11 #include "GrGpu.h" |
| 12 #include "GrPath.h" | 12 #include "GrPath.h" |
| 13 #include "GrPathRange.h" | 13 #include "GrPathRange.h" |
| 14 #include "GrResourceProvider.h" |
| 14 #include "SkAutoKern.h" | 15 #include "SkAutoKern.h" |
| 15 #include "SkDraw.h" | 16 #include "SkDraw.h" |
| 16 #include "SkDrawProcs.h" | 17 #include "SkDrawProcs.h" |
| 17 #include "SkGlyphCache.h" | 18 #include "SkGlyphCache.h" |
| 18 #include "SkGpuDevice.h" | 19 #include "SkGpuDevice.h" |
| 19 #include "SkPath.h" | 20 #include "SkPath.h" |
| 20 #include "SkTextMapStateProc.h" | 21 #include "SkTextMapStateProc.h" |
| 21 #include "SkTextFormatParams.h" | 22 #include "SkTextFormatParams.h" |
| 22 | 23 |
| 23 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context, | 24 GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context, |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 uint32_t fTypeface; | 229 uint32_t fTypeface; |
| 229 uint64_t fStroke; | 230 uint64_t fStroke; |
| 230 }; | 231 }; |
| 231 GlyphKey* glyphKey = reinterpret_cast<GlyphKey*>(&builder[0]); | 232 GlyphKey* glyphKey = reinterpret_cast<GlyphKey*>(&builder[0]); |
| 232 glyphKey->fChecksum = desc ? desc->getChecksum() : 0; | 233 glyphKey->fChecksum = desc ? desc->getChecksum() : 0; |
| 233 glyphKey->fTypeface = typeface ? typeface->uniqueID() : 0; | 234 glyphKey->fTypeface = typeface ? typeface->uniqueID() : 0; |
| 234 glyphKey->fStroke = GrPath::ComputeStrokeKey(stroke); | 235 glyphKey->fStroke = GrPath::ComputeStrokeKey(stroke); |
| 235 builder.finish(); | 236 builder.finish(); |
| 236 | 237 |
| 237 SkAutoTUnref<GrPathRange> glyphs( | 238 SkAutoTUnref<GrPathRange> glyphs( |
| 238 static_cast<GrPathRange*>(ctx->findAndRefCachedResource(key))); | 239 static_cast<GrPathRange*>(ctx->resourceProvider()->findAndRefResourceByU
niqueKey(key))); |
| 239 if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) { | 240 if (NULL == glyphs || (NULL != desc && !glyphs->isEqualTo(*desc))) { |
| 240 glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc
, stroke)); | 241 glyphs.reset(ctx->getGpu()->pathRendering()->createGlyphs(typeface, desc
, stroke)); |
| 241 ctx->addResourceToCache(key, glyphs); | 242 ctx->resourceProvider()->assignUniqueKeyToResource(key, glyphs); |
| 242 } | 243 } |
| 243 | 244 |
| 244 return glyphs.detach(); | 245 return glyphs.detach(); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void GrStencilAndCoverTextContext::init(GrRenderTarget* rt, | 248 void GrStencilAndCoverTextContext::init(GrRenderTarget* rt, |
| 248 const GrClip& clip, | 249 const GrClip& clip, |
| 249 const GrPaint& paint, | 250 const GrPaint& paint, |
| 250 const SkPaint& skPaint, | 251 const SkPaint& skPaint, |
| 251 size_t textByteLength, | 252 size_t textByteLength, |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 476 |
| 476 SkGlyphCache::AttachCache(fGlyphCache); | 477 SkGlyphCache::AttachCache(fGlyphCache); |
| 477 fGlyphCache = NULL; | 478 fGlyphCache = NULL; |
| 478 | 479 |
| 479 fPipelineBuilder.stencil()->setDisabled(); | 480 fPipelineBuilder.stencil()->setDisabled(); |
| 480 fStateRestore.set(NULL); | 481 fStateRestore.set(NULL); |
| 481 fViewMatrix = fContextInitialMatrix; | 482 fViewMatrix = fContextInitialMatrix; |
| 482 GrTextContext::finish(); | 483 GrTextContext::finish(); |
| 483 } | 484 } |
| 484 | 485 |
| OLD | NEW |