| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #ifndef PictureRenderer_DEFINED | 8 #ifndef PictureRenderer_DEFINED |
| 9 #define PictureRenderer_DEFINED | 9 #define PictureRenderer_DEFINED |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 class TiledPictureRenderer; | 39 class TiledPictureRenderer; |
| 40 | 40 |
| 41 class PictureRenderer : public SkRefCnt { | 41 class PictureRenderer : public SkRefCnt { |
| 42 | 42 |
| 43 public: | 43 public: |
| 44 enum SkDeviceTypes { | 44 enum SkDeviceTypes { |
| 45 #if SK_ANGLE | 45 #if SK_ANGLE |
| 46 kAngle_DeviceType, | 46 kAngle_DeviceType, |
| 47 #endif | 47 #endif |
| 48 #if SK_COMMAND_BUFFER |
| 49 kCommandBuffer_DeviceType, |
| 50 #endif |
| 48 #if SK_MESA | 51 #if SK_MESA |
| 49 kMesa_DeviceType, | 52 kMesa_DeviceType, |
| 50 #endif | 53 #endif |
| 51 kBitmap_DeviceType, | 54 kBitmap_DeviceType, |
| 52 #if SK_SUPPORT_GPU | 55 #if SK_SUPPORT_GPU |
| 53 kGPU_DeviceType, | 56 kGPU_DeviceType, |
| 54 kNVPR_DeviceType, | 57 kNVPR_DeviceType, |
| 55 #endif | 58 #endif |
| 56 }; | 59 }; |
| 57 | 60 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Already set to GrContextFactory::kNative_GLContextType, above
. | 192 // Already set to GrContextFactory::kNative_GLContextType, above
. |
| 190 break; | 193 break; |
| 191 case kNVPR_DeviceType: | 194 case kNVPR_DeviceType: |
| 192 glContextType = GrContextFactory::kNVPR_GLContextType; | 195 glContextType = GrContextFactory::kNVPR_GLContextType; |
| 193 break; | 196 break; |
| 194 #if SK_ANGLE | 197 #if SK_ANGLE |
| 195 case kAngle_DeviceType: | 198 case kAngle_DeviceType: |
| 196 glContextType = GrContextFactory::kANGLE_GLContextType; | 199 glContextType = GrContextFactory::kANGLE_GLContextType; |
| 197 break; | 200 break; |
| 198 #endif | 201 #endif |
| 202 #if SK_COMMAND_BUFFER |
| 203 case kCommandBuffer_DeviceType: |
| 204 glContextType = GrContextFactory::kCommandBuffer_GLContextType; |
| 205 break; |
| 206 #endif |
| 199 #if SK_MESA | 207 #if SK_MESA |
| 200 case kMesa_DeviceType: | 208 case kMesa_DeviceType: |
| 201 glContextType = GrContextFactory::kMESA_GLContextType; | 209 glContextType = GrContextFactory::kMESA_GLContextType; |
| 202 break; | 210 break; |
| 203 #endif | 211 #endif |
| 204 #endif | 212 #endif |
| 205 default: | 213 default: |
| 206 // Invalid device type. | 214 // Invalid device type. |
| 207 return false; | 215 return false; |
| 208 } | 216 } |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 } | 289 } |
| 282 break; | 290 break; |
| 283 case kNVPR_DeviceType: | 291 case kNVPR_DeviceType: |
| 284 config.appendf("_nvprmsaa%d", fSampleCount); | 292 config.appendf("_nvprmsaa%d", fSampleCount); |
| 285 break; | 293 break; |
| 286 #if SK_ANGLE | 294 #if SK_ANGLE |
| 287 case kAngle_DeviceType: | 295 case kAngle_DeviceType: |
| 288 config.append("_angle"); | 296 config.append("_angle"); |
| 289 break; | 297 break; |
| 290 #endif | 298 #endif |
| 299 #if SK_COMMAND_BUFFER |
| 300 case kCommandBuffer_DeviceType: |
| 301 config.append("_commandbuffer"); |
| 302 break; |
| 303 #endif |
| 291 #if SK_MESA | 304 #if SK_MESA |
| 292 case kMesa_DeviceType: | 305 case kMesa_DeviceType: |
| 293 config.append("_mesa"); | 306 config.append("_mesa"); |
| 294 break; | 307 break; |
| 295 #endif | 308 #endif |
| 296 default: | 309 default: |
| 297 // Assume that no extra info means bitmap. | 310 // Assume that no extra info means bitmap. |
| 298 break; | 311 break; |
| 299 } | 312 } |
| 300 #endif | 313 #endif |
| (...skipping 29 matching lines...) Expand all Loading... |
| 330 case kNVPR_DeviceType: | 343 case kNVPR_DeviceType: |
| 331 tmp = "nvprmsaa"; | 344 tmp = "nvprmsaa"; |
| 332 tmp.appendS32(fSampleCount); | 345 tmp.appendS32(fSampleCount); |
| 333 result["config"] = tmp.c_str(); | 346 result["config"] = tmp.c_str(); |
| 334 break; | 347 break; |
| 335 #if SK_ANGLE | 348 #if SK_ANGLE |
| 336 case kAngle_DeviceType: | 349 case kAngle_DeviceType: |
| 337 result["config"] = "angle"; | 350 result["config"] = "angle"; |
| 338 break; | 351 break; |
| 339 #endif | 352 #endif |
| 353 #if SK_COMMAND_BUFFER |
| 354 case kCommandBuffer_DeviceType: |
| 355 result["config"] = "commandbuffer"; |
| 356 break; |
| 357 #endif |
| 340 #if SK_MESA | 358 #if SK_MESA |
| 341 case kMesa_DeviceType: | 359 case kMesa_DeviceType: |
| 342 result["config"] = "mesa"; | 360 result["config"] = "mesa"; |
| 343 break; | 361 break; |
| 344 #endif | 362 #endif |
| 345 default: | 363 default: |
| 346 // Assume that no extra info means bitmap. | 364 // Assume that no extra info means bitmap. |
| 347 break; | 365 break; |
| 348 } | 366 } |
| 349 #endif | 367 #endif |
| 350 return result; | 368 return result; |
| 351 } | 369 } |
| 352 | 370 |
| 353 #if SK_SUPPORT_GPU | 371 #if SK_SUPPORT_GPU |
| 354 bool isUsingGpuDevice() { | 372 bool isUsingGpuDevice() { |
| 355 switch (fDeviceType) { | 373 switch (fDeviceType) { |
| 356 case kGPU_DeviceType: | 374 case kGPU_DeviceType: |
| 357 case kNVPR_DeviceType: | 375 case kNVPR_DeviceType: |
| 358 // fall through | 376 // fall through |
| 359 #if SK_ANGLE | 377 #if SK_ANGLE |
| 360 case kAngle_DeviceType: | 378 case kAngle_DeviceType: |
| 361 // fall through | 379 // fall through |
| 362 #endif | 380 #endif |
| 381 #if SK_COMMAND_BUFFER |
| 382 case kCommandBuffer_DeviceType: |
| 383 // fall through |
| 384 #endif |
| 363 #if SK_MESA | 385 #if SK_MESA |
| 364 case kMesa_DeviceType: | 386 case kMesa_DeviceType: |
| 365 #endif | 387 #endif |
| 366 return true; | 388 return true; |
| 367 default: | 389 default: |
| 368 return false; | 390 return false; |
| 369 } | 391 } |
| 370 } | 392 } |
| 371 | 393 |
| 372 SkGLContext* getGLContext() { | 394 SkGLContext* getGLContext() { |
| 373 GrContextFactory::GLContextType glContextType | 395 GrContextFactory::GLContextType glContextType |
| 374 = GrContextFactory::kNull_GLContextType; | 396 = GrContextFactory::kNull_GLContextType; |
| 375 switch(fDeviceType) { | 397 switch(fDeviceType) { |
| 376 case kGPU_DeviceType: | 398 case kGPU_DeviceType: |
| 377 glContextType = GrContextFactory::kNative_GLContextType; | 399 glContextType = GrContextFactory::kNative_GLContextType; |
| 378 break; | 400 break; |
| 379 case kNVPR_DeviceType: | 401 case kNVPR_DeviceType: |
| 380 glContextType = GrContextFactory::kNVPR_GLContextType; | 402 glContextType = GrContextFactory::kNVPR_GLContextType; |
| 381 break; | 403 break; |
| 382 #if SK_ANGLE | 404 #if SK_ANGLE |
| 383 case kAngle_DeviceType: | 405 case kAngle_DeviceType: |
| 384 glContextType = GrContextFactory::kANGLE_GLContextType; | 406 glContextType = GrContextFactory::kANGLE_GLContextType; |
| 385 break; | 407 break; |
| 386 #endif | 408 #endif |
| 409 #if SK_COMMAND_BUFFER |
| 410 case kCommandBuffer_DeviceType: |
| 411 glContextType = GrContextFactory::kCommandBuffer_GLContextType; |
| 412 break; |
| 413 #endif |
| 387 #if SK_MESA | 414 #if SK_MESA |
| 388 case kMesa_DeviceType: | 415 case kMesa_DeviceType: |
| 389 glContextType = GrContextFactory::kMESA_GLContextType; | 416 glContextType = GrContextFactory::kMESA_GLContextType; |
| 390 break; | 417 break; |
| 391 #endif | 418 #endif |
| 392 default: | 419 default: |
| 393 return nullptr; | 420 return nullptr; |
| 394 } | 421 } |
| 395 return fGrContextFactory.getGLContext(glContextType); | 422 return fGrContextFactory.getGLContext(glContextType); |
| 396 } | 423 } |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 746 |
| 720 #if SK_SUPPORT_GPU | 747 #if SK_SUPPORT_GPU |
| 721 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& op
ts); | 748 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& op
ts); |
| 722 #else | 749 #else |
| 723 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 750 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 724 #endif | 751 #endif |
| 725 | 752 |
| 726 } | 753 } |
| 727 | 754 |
| 728 #endif // PictureRenderer_DEFINED | 755 #endif // PictureRenderer_DEFINED |
| OLD | NEW |