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

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

Issue 25736002: Add support to dump font cache texture for debug purposes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAtlas.h" 9 #include "GrAtlas.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 171
172 // If the above fails, then either we have no starting plot, or the current 172 // If the above fails, then either we have no starting plot, or the current
173 // plot list is full. Either way we need to allocate a new plot 173 // plot list is full. Either way we need to allocate a new plot
174 GrPlot* newPlot = this->allocPlot(); 174 GrPlot* newPlot = this->allocPlot();
175 if (NULL == newPlot) { 175 if (NULL == newPlot) {
176 return NULL; 176 return NULL;
177 } 177 }
178 178
179 if (NULL == fTexture) { 179 if (NULL == fTexture) {
180 // TODO: Update this to use the cache rather than directly creating a te xture. 180 // TODO: Update this to use the cache rather than directly creating a te xture.
181 GrTextureDesc desc; 181 GrTextureDesc desc;
robertphillips 2013/10/02 15:07:28 Do we always want this or just sometimes? Do we ne
jvanverth1 2013/10/02 15:12:09 In order for dump() to work, it has to be there. W
182 desc.fFlags = kDynamicUpdate_GrTextureFlagBit; 182 desc.fFlags = kDynamicUpdate_GrTextureFlagBit|kRenderTarget_GrTextureFla gBit;
183 desc.fWidth = GR_ATLAS_TEXTURE_WIDTH; 183 desc.fWidth = GR_ATLAS_TEXTURE_WIDTH;
184 desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT; 184 desc.fHeight = GR_ATLAS_TEXTURE_HEIGHT;
185 desc.fConfig = fPixelConfig; 185 desc.fConfig = fPixelConfig;
186 186
187 fTexture = fGpu->createTexture(desc, NULL, 0); 187 fTexture = fGpu->createTexture(desc, NULL, 0);
188 if (NULL == fTexture) { 188 if (NULL == fTexture) {
189 return NULL; 189 return NULL;
190 } 190 }
191 } 191 }
192 // be sure to set texture for fast lookup 192 // be sure to set texture for fast lookup
193 newPlot->fTexture = fTexture; 193 newPlot->fTexture = fTexture;
194 194
195 if (!newPlot->addSubImage(width, height, image, loc)) { 195 if (!newPlot->addSubImage(width, height, image, loc)) {
196 this->freePlot(newPlot); 196 this->freePlot(newPlot);
197 return NULL; 197 return NULL;
198 } 198 }
199 199
200 // new plot, put at head 200 // new plot, put at head
201 newPlot->fNext = atlas->fPlots; 201 newPlot->fNext = atlas->fPlots;
202 atlas->fPlots = newPlot; 202 atlas->fPlots = newPlot;
203 203
204 return newPlot; 204 return newPlot;
205 } 205 }
206 206
207 bool GrAtlasMgr::removeUnusedPlots(GrAtlas* atlas) { 207 bool GrAtlasMgr::removeUnusedPlots(GrAtlas* atlas) {
208
208 // GrPlot** is used so that the head element can be easily 209 // GrPlot** is used so that the head element can be easily
209 // modified when the first element is deleted 210 // modified when the first element is deleted
210 GrPlot** plotRef = &atlas->fPlots; 211 GrPlot** plotRef = &atlas->fPlots;
211 GrPlot* plot = atlas->fPlots; 212 GrPlot* plot = atlas->fPlots;
212 bool removed = false; 213 bool removed = false;
213 while (NULL != plot) { 214 while (NULL != plot) {
214 if (plot->drawToken().isIssued()) { 215 if (plot->drawToken().isIssued()) {
215 *plotRef = plot->fNext; 216 *plotRef = plot->fNext;
216 this->freePlot(plot); 217 this->freePlot(plot);
217 plot = *plotRef; 218 plot = *plotRef;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 plot->fRects->reset(); 255 plot->fRects->reset();
255 plot->fNext = fFreePlots; 256 plot->fNext = fFreePlots;
256 fFreePlots = plot; 257 fFreePlots = plot;
257 258
258 #ifdef SK_DEBUG 259 #ifdef SK_DEBUG
259 --gCounter; 260 --gCounter;
260 // GrPrintf("~GrPlot %p [%d %d] %d\n", this, plot->fOffset.fX, plot->fOffset. fY, gCounter); 261 // GrPrintf("~GrPlot %p [%d %d] %d\n", this, plot->fOffset.fX, plot->fOffset. fY, gCounter);
261 #endif 262 #endif
262 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698