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

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

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 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/GrBatchFontCache.h ('k') | src/gpu/GrBlurUtils.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 2015 Google Inc. 2 * Copyright 2015 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 "GrBatchFontCache.h" 8 #include "GrBatchFontCache.h"
9 #include "GrContext.h" 9 #include "GrContext.h"
10 #include "GrGpu.h" 10 #include "GrGpu.h"
(...skipping 22 matching lines...) Expand all
33 (void*)this); 33 (void*)this);
34 if (!fAtlases[index]) { 34 if (!fAtlases[index]) {
35 return false; 35 return false;
36 } 36 }
37 } 37 }
38 return true; 38 return true;
39 } 39 }
40 40
41 GrBatchFontCache::GrBatchFontCache(GrContext* context) 41 GrBatchFontCache::GrBatchFontCache(GrContext* context)
42 : fContext(context) 42 : fContext(context)
43 , fPreserveStrike(NULL) { 43 , fPreserveStrike(nullptr) {
44 for (int i = 0; i < kMaskFormatCount; ++i) { 44 for (int i = 0; i < kMaskFormatCount; ++i) {
45 fAtlases[i] = NULL; 45 fAtlases[i] = nullptr;
46 } 46 }
47 47
48 // setup default atlas configs 48 // setup default atlas configs
49 fAtlasConfigs[kA8_GrMaskFormat].fWidth = 2048; 49 fAtlasConfigs[kA8_GrMaskFormat].fWidth = 2048;
50 fAtlasConfigs[kA8_GrMaskFormat].fHeight = 2048; 50 fAtlasConfigs[kA8_GrMaskFormat].fHeight = 2048;
51 fAtlasConfigs[kA8_GrMaskFormat].fPlotWidth = 512; 51 fAtlasConfigs[kA8_GrMaskFormat].fPlotWidth = 512;
52 fAtlasConfigs[kA8_GrMaskFormat].fPlotHeight = 256; 52 fAtlasConfigs[kA8_GrMaskFormat].fPlotHeight = 256;
53 53
54 fAtlasConfigs[kA565_GrMaskFormat].fWidth = 1024; 54 fAtlasConfigs[kA565_GrMaskFormat].fWidth = 1024;
55 fAtlasConfigs[kA565_GrMaskFormat].fHeight = 2048; 55 fAtlasConfigs[kA565_GrMaskFormat].fHeight = 2048;
(...skipping 21 matching lines...) Expand all
77 void GrBatchFontCache::freeAll() { 77 void GrBatchFontCache::freeAll() {
78 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey>::Iter iter(&fCache); 78 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey>::Iter iter(&fCache);
79 while (!iter.done()) { 79 while (!iter.done()) {
80 (*iter).fIsAbandoned = true; 80 (*iter).fIsAbandoned = true;
81 (*iter).unref(); 81 (*iter).unref();
82 ++iter; 82 ++iter;
83 } 83 }
84 fCache.rewind(); 84 fCache.rewind();
85 for (int i = 0; i < kMaskFormatCount; ++i) { 85 for (int i = 0; i < kMaskFormatCount; ++i) {
86 delete fAtlases[i]; 86 delete fAtlases[i];
87 fAtlases[i] = NULL; 87 fAtlases[i] = nullptr;
88 } 88 }
89 } 89 }
90 90
91 void GrBatchFontCache::HandleEviction(GrBatchAtlas::AtlasID id, void* ptr) { 91 void GrBatchFontCache::HandleEviction(GrBatchAtlas::AtlasID id, void* ptr) {
92 GrBatchFontCache* fontCache = reinterpret_cast<GrBatchFontCache*>(ptr); 92 GrBatchFontCache* fontCache = reinterpret_cast<GrBatchFontCache*>(ptr);
93 93
94 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey>::Iter iter(&fontCache->fCac he); 94 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey>::Iter iter(&fontCache->fCac he);
95 for (; !iter.done(); ++iter) { 95 for (; !iter.done(); ++iter) {
96 GrBatchTextStrike* strike = &*iter; 96 GrBatchTextStrike* strike = &*iter;
97 strike->removeID(id); 97 strike->removeID(id);
(...skipping 26 matching lines...) Expand all
124 } 124 }
125 ++gDumpCount; 125 ++gDumpCount;
126 } 126 }
127 127
128 void GrBatchFontCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs [3]) { 128 void GrBatchFontCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs [3]) {
129 // delete any old atlases, this should be safe to do as long as we are not i n the middle of a 129 // delete any old atlases, this should be safe to do as long as we are not i n the middle of a
130 // flush 130 // flush
131 for (int i = 0; i < kMaskFormatCount; i++) { 131 for (int i = 0; i < kMaskFormatCount; i++) {
132 if (fAtlases[i]) { 132 if (fAtlases[i]) {
133 delete fAtlases[i]; 133 delete fAtlases[i];
134 fAtlases[i] = NULL; 134 fAtlases[i] = nullptr;
135 } 135 }
136 } 136 }
137 memcpy(fAtlasConfigs, configs, sizeof(fAtlasConfigs)); 137 memcpy(fAtlasConfigs, configs, sizeof(fAtlasConfigs));
138 } 138 }
139 139
140 /////////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////////
141 141
142 /* 142 /*
143 The text strike is specific to a given font/style/matrix setup, which is 143 The text strike is specific to a given font/style/matrix setup, which is
144 represented by the GrHostFontScaler object we are given in getGlyph(). 144 represented by the GrHostFontScaler object we are given in getGlyph().
(...skipping 17 matching lines...) Expand all
162 (*iter).free(); 162 (*iter).free();
163 ++iter; 163 ++iter;
164 } 164 }
165 } 165 }
166 166
167 GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe dID packed, 167 GrGlyph* GrBatchTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe dID packed,
168 GrFontScaler* scaler) { 168 GrFontScaler* scaler) {
169 SkIRect bounds; 169 SkIRect bounds;
170 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) { 170 if (GrGlyph::kDistance_MaskStyle == GrGlyph::UnpackMaskStyle(packed)) {
171 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) { 171 if (!scaler->getPackedGlyphDFBounds(skGlyph, &bounds)) {
172 return NULL; 172 return nullptr;
173 } 173 }
174 } else { 174 } else {
175 if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) { 175 if (!scaler->getPackedGlyphBounds(skGlyph, &bounds)) {
176 return NULL; 176 return nullptr;
177 } 177 }
178 } 178 }
179 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph); 179 GrMaskFormat format = scaler->getPackedGlyphMaskFormat(skGlyph);
180 180
181 GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW); 181 GrGlyph* glyph = (GrGlyph*)fPool.alloc(sizeof(GrGlyph), SK_MALLOC_THROW);
182 glyph->init(packed, bounds, format); 182 glyph->init(packed, bounds, format);
183 fCache.add(glyph); 183 fCache.add(glyph);
184 return glyph; 184 return glyph;
185 } 185 }
186 186
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 225
226 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect edMaskFormat, 226 bool success = fBatchFontCache->addToAtlas(this, &glyph->fID, target, expect edMaskFormat,
227 glyph->width(), glyph->height(), 227 glyph->width(), glyph->height(),
228 storage.get(), &glyph->fAtlasLoca tion); 228 storage.get(), &glyph->fAtlasLoca tion);
229 if (success) { 229 if (success) {
230 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); 230 SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID);
231 fAtlasedGlyphs++; 231 fAtlasedGlyphs++;
232 } 232 }
233 return success; 233 return success;
234 } 234 }
OLDNEW
« no previous file with comments | « src/gpu/GrBatchFontCache.h ('k') | src/gpu/GrBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698