| 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" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
hy type to " | 24 DEFINE_string(bbh, "none", "bbhType [width height]: Set the bounding box hierarc
hy type to " |
| 25 "be used. Accepted values are: none, rtree, grid. " | 25 "be used. Accepted values are: none, rtree, grid. " |
| 26 "Not compatible with --pipe. With value " | 26 "Not compatible with --pipe. With value " |
| 27 "'grid', width and height must be specified. 'grid' can " | 27 "'grid', width and height must be specified. 'grid' can " |
| 28 "only be used with modes tile, record, and " | 28 "only be used with modes tile, record, and " |
| 29 "playbackCreation."); | 29 "playbackCreation."); |
| 30 // Although this config does not support all the same options as gm, the names s
hould be kept | 30 // Although this config does not support all the same options as gm, the names s
hould be kept |
| 31 // consistent. | 31 // consistent. |
| 32 #if SK_ANGLE | 32 #if SK_ANGLE |
| 33 // ANGLE assumes GPU | 33 // ANGLE assumes GPU |
| 34 DEFINE_string(config, "8888", "[8888|gpu|angle]: Use the corresponding config.")
; | 34 DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16|angle]: Use the correspond
ing config."); |
| 35 #elif SK_SUPPORT_GPU | 35 #elif SK_SUPPORT_GPU |
| 36 DEFINE_string(config, "8888", "[8888|gpu]: Use the corresponding config."); | 36 DEFINE_string(config, "8888", "[8888|gpu|msaa4|msaa16]: Use the corresponding co
nfig."); |
| 37 #else | 37 #else |
| 38 DEFINE_string(config, "8888", "[8888]: Use the corresponding config."); | 38 DEFINE_string(config, "8888", "[8888]: Use the corresponding config."); |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 DEFINE_bool(deferImageDecoding, false, "Defer decoding until drawing images. " | 41 DEFINE_bool(deferImageDecoding, false, "Defer decoding until drawing images. " |
| 42 "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.
"); |
| 43 DEFINE_string(mode, "simple", "Run in the corresponding mode:\n" | 43 DEFINE_string(mode, "simple", "Run in the corresponding mode:\n" |
| 44 "simple: Simple rendering.\n" | 44 "simple: Simple rendering.\n" |
| 45 "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" |
| 46 "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" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 return NULL; | 245 return NULL; |
| 246 } | 246 } |
| 247 SkISize viewport; | 247 SkISize viewport; |
| 248 viewport.fWidth = atoi(FLAGS_viewport[0]); | 248 viewport.fWidth = atoi(FLAGS_viewport[0]); |
| 249 viewport.fHeight = atoi(FLAGS_viewport[1]); | 249 viewport.fHeight = atoi(FLAGS_viewport[1]); |
| 250 renderer->setViewport(viewport); | 250 renderer->setViewport(viewport); |
| 251 } | 251 } |
| 252 | 252 |
| 253 sk_tools::PictureRenderer::SkDeviceTypes deviceType = | 253 sk_tools::PictureRenderer::SkDeviceTypes deviceType = |
| 254 sk_tools::PictureRenderer::kBitmap_DeviceType; | 254 sk_tools::PictureRenderer::kBitmap_DeviceType; |
| 255 #if SK_SUPPORT_GPU |
| 256 int sampleCount = 0; |
| 257 #endif |
| 255 if (FLAGS_config.count() > 0) { | 258 if (FLAGS_config.count() > 0) { |
| 256 if (0 == strcmp(FLAGS_config[0], "8888")) { | 259 if (0 == strcmp(FLAGS_config[0], "8888")) { |
| 257 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType; | 260 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType; |
| 258 } | 261 } |
| 259 #if SK_SUPPORT_GPU | 262 #if SK_SUPPORT_GPU |
| 260 else if (0 == strcmp(FLAGS_config[0], "gpu")) { | 263 else if (0 == strcmp(FLAGS_config[0], "gpu")) { |
| 261 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | 264 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 262 if (FLAGS_multi > 1) { | 265 if (FLAGS_multi > 1) { |
| 263 error.printf("GPU not compatible with multithreaded tiling.\n"); | 266 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 264 return NULL; | 267 return NULL; |
| 265 } | 268 } |
| 266 } | 269 } |
| 270 else if (0 == strcmp(FLAGS_config[0], "msaa4")) { |
| 271 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 272 if (FLAGS_multi > 1) { |
| 273 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 274 return NULL; |
| 275 } |
| 276 sampleCount = 4; |
| 277 } |
| 278 else if (0 == strcmp(FLAGS_config[0], "msaa16")) { |
| 279 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 280 if (FLAGS_multi > 1) { |
| 281 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 282 return NULL; |
| 283 } |
| 284 sampleCount = 16; |
| 285 } |
| 267 #if SK_ANGLE | 286 #if SK_ANGLE |
| 268 else if (0 == strcmp(FLAGS_config[0], "angle")) { | 287 else if (0 == strcmp(FLAGS_config[0], "angle")) { |
| 269 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; | 288 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; |
| 270 if (FLAGS_multi > 1) { | 289 if (FLAGS_multi > 1) { |
| 271 error.printf("Angle not compatible with multithreaded tiling.\n"
); | 290 error.printf("Angle not compatible with multithreaded tiling.\n"
); |
| 272 return NULL; | 291 return NULL; |
| 273 } | 292 } |
| 274 } | 293 } |
| 275 #endif | 294 #endif |
| 276 #endif | 295 #endif |
| 277 else { | 296 else { |
| 278 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); | 297 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); |
| 279 return NULL; | 298 return NULL; |
| 280 } | 299 } |
| 281 renderer->setDeviceType(deviceType); | 300 renderer->setDeviceType(deviceType); |
| 301 #if SK_SUPPORT_GPU |
| 302 renderer->setSampleCount(sampleCount); |
| 303 #endif |
| 282 } | 304 } |
| 283 | 305 |
| 284 | 306 |
| 285 sk_tools::PictureRenderer::BBoxHierarchyType bbhType | 307 sk_tools::PictureRenderer::BBoxHierarchyType bbhType |
| 286 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 308 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 287 if (FLAGS_bbh.count() > 0) { | 309 if (FLAGS_bbh.count() > 0) { |
| 288 const char* type = FLAGS_bbh[0]; | 310 const char* type = FLAGS_bbh[0]; |
| 289 if (0 == strcmp(type, "none")) { | 311 if (0 == strcmp(type, "none")) { |
| 290 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 312 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 291 } else if (0 == strcmp(type, "rtree")) { | 313 } else if (0 == strcmp(type, "rtree")) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 if (FLAGS_useVolatileCache && SkAutoTUnref<SkImageCache>( | 382 if (FLAGS_useVolatileCache && SkAutoTUnref<SkImageCache>( |
| 361 SkPurgeableImageCache::Create()).get() != NULL) { | 383 SkPurgeableImageCache::Create()).get() != NULL) { |
| 362 gFactory.setCacheSelector(&gCacheSelector); | 384 gFactory.setCacheSelector(&gCacheSelector); |
| 363 } else { | 385 } else { |
| 364 gFactory.setImageCache(&gLruImageCache); | 386 gFactory.setImageCache(&gLruImageCache); |
| 365 } | 387 } |
| 366 gOnce = true; | 388 gOnce = true; |
| 367 } | 389 } |
| 368 return gFactory.installPixelRef(data, bitmap); | 390 return gFactory.installPixelRef(data, bitmap); |
| 369 } | 391 } |
| OLD | NEW |