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

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

Issue 665913002: Move code to dump GrSurface as a png to helper files (Closed) Base URL: https://skia.googlesource.com/skia.git@separate-image-encoder-01-skimage
Patch Set: Created 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
(...skipping 10 matching lines...) Expand all
21 21
22 #define ATLAS_TEXTURE_WIDTH 1024 22 #define ATLAS_TEXTURE_WIDTH 1024
23 #define ATLAS_TEXTURE_HEIGHT 1024 23 #define ATLAS_TEXTURE_HEIGHT 1024
24 24
25 #define PLOT_WIDTH 256 25 #define PLOT_WIDTH 256
26 #define PLOT_HEIGHT 256 26 #define PLOT_HEIGHT 256
27 27
28 #define NUM_PLOTS_X (ATLAS_TEXTURE_WIDTH / PLOT_WIDTH) 28 #define NUM_PLOTS_X (ATLAS_TEXTURE_WIDTH / PLOT_WIDTH)
29 #define NUM_PLOTS_Y (ATLAS_TEXTURE_HEIGHT / PLOT_HEIGHT) 29 #define NUM_PLOTS_Y (ATLAS_TEXTURE_HEIGHT / PLOT_HEIGHT)
30 30
31 #ifdef SK_DEVELOPER
scroggo 2014/10/20 15:27:38 This is a good change that can go in separately.
31 SK_CONF_DECLARE(bool, c_DumpPathCache, "gpu.dumpPathCache", false, 32 SK_CONF_DECLARE(bool, c_DumpPathCache, "gpu.dumpPathCache", false,
32 "Dump the contents of the path cache before every purge."); 33 "Dump the contents of the path cache before every purge.");
34 #endif
33 35
34 //////////////////////////////////////////////////////////////////////////////// 36 ////////////////////////////////////////////////////////////////////////////////
35 GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() { 37 GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
36 PathDataList::Iter iter; 38 PathDataList::Iter iter;
37 iter.init(fPathList, PathDataList::Iter::kHead_IterStart); 39 iter.init(fPathList, PathDataList::Iter::kHead_IterStart);
38 PathData* pathData; 40 PathData* pathData;
39 while ((pathData = iter.get())) { 41 while ((pathData = iter.get())) {
40 iter.next(); 42 iter.next();
41 fPathList.remove(pathData); 43 fPathList.remove(pathData);
42 SkDELETE(pathData); 44 SkDELETE(pathData);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 181
180 // if atlas full 182 // if atlas full
181 if (NULL == plot) { 183 if (NULL == plot) {
182 if (this->freeUnusedPlot()) { 184 if (this->freeUnusedPlot()) {
183 plot = fAtlas->addToAtlas(&fPlotUsage, width, height, dfStorage.get( ), 185 plot = fAtlas->addToAtlas(&fPlotUsage, width, height, dfStorage.get( ),
184 &atlasLocation); 186 &atlasLocation);
185 if (plot) { 187 if (plot) {
186 goto HAS_ATLAS; 188 goto HAS_ATLAS;
187 } 189 }
188 } 190 }
189 191
192 #ifdef SK_DEVELOPER
190 if (c_DumpPathCache) { 193 if (c_DumpPathCache) {
191 #ifdef SK_DEVELOPER
192 GrTexture* texture = fAtlas->getTexture(); 194 GrTexture* texture = fAtlas->getTexture();
193 texture->surfacePriv().savePixels("pathcache.png"); 195 SkSaveGrSurfacePixelsAsPNG(texture, "pathcache.png");
196 }
194 #endif 197 #endif
195 }
196 198
197 // before we purge the cache, we must flush any accumulated draws 199 // before we purge the cache, we must flush any accumulated draws
198 fContext->flush(); 200 fContext->flush();
199 201
200 if (this->freeUnusedPlot()) { 202 if (this->freeUnusedPlot()) {
201 plot = fAtlas->addToAtlas(&fPlotUsage, width, height, dfStorage.get( ), 203 plot = fAtlas->addToAtlas(&fPlotUsage, width, height, dfStorage.get( ),
202 &atlasLocation); 204 &atlasLocation);
203 if (plot) { 205 if (plot) {
204 goto HAS_ATLAS; 206 goto HAS_ATLAS;
205 } 207 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 334
333 335
334 vm.mapRect(&r); 336 vm.mapRect(&r);
335 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 4, 6, &r); 337 target->drawIndexedInstances(kTriangles_GrPrimitiveType, 1, 4, 6, &r);
336 target->resetVertexSource(); 338 target->resetVertexSource();
337 target->resetIndexSource(); 339 target->resetIndexSource();
338 340
339 return true; 341 return true;
340 } 342 }
341 343
OLDNEW
« no previous file with comments | « include/gpu/GrSurface.h ('k') | src/gpu/GrLayerCache.cpp » ('j') | src/gpu/GrSurfacePriv.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698