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