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

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

Issue 504313002: Make GrGpuResources register with GrResourceCache2 after fully constructed. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix insertion for GlyphPathRange. Created 6 years, 3 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/GrResourceCache2.cpp ('k') | src/gpu/gl/GrGLIndexBuffer.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 "GrDrawTarget.h" 9 #include "GrDrawTarget.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 23 matching lines...) Expand all
34 key.fData64[1] = GrPath::ComputeStrokeKey(stroke); 34 key.fData64[1] = GrPath::ComputeStrokeKey(stroke);
35 35
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 glyphs->registerWithCache();
44 context->addResourceToCache(resourceKey, glyphs); 45 context->addResourceToCache(resourceKey, glyphs);
45 } 46 }
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;
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/gpu/GrResourceCache2.cpp ('k') | src/gpu/gl/GrGLIndexBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698