Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 1107973004: Pull cache out of GrContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fixpicturerenderer.cpp Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « src/gpu/GrStencilAndCoverPathRenderer.cpp ('k') | src/gpu/GrTextureProvider.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698