OLD | NEW |
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" |
11 #include "PictureRenderer.h" | 11 #include "PictureRenderer.h" |
12 #include "picture_utils.h" | 12 #include "picture_utils.h" |
13 #include "SkCommandLineFlags.h" | 13 #include "SkCommandLineFlags.h" |
14 #include "SkData.h" | 14 #include "SkData.h" |
15 #include "SkImage.h" | 15 #include "SkImage.h" |
16 #include "SkImageDecoder.h" | 16 #include "SkImageDecoder.h" |
17 #include "SkString.h" | 17 #include "SkString.h" |
18 | 18 |
19 // Alphabetized list of flags used by this file or bench_ and render_pictures. | 19 // Alphabetized list of flags used by this file or bench_ and render_pictures. |
20 DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
hy type to " | 20 DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
hy type to " |
21 "be used. Accepted values are: none, rtree, grid. " | 21 "be used. Accepted values are: none, rtree, grid. " |
22 "Not compatible with --pipe. With value " | 22 "Not compatible with --pipe. With value " |
23 "'grid', width and height must be specified. 'grid' can " | 23 "'grid', width and height must be specified. 'grid' can " |
24 "only be used with modes tile, record, and " | 24 "only be used with modes tile, record, and " |
25 "playbackCreation."); | 25 "playbackCreation."); |
26 // Although this config does not support all the same options as gm, the names s
hould be kept | 26 // Although this config does not support all the same options as gm, the names s
hould be kept |
27 // consistent. | 27 // consistent. |
| 28 DEFINE_string(config, "8888", "[" |
| 29 "8888" |
| 30 #if SK_SUPPORT_GPU |
| 31 "|gpu|msaa4|msaa16" |
| 32 #endif |
28 #if SK_ANGLE | 33 #if SK_ANGLE |
29 // ANGLE assumes GPU | 34 "|angle" |
30 DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16|angle]: Use the correspond
ing config."); | |
31 #elif SK_SUPPORT_GPU | |
32 DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16]: Use the corresponding co
nfig."); | |
33 #else | |
34 DEFINE_string(config, "8888", "[8888]: Use the corresponding config."); | |
35 #endif | 35 #endif |
| 36 #if SK_MESA |
| 37 "|mesa" |
| 38 #endif |
| 39 "]: Use the corresponding config."); |
36 | 40 |
37 DEFINE_bool(deferImageDecoding, false, "Defer decoding until drawing images. " | 41 DEFINE_bool(deferImageDecoding, false, "Defer decoding until drawing images. " |
38 "Has no effect if the provided skp does not have its images encoded.
"); | 42 "Has no effect if the provided skp does not have its images encoded.
"); |
39 DEFINE_string(mode, "simple", "Run in the corresponding mode:\n" | 43 DEFINE_string(mode, "simple", "Run in the corresponding mode:\n" |
40 "simple: Simple rendering.\n" | 44 "simple: Simple rendering.\n" |
41 "tile width height: Use tiles with the given dimensions or percent
ages.\n" | 45 "tile width height: Use tiles with the given dimensions or percent
ages.\n" |
42 "pow2tile minWidth height: Use tiles with widths that are all a po
wer\n" | 46 "pow2tile minWidth height: Use tiles with widths that are all a po
wer\n" |
43 "\tof two such that they minimize the amount of wasted tile space.
\n" | 47 "\tof two such that they minimize the amount of wasted tile space.
\n" |
44 "\tminWidth must be a power of two.\n" | 48 "\tminWidth must be a power of two.\n" |
45 "copyTile width height: Draw the picture, then copy into tiles. If
the\n" | 49 "copyTile width height: Draw the picture, then copy into tiles. If
the\n" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 282 } |
279 #if SK_ANGLE | 283 #if SK_ANGLE |
280 else if (0 == strcmp(FLAGS_config[0], "angle")) { | 284 else if (0 == strcmp(FLAGS_config[0], "angle")) { |
281 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; | 285 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; |
282 if (FLAGS_multi > 1) { | 286 if (FLAGS_multi > 1) { |
283 error.printf("Angle not compatible with multithreaded tiling.\n"
); | 287 error.printf("Angle not compatible with multithreaded tiling.\n"
); |
284 return NULL; | 288 return NULL; |
285 } | 289 } |
286 } | 290 } |
287 #endif | 291 #endif |
| 292 #if SK_MESA |
| 293 else if (0 == strcmp(FLAGS_config[0], "mesa")) { |
| 294 deviceType = sk_tools::PictureRenderer::kMesa_DeviceType; |
| 295 if (FLAGS_multi > 1) { |
| 296 error.printf("Mesa not compatible with multithreaded tiling.\n")
; |
| 297 return NULL; |
| 298 } |
| 299 } |
| 300 #endif |
288 #endif | 301 #endif |
289 else { | 302 else { |
290 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); | 303 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); |
291 return NULL; | 304 return NULL; |
292 } | 305 } |
293 renderer->setDeviceType(deviceType); | 306 renderer->setDeviceType(deviceType); |
294 #if SK_SUPPORT_GPU | 307 #if SK_SUPPORT_GPU |
295 renderer->setSampleCount(sampleCount); | 308 renderer->setSampleCount(sampleCount); |
296 #endif | 309 #endif |
297 } | 310 } |
(...skipping 28 matching lines...) Expand all Loading... |
326 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { | 339 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { |
327 error.printf("--pipe and --bbh cannot be used together\n"); | 340 error.printf("--pipe and --bbh cannot be used together\n"); |
328 return NULL; | 341 return NULL; |
329 } | 342 } |
330 } | 343 } |
331 renderer->setBBoxHierarchyType(bbhType); | 344 renderer->setBBoxHierarchyType(bbhType); |
332 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); | 345 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); |
333 | 346 |
334 return renderer.detach(); | 347 return renderer.detach(); |
335 } | 348 } |
OLD | NEW |