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

Side by Side Diff: tools/PictureRenderingFlags.cpp

Issue 845623002: Remove SkTileGrid (except for TileGridInfo). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: kill gridSupported Created 5 years, 11 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 | « tools/PictureRenderer.cpp ('k') | tools/bbh_shootout.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 2013 Google Inc. 2 * Copyright 2013 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 "PictureRenderingFlags.h" 8 #include "PictureRenderingFlags.h"
9 9
10 #include "CopyTilesRenderer.h" 10 #include "CopyTilesRenderer.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) { 86 sk_tools::PictureRenderer* parseRenderer(SkString& error, PictureTool tool) {
87 error.reset(); 87 error.reset();
88 88
89 bool useTiles = false; 89 bool useTiles = false;
90 const char* widthString = NULL; 90 const char* widthString = NULL;
91 const char* heightString = NULL; 91 const char* heightString = NULL;
92 bool isPowerOf2Mode = false; 92 bool isPowerOf2Mode = false;
93 bool isCopyMode = false; 93 bool isCopyMode = false;
94 const char* mode = NULL; 94 const char* mode = NULL;
95 bool gridSupported = false;
96 95
97 #if SK_SUPPORT_GPU 96 #if SK_SUPPORT_GPU
98 GrContext::Options grContextOpts; 97 GrContext::Options grContextOpts;
99 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; 98 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks;
100 #define RENDERER_ARGS (grContextOpts) 99 #define RENDERER_ARGS (grContextOpts)
101 #else 100 #else
102 #define RENDERER_ARGS () 101 #define RENDERER_ARGS ()
103 #endif 102 #endif
104 103
105 SkAutoTUnref<sk_tools::PictureRenderer> renderer; 104 SkAutoTUnref<sk_tools::PictureRenderer> renderer;
106 if (FLAGS_mode.count() >= 1) { 105 if (FLAGS_mode.count() >= 1) {
107 mode = FLAGS_mode[0]; 106 mode = FLAGS_mode[0];
108 if (0 == strcmp(mode, "record")) { 107 if (0 == strcmp(mode, "record")) {
109 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS)); 108 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS));
110 gridSupported = true;
111 } else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile") 109 } else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile")
112 || 0 == strcmp(mode, "copyTile")) { 110 || 0 == strcmp(mode, "copyTile")) {
113 useTiles = true; 111 useTiles = true;
114 112
115 if (0 == strcmp(mode, "pow2tile")) { 113 if (0 == strcmp(mode, "pow2tile")) {
116 isPowerOf2Mode = true; 114 isPowerOf2Mode = true;
117 } else if (0 == strcmp(mode, "copyTile")) { 115 } else if (0 == strcmp(mode, "copyTile")) {
118 isCopyMode = true; 116 isCopyMode = true;
119 } else {
120 gridSupported = true;
121 } 117 }
122 118
123 if (FLAGS_mode.count() < 2) { 119 if (FLAGS_mode.count() < 2) {
124 error.printf("Missing width for --mode %s\n", mode); 120 error.printf("Missing width for --mode %s\n", mode);
125 return NULL; 121 return NULL;
126 } 122 }
127 123
128 widthString = FLAGS_mode[1]; 124 widthString = FLAGS_mode[1];
129 if (FLAGS_mode.count() < 3) { 125 if (FLAGS_mode.count() < 3) {
130 error.printf("Missing height for --mode %s\n", mode); 126 error.printf("Missing height for --mode %s\n", mode);
131 return NULL; 127 return NULL;
132 } 128 }
133 129
134 heightString = FLAGS_mode[2]; 130 heightString = FLAGS_mode[2];
135 } else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool = = tool) { 131 } else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool = = tool) {
136 renderer.reset(SkNEW_ARGS(sk_tools::PlaybackCreationRenderer, RENDER ER_ARGS)); 132 renderer.reset(SkNEW_ARGS(sk_tools::PlaybackCreationRenderer, RENDER ER_ARGS));
137 gridSupported = true;
138 // undocumented 133 // undocumented
139 } else if (0 == strcmp(mode, "gatherPixelRefs") && kBench_PictureTool == tool) { 134 } else if (0 == strcmp(mode, "gatherPixelRefs") && kBench_PictureTool == tool) {
140 #if SK_SUPPORT_GPU 135 #if SK_SUPPORT_GPU
141 renderer.reset(sk_tools::CreateGatherPixelRefsRenderer(grContextOpts )); 136 renderer.reset(sk_tools::CreateGatherPixelRefsRenderer(grContextOpts ));
142 #else 137 #else
143 renderer.reset(sk_tools::CreateGatherPixelRefsRenderer()); 138 renderer.reset(sk_tools::CreateGatherPixelRefsRenderer());
144 #endif 139 #endif
145 } else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) { 140 } else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) {
146 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS)); 141 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS));
147 // Allow 'mode' to be set to 'simple', but do not create a renderer, so we can 142 // Allow 'mode' to be set to 'simple', but do not create a renderer, so we can
148 // ensure that pipe does not override a mode besides simple. The rendere r will 143 // ensure that pipe does not override a mode besides simple. The rendere r will
149 // be created below. 144 // be created below.
150 } else if (0 == strcmp(mode, "simple")) {
151 gridSupported = true;
152 } else { 145 } else {
153 error.printf("%s is not a valid mode for --mode\n", mode); 146 error.printf("%s is not a valid mode for --mode\n", mode);
154 return NULL; 147 return NULL;
155 } 148 }
156 } 149 }
157 150
158 if (useTiles) { 151 if (useTiles) {
159 SkASSERT(NULL == renderer); 152 SkASSERT(NULL == renderer);
160 SkAutoTUnref<sk_tools::TiledPictureRenderer> tiledRenderer; 153 SkAutoTUnref<sk_tools::TiledPictureRenderer> tiledRenderer;
161 if (isCopyMode) { 154 if (isCopyMode) {
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 340
348 341
349 sk_tools::PictureRenderer::BBoxHierarchyType bbhType 342 sk_tools::PictureRenderer::BBoxHierarchyType bbhType
350 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; 343 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
351 if (FLAGS_bbh.count() > 0) { 344 if (FLAGS_bbh.count() > 0) {
352 const char* type = FLAGS_bbh[0]; 345 const char* type = FLAGS_bbh[0];
353 if (0 == strcmp(type, "none")) { 346 if (0 == strcmp(type, "none")) {
354 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; 347 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType;
355 } else if (0 == strcmp(type, "rtree")) { 348 } else if (0 == strcmp(type, "rtree")) {
356 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType; 349 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType;
357 } else if (0 == strcmp(type, "grid")) {
358 if (!gridSupported) {
359 error.printf("'--bbh grid' is not compatible with --mode=%s.\n", mode);
360 return NULL;
361 }
362 bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType;
363 if (FLAGS_bbh.count() != 3) {
364 error.printf("--bbh grid requires a width and a height.\n");
365 return NULL;
366 }
367 int gridWidth = atoi(FLAGS_bbh[1]);
368 int gridHeight = atoi(FLAGS_bbh[2]);
369 renderer->setGridSize(gridWidth, gridHeight);
370
371 } else { 350 } else {
372 error.printf("%s is not a valid value for --bbhType\n", type); 351 error.printf("%s is not a valid value for --bbhType\n", type);
373 return NULL; 352 return NULL;
374 } 353 }
375 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) { 354 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) {
376 error.printf("--pipe and --bbh cannot be used together\n"); 355 error.printf("--pipe and --bbh cannot be used together\n");
377 return NULL; 356 return NULL;
378 } 357 }
379 } 358 }
380 renderer->setBBoxHierarchyType(bbhType); 359 renderer->setBBoxHierarchyType(bbhType);
381 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); 360 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale));
382 361
383 return renderer.detach(); 362 return renderer.detach();
384 } 363 }
OLDNEW
« no previous file with comments | « tools/PictureRenderer.cpp ('k') | tools/bbh_shootout.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698