| 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, 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 static const char kGpuAPINameGL[] = "gl"; | 29 static const char kGpuAPINameGL[] = "gl"; |
| 30 static const char kGpuAPINameGLES[] = "gles"; | 30 static const char kGpuAPINameGLES[] = "gles"; |
| 31 #define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16" | 31 #define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 #endif | 339 #endif |
| 340 } | 340 } |
| 341 | 341 |
| 342 | 342 |
| 343 sk_tools::PictureRenderer::BBoxHierarchyType bbhType | 343 sk_tools::PictureRenderer::BBoxHierarchyType bbhType |
| 344 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 344 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 345 if (FLAGS_bbh.count() > 0) { | 345 if (FLAGS_bbh.count() > 0) { |
| 346 const char* type = FLAGS_bbh[0]; | 346 const char* type = FLAGS_bbh[0]; |
| 347 if (0 == strcmp(type, "none")) { | 347 if (0 == strcmp(type, "none")) { |
| 348 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 348 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 349 } else if (0 == strcmp(type, "quadtree")) { | |
| 350 bbhType = sk_tools::PictureRenderer::kQuadTree_BBoxHierarchyType; | |
| 351 } else if (0 == strcmp(type, "rtree")) { | 349 } else if (0 == strcmp(type, "rtree")) { |
| 352 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType; | 350 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType; |
| 353 } else if (0 == strcmp(type, "grid")) { | 351 } else if (0 == strcmp(type, "grid")) { |
| 354 if (!gridSupported) { | 352 if (!gridSupported) { |
| 355 error.printf("'--bbh grid' is not compatible with --mode=%s.\n",
mode); | 353 error.printf("'--bbh grid' is not compatible with --mode=%s.\n",
mode); |
| 356 return NULL; | 354 return NULL; |
| 357 } | 355 } |
| 358 bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType; | 356 bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType; |
| 359 if (FLAGS_bbh.count() != 3) { | 357 if (FLAGS_bbh.count() != 3) { |
| 360 error.printf("--bbh grid requires a width and a height.\n"); | 358 error.printf("--bbh grid requires a width and a height.\n"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 371 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { | 369 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { |
| 372 error.printf("--pipe and --bbh cannot be used together\n"); | 370 error.printf("--pipe and --bbh cannot be used together\n"); |
| 373 return NULL; | 371 return NULL; |
| 374 } | 372 } |
| 375 } | 373 } |
| 376 renderer->setBBoxHierarchyType(bbhType); | 374 renderer->setBBoxHierarchyType(bbhType); |
| 377 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); | 375 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); |
| 378 | 376 |
| 379 return renderer.detach(); | 377 return renderer.detach(); |
| 380 } | 378 } |
| OLD | NEW |