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

Side by Side Diff: tools/PictureRenderingFlags.cpp

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 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 | « tools/PictureRenderer.cpp ('k') | tools/VisualBench/VisualBench.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks; 103 grContextOpts.fDrawPathToCompressedTexture = FLAGS_gpuCompressAlphaMasks;
104 #define RENDERER_ARGS (grContextOpts) 104 #define RENDERER_ARGS (grContextOpts)
105 #else 105 #else
106 #define RENDERER_ARGS () 106 #define RENDERER_ARGS ()
107 #endif 107 #endif
108 108
109 SkAutoTUnref<sk_tools::PictureRenderer> renderer; 109 SkAutoTUnref<sk_tools::PictureRenderer> renderer;
110 if (FLAGS_mode.count() >= 1) { 110 if (FLAGS_mode.count() >= 1) {
111 mode = FLAGS_mode[0]; 111 mode = FLAGS_mode[0];
112 if (0 == strcmp(mode, "record")) { 112 if (0 == strcmp(mode, "record")) {
113 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS)); 113 renderer.reset(new sk_tools::RecordPictureRenderer RENDERER_ARGS);
114 } else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile") 114 } else if (0 == strcmp(mode, "tile") || 0 == strcmp(mode, "pow2tile")
115 || 0 == strcmp(mode, "copyTile")) { 115 || 0 == strcmp(mode, "copyTile")) {
116 useTiles = true; 116 useTiles = true;
117 117
118 if (0 == strcmp(mode, "pow2tile")) { 118 if (0 == strcmp(mode, "pow2tile")) {
119 isPowerOf2Mode = true; 119 isPowerOf2Mode = true;
120 } else if (0 == strcmp(mode, "copyTile")) { 120 } else if (0 == strcmp(mode, "copyTile")) {
121 isCopyMode = true; 121 isCopyMode = true;
122 } 122 }
123 123
124 if (FLAGS_mode.count() < 2) { 124 if (FLAGS_mode.count() < 2) {
125 error.printf("Missing width for --mode %s\n", mode); 125 error.printf("Missing width for --mode %s\n", mode);
126 return NULL; 126 return NULL;
127 } 127 }
128 128
129 widthString = FLAGS_mode[1]; 129 widthString = FLAGS_mode[1];
130 if (FLAGS_mode.count() < 3) { 130 if (FLAGS_mode.count() < 3) {
131 error.printf("Missing height for --mode %s\n", mode); 131 error.printf("Missing height for --mode %s\n", mode);
132 return NULL; 132 return NULL;
133 } 133 }
134 134
135 heightString = FLAGS_mode[2]; 135 heightString = FLAGS_mode[2];
136 } else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool = = tool) { 136 } else if (0 == strcmp(mode, "playbackCreation") && kBench_PictureTool = = tool) {
137 renderer.reset(SkNEW_ARGS(sk_tools::PlaybackCreationRenderer, RENDER ER_ARGS)); 137 renderer.reset(new sk_tools::PlaybackCreationRenderer RENDERER_ARGS) ;
138 // undocumented 138 // undocumented
139 } else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) { 139 } else if (0 == strcmp(mode, "rerecord") && kRender_PictureTool == tool) {
140 renderer.reset(SkNEW_ARGS(sk_tools::RecordPictureRenderer, RENDERER_ ARGS)); 140 renderer.reset(new sk_tools::RecordPictureRenderer RENDERER_ARGS);
141 } else if (0 == strcmp(mode, "simple")) { 141 } else if (0 == strcmp(mode, "simple")) {
142 // 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
143 // ensure that pipe does not override a mode besides simple. The ren derer will 143 // ensure that pipe does not override a mode besides simple. The ren derer will
144 // be created below. 144 // be created below.
145 } else { 145 } else {
146 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);
147 return NULL; 147 return NULL;
148 } 148 }
149 } 149 }
150 150
(...skipping 17 matching lines...) Expand all
168 x = xTiles; 168 x = xTiles;
169 y = yTiles; 169 y = yTiles;
170 if (x <= 0 || y <= 0) { 170 if (x <= 0 || y <= 0) {
171 error.printf("--tiles must be given values > 0\n"); 171 error.printf("--tiles must be given values > 0\n");
172 return NULL; 172 return NULL;
173 } 173 }
174 } else { 174 } else {
175 x = y = 4; 175 x = y = 4;
176 } 176 }
177 #if SK_SUPPORT_GPU 177 #if SK_SUPPORT_GPU
178 tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (grConte xtOpts, x, y))); 178 tiledRenderer.reset(new sk_tools::CopyTilesRenderer(grContextOpts, x , y));
179 #else 179 #else
180 tiledRenderer.reset(SkNEW_ARGS(sk_tools::CopyTilesRenderer, (x, y))) ; 180 tiledRenderer.reset(new sk_tools::CopyTilesRenderer(x, y));
181 #endif 181 #endif
182 } else { 182 } else {
183 tiledRenderer.reset(SkNEW_ARGS(sk_tools::TiledPictureRenderer, RENDE RER_ARGS)); 183 tiledRenderer.reset(new sk_tools::TiledPictureRenderer RENDERER_ARGS );
184 } 184 }
185 185
186 if (isPowerOf2Mode) { 186 if (isPowerOf2Mode) {
187 int minWidth = atoi(widthString); 187 int minWidth = atoi(widthString);
188 if (!SkIsPow2(minWidth) || minWidth < 0) { 188 if (!SkIsPow2(minWidth) || minWidth < 0) {
189 SkString err; 189 SkString err;
190 error.printf("-mode %s must be given a width" 190 error.printf("-mode %s must be given a width"
191 " value that is a power of two\n", mode); 191 " value that is a power of two\n", mode);
192 return NULL; 192 return NULL;
193 } 193 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 error.printf("Pipe rendering is currently not compatible with tiling .\n" 234 error.printf("Pipe rendering is currently not compatible with tiling .\n"
235 "Turning off pipe.\n"); 235 "Turning off pipe.\n");
236 } 236 }
237 237
238 } else { // useTiles 238 } else { // useTiles
239 if (FLAGS_pipe) { 239 if (FLAGS_pipe) {
240 if (renderer != NULL) { 240 if (renderer != NULL) {
241 error.printf("Pipe is incompatible with other modes.\n"); 241 error.printf("Pipe is incompatible with other modes.\n");
242 return NULL; 242 return NULL;
243 } 243 }
244 renderer.reset(SkNEW_ARGS(sk_tools::PipePictureRenderer, RENDERER_AR GS)); 244 renderer.reset(new sk_tools::PipePictureRenderer RENDERER_ARGS);
245 } 245 }
246 } 246 }
247 247
248 if (NULL == renderer) { 248 if (NULL == renderer) {
249 renderer.reset(SkNEW_ARGS(sk_tools::SimplePictureRenderer, RENDERER_ARGS )); 249 renderer.reset(new sk_tools::SimplePictureRenderer RENDERER_ARGS);
250 } 250 }
251 251
252 if (FLAGS_viewport.count() > 0) { 252 if (FLAGS_viewport.count() > 0) {
253 if (FLAGS_viewport.count() != 2) { 253 if (FLAGS_viewport.count() != 2) {
254 error.printf("--viewport requires a width and a height.\n"); 254 error.printf("--viewport requires a width and a height.\n");
255 return NULL; 255 return NULL;
256 } 256 }
257 SkISize viewport; 257 SkISize viewport;
258 viewport.fWidth = atoi(FLAGS_viewport[0]); 258 viewport.fWidth = atoi(FLAGS_viewport[0]);
259 viewport.fHeight = atoi(FLAGS_viewport[1]); 259 viewport.fHeight = atoi(FLAGS_viewport[1]);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) { 354 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType != bbhType) {
355 error.printf("--pipe and --bbh cannot be used together\n"); 355 error.printf("--pipe and --bbh cannot be used together\n");
356 return NULL; 356 return NULL;
357 } 357 }
358 } 358 }
359 renderer->setBBoxHierarchyType(bbhType); 359 renderer->setBBoxHierarchyType(bbhType);
360 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); 360 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale));
361 361
362 return renderer.detach(); 362 return renderer.detach();
363 } 363 }
OLDNEW
« no previous file with comments | « tools/PictureRenderer.cpp ('k') | tools/VisualBench/VisualBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698