| 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 10 matching lines...) Expand all Loading... |
| 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 | 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|gpudft" | 31 #define GPU_CONFIG_STRING "|gpu|msaa4|msaa16|nvprmsaa4|nvprmsaa16" |
| 32 #else | 32 #else |
| 33 #define GPU_CONFIG_STRING "" | 33 #define GPU_CONFIG_STRING "" |
| 34 #endif | 34 #endif |
| 35 #if SK_ANGLE | 35 #if SK_ANGLE |
| 36 #define ANGLE_CONFIG_STRING "|angle" | 36 #define ANGLE_CONFIG_STRING "|angle" |
| 37 #else | 37 #else |
| 38 #define ANGLE_CONFIG_STRING "" | 38 #define ANGLE_CONFIG_STRING "" |
| 39 #endif | 39 #endif |
| 40 #if SK_MESA | 40 #if SK_MESA |
| 41 #define MESA_CONFIG_STRING "|mesa" | 41 #define MESA_CONFIG_STRING "|mesa" |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } else { | 279 } else { |
| 280 error.printf("--gpuAPI invalid api value.\n"); | 280 error.printf("--gpuAPI invalid api value.\n"); |
| 281 return NULL; | 281 return NULL; |
| 282 } | 282 } |
| 283 } else if (FLAGS_gpuAPI.count() > 1) { | 283 } else if (FLAGS_gpuAPI.count() > 1) { |
| 284 error.printf("--gpuAPI invalid api value.\n"); | 284 error.printf("--gpuAPI invalid api value.\n"); |
| 285 return NULL; | 285 return NULL; |
| 286 } | 286 } |
| 287 | 287 |
| 288 int sampleCount = 0; | 288 int sampleCount = 0; |
| 289 bool useDFText = false; | |
| 290 #endif | 289 #endif |
| 291 if (FLAGS_config.count() > 0) { | 290 if (FLAGS_config.count() > 0) { |
| 292 if (0 == strcmp(FLAGS_config[0], "8888")) { | 291 if (0 == strcmp(FLAGS_config[0], "8888")) { |
| 293 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType; | 292 deviceType = sk_tools::PictureRenderer::kBitmap_DeviceType; |
| 294 } | 293 } |
| 295 #if SK_SUPPORT_GPU | 294 #if SK_SUPPORT_GPU |
| 296 else if (0 == strcmp(FLAGS_config[0], "gpu")) { | 295 else if (0 == strcmp(FLAGS_config[0], "gpu")) { |
| 297 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | 296 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 298 } | 297 } |
| 299 else if (0 == strcmp(FLAGS_config[0], "msaa4")) { | 298 else if (0 == strcmp(FLAGS_config[0], "msaa4")) { |
| 300 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | 299 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 301 sampleCount = 4; | 300 sampleCount = 4; |
| 302 } | 301 } |
| 303 else if (0 == strcmp(FLAGS_config[0], "msaa16")) { | 302 else if (0 == strcmp(FLAGS_config[0], "msaa16")) { |
| 304 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | 303 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; |
| 305 sampleCount = 16; | 304 sampleCount = 16; |
| 306 } | 305 } |
| 307 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa4")) { | 306 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa4")) { |
| 308 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; | 307 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; |
| 309 sampleCount = 4; | 308 sampleCount = 4; |
| 310 } | 309 } |
| 311 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa16")) { | 310 else if (0 == strcmp(FLAGS_config[0], "nvprmsaa16")) { |
| 312 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; | 311 deviceType = sk_tools::PictureRenderer::kNVPR_DeviceType; |
| 313 sampleCount = 16; | 312 sampleCount = 16; |
| 314 } | 313 } |
| 315 else if (0 == strcmp(FLAGS_config[0], "gpudft")) { | |
| 316 deviceType = sk_tools::PictureRenderer::kGPU_DeviceType; | |
| 317 useDFText = true; | |
| 318 } | |
| 319 #if SK_ANGLE | 314 #if SK_ANGLE |
| 320 else if (0 == strcmp(FLAGS_config[0], "angle")) { | 315 else if (0 == strcmp(FLAGS_config[0], "angle")) { |
| 321 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; | 316 deviceType = sk_tools::PictureRenderer::kAngle_DeviceType; |
| 322 } | 317 } |
| 323 #endif | 318 #endif |
| 324 #if SK_MESA | 319 #if SK_MESA |
| 325 else if (0 == strcmp(FLAGS_config[0], "mesa")) { | 320 else if (0 == strcmp(FLAGS_config[0], "mesa")) { |
| 326 deviceType = sk_tools::PictureRenderer::kMesa_DeviceType; | 321 deviceType = sk_tools::PictureRenderer::kMesa_DeviceType; |
| 327 } | 322 } |
| 328 #endif | 323 #endif |
| 329 #endif | 324 #endif |
| 330 else { | 325 else { |
| 331 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); | 326 error.printf("%s is not a valid mode for --config\n", FLAGS_config[0
]); |
| 332 return NULL; | 327 return NULL; |
| 333 } | 328 } |
| 334 #if SK_SUPPORT_GPU | 329 #if SK_SUPPORT_GPU |
| 335 if (!renderer->setDeviceType(deviceType, gpuAPI)) { | 330 if (!renderer->setDeviceType(deviceType, gpuAPI)) { |
| 336 #else | 331 #else |
| 337 if (!renderer->setDeviceType(deviceType)) { | 332 if (!renderer->setDeviceType(deviceType)) { |
| 338 #endif | 333 #endif |
| 339 error.printf("Could not create backend for --config %s\n", FLAGS_con
fig[0]); | 334 error.printf("Could not create backend for --config %s\n", FLAGS_con
fig[0]); |
| 340 return NULL; | 335 return NULL; |
| 341 } | 336 } |
| 342 #if SK_SUPPORT_GPU | 337 #if SK_SUPPORT_GPU |
| 343 renderer->setSampleCount(sampleCount); | 338 renderer->setSampleCount(sampleCount); |
| 344 renderer->setUseDFText(useDFText); | |
| 345 #endif | 339 #endif |
| 346 } | 340 } |
| 347 | 341 |
| 348 | 342 |
| 349 sk_tools::PictureRenderer::BBoxHierarchyType bbhType | 343 sk_tools::PictureRenderer::BBoxHierarchyType bbhType |
| 350 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 344 = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| 351 if (FLAGS_bbh.count() > 0) { | 345 if (FLAGS_bbh.count() > 0) { |
| 352 const char* type = FLAGS_bbh[0]; | 346 const char* type = FLAGS_bbh[0]; |
| 353 if (0 == strcmp(type, "none")) { | 347 if (0 == strcmp(type, "none")) { |
| 354 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; | 348 bbhType = sk_tools::PictureRenderer::kNone_BBoxHierarchyType; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 375 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { | 369 if (FLAGS_pipe && sk_tools::PictureRenderer::kNone_BBoxHierarchyType !=
bbhType) { |
| 376 error.printf("--pipe and --bbh cannot be used together\n"); | 370 error.printf("--pipe and --bbh cannot be used together\n"); |
| 377 return NULL; | 371 return NULL; |
| 378 } | 372 } |
| 379 } | 373 } |
| 380 renderer->setBBoxHierarchyType(bbhType); | 374 renderer->setBBoxHierarchyType(bbhType); |
| 381 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); | 375 renderer->setScaleFactor(SkDoubleToScalar(FLAGS_scale)); |
| 382 | 376 |
| 383 return renderer.detach(); | 377 return renderer.detach(); |
| 384 } | 378 } |
| OLD | NEW |