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, 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" |
30 #else | 30 #else |
31 #define GPU_CONFIG_STRING "" | 31 #define GPU_CONFIG_STRING "" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 #endif | 318 #endif |
319 } | 319 } |
320 | 320 |
321 | 321 |
322 sk_tools::PictureRenderer::BBoxHierarchyType bbhType | 322 sk_tools::PictureRenderer::BBoxHierarchyType bbhType |
323 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 323 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
324 if (FLAGS_bbh.count() > 0) { | 324 if (FLAGS_bbh.count() > 0) { |
325 const char* type = FLAGS_bbh[0]; | 325 const char* type = FLAGS_bbh[0]; |
326 if (0 == strcmp(type, "none")) { | 326 if (0 == strcmp(type, "none")) { |
327 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 327 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 328 } else if (0 == strcmp(type, "quadtree")) { |
| 329 bbhType = sk_tools::PictureRenderer::kQuadTree_BBoxHierarchyType; |
328 } else if (0 == strcmp(type, "rtree")) { | 330 } else if (0 == strcmp(type, "rtree")) { |
329 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType; | 331 bbhType = sk_tools::PictureRenderer::kRTree_BBoxHierarchyType; |
330 } else if (0 == strcmp(type, "grid")) { | 332 } else if (0 == strcmp(type, "grid")) { |
331 if (!gridSupported) { | 333 if (!gridSupported) { |
332 error.printf("'--bbh grid' is not compatible with --mode=%s.\n",
mode); | 334 error.printf("'--bbh grid' is not compatible with --mode=%s.\n",
mode); |
333 return NULL; | 335 return NULL; |
334 } | 336 } |
335 bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType; | 337 bbhType = sk_tools::PictureRenderer::kTileGrid_BBoxHierarchyType; |
336 if (FLAGS_bbh.count() != 3) { | 338 if (FLAGS_bbh.count() != 3) { |
337 error.printf("--bbh grid requires a width and a height.\n"); | 339 error.printf("--bbh grid requires a width and a height.\n"); |
(...skipping 10 matching lines...) Expand all Loading... |
348 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { | 350 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { |
349 error.printf("--pipe and --bbh cannot be used together\n"); | 351 error.printf("--pipe and --bbh cannot be used together\n"); |
350 return NULL; | 352 return NULL; |
351 } | 353 } |
352 } | 354 } |
353 renderer->setBBoxHierarchyType(bbhType); | 355 renderer->setBBoxHierarchyType(bbhType); |
354 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); | 356 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); |
355 | 357 |
356 return renderer.detach(); | 358 return renderer.detach(); |
357 } | 359 } |
OLD | NEW |