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

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: Add newline back 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
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 25 matching lines...) Expand all
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();
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;
54 const uint16_t groupByte = groupIndex >> 3; 55 const uint16_t groupByte = groupIndex >> 3;
55 const uint8_t groupBit = 1 << (groupIndex & 7); 56 const uint8_t groupBit = 1 << (groupIndex & 7);
(...skipping 387 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

Powered by Google App Engine
This is Rietveld 408576698