| 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, quadtree, grid. " | 21 "be used. Accepted values are: none, rtree, quadtree, 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 | 26 |
| 27 | 27 |
| 28 #if SK_SUPPORT_GPU | 28 #if SK_SUPPORT_GPU |
| 29 #define GPU_CONFIG_STRING "|gpu|msaa4|msaa16" | 29 #define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16" |
| 30 #else | 30 #else |
| 31 #define GPU_CONFIG_STRING "" | 31 #define GPU_CONFIG_STRING "" |
| 32 #endif | 32 #endif |
| 33 #if SK_ANGLE | 33 #if SK_ANGLE |
| 34 #define ANGLE_CONFIG_STRING "|angle" | 34 #define ANGLE_CONFIG_STRING "|angle" |
| 35 #else | 35 #else |
| 36 #define ANGLE_CONFIG_STRING "" | 36 #define ANGLE_CONFIG_STRING "" |
| 37 #endif | 37 #endif |
| 38 #if SK_MESA | 38 #if SK_MESA |
| 39 #define MESA_CONFIG_STRING "|mesa" | 39 #define MESA_CONFIG_STRING "|mesa" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 sampleCount = 4; | 282 sampleCount = 4; |
| 283 } | 283 } |
| 284 else if (0 == strcmp(FLAGS_config[0], "msaa16")) { | 284 else if (0 == strcmp(FLAGS_config[0], "msaa16")) { |
| 285 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | 285 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 286 if (FLAGS_multi > 1) { | 286 if (FLAGS_multi > 1) { |
| 287 error.printf("GPU not compatible with multithreaded tiling.\n"); | 287 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 288 return NULL; | 288 return NULL; |
| 289 } | 289 } |
| 290 sampleCount = 16; | 290 sampleCount = 16; |
| 291 } | 291 } |
| 292 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa4")) { |
| 293 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; |
| 294 if (FLAGS_multi > 1) { |
| 295 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 296 return NULL; |
| 297 } |
| 298 sampleCount = 4; |
| 299 } |
| 300 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa16")) { |
| 301 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; |
| 302 if (FLAGS_multi > 1) { |
| 303 error.printf("GPU not compatible with multithreaded tiling.\n"); |
| 304 return NULL; |
| 305 } |
| 306 sampleCount = 16; |
| 307 } |
| 292 #if SK_ANGLE | 308 #if SK_ANGLE |
| 293 else if (0 == strcmp(FLAGS_config[0], "angle")) { | 309 else if (0 == strcmp(FLAGS_config[0], "angle")) { |
| 294 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; | 310 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; |
| 295 if (FLAGS_multi > 1) { | 311 if (FLAGS_multi > 1) { |
| 296 error.printf("Angle not compatible with multithreaded tiling.\n"
); | 312 error.printf("Angle not compatible with multithreaded tiling.\n"
); |
| 297 return NULL; | 313 return NULL; |
| 298 } | 314 } |
| 299 } | 315 } |
| 300 #endif | 316 #endif |
| 301 #if SK_MESA | 317 #if SK_MESA |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { | 366 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { |
| 351 error.printf("--pipe and --bbh cannot be used together\n"); | 367 error.printf("--pipe and --bbh cannot be used together\n"); |
| 352 return NULL; | 368 return NULL; |
| 353 } | 369 } |
| 354 } | 370 } |
| 355 renderer->setBBoxHierarchyType(bbhType); | 371 renderer->setBBoxHierarchyType(bbhType); |
| 356 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); | 372 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); |
| 357 | 373 |
| 358 return renderer.detach(); | 374 return renderer.detach(); |
| 359 } | 375 } |
| OLD | NEW |