| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 Json::Value fActualResultsNoComparison; | 62 Json::Value fActualResultsNoComparison; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class PictureRenderer : public SkRefCnt { | 65 class PictureRenderer : public SkRefCnt { |
| 66 | 66 |
| 67 public: | 67 public: |
| 68 enum SkDeviceTypes { | 68 enum SkDeviceTypes { |
| 69 #if SK_ANGLE | 69 #if SK_ANGLE |
| 70 kAngle_DeviceType, | 70 kAngle_DeviceType, |
| 71 #endif | 71 #endif |
| 72 #if SK_MESA |
| 73 kMesa_DeviceType, |
| 74 #endif |
| 72 kBitmap_DeviceType, | 75 kBitmap_DeviceType, |
| 73 #if SK_SUPPORT_GPU | 76 #if SK_SUPPORT_GPU |
| 74 kGPU_DeviceType, | 77 kGPU_DeviceType, |
| 75 #endif | 78 #endif |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 enum BBoxHierarchyType { | 81 enum BBoxHierarchyType { |
| 79 kNone_BBoxHierarchyType = 0, | 82 kNone_BBoxHierarchyType = 0, |
| 80 kRTree_BBoxHierarchyType, | 83 kRTree_BBoxHierarchyType, |
| 81 kTileGrid_BBoxHierarchyType, | 84 kTileGrid_BBoxHierarchyType, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 return true; | 173 return true; |
| 171 #if SK_SUPPORT_GPU | 174 #if SK_SUPPORT_GPU |
| 172 case kGPU_DeviceType: | 175 case kGPU_DeviceType: |
| 173 // Already set to GrContextFactory::kNative_GLContextType, above
. | 176 // Already set to GrContextFactory::kNative_GLContextType, above
. |
| 174 break; | 177 break; |
| 175 #if SK_ANGLE | 178 #if SK_ANGLE |
| 176 case kAngle_DeviceType: | 179 case kAngle_DeviceType: |
| 177 glContextType = GrContextFactory::kANGLE_GLContextType; | 180 glContextType = GrContextFactory::kANGLE_GLContextType; |
| 178 break; | 181 break; |
| 179 #endif | 182 #endif |
| 183 #if SK_MESA |
| 184 case kMesa_DeviceType: |
| 185 glContextType = GrContextFactory::kMESA_GLContextType; |
| 186 break; |
| 187 #endif |
| 180 #endif | 188 #endif |
| 181 default: | 189 default: |
| 182 // Invalid device type. | 190 // Invalid device type. |
| 183 return false; | 191 return false; |
| 184 } | 192 } |
| 185 #if SK_SUPPORT_GPU | 193 #if SK_SUPPORT_GPU |
| 186 fGrContext = fGrContextFactory.get(glContextType); | 194 fGrContext = fGrContextFactory.get(glContextType); |
| 187 if (NULL == fGrContext) { | 195 if (NULL == fGrContext) { |
| 188 return false; | 196 return false; |
| 189 } else { | 197 } else { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 config.appendf("_msaa%d", fSampleCount); | 257 config.appendf("_msaa%d", fSampleCount); |
| 250 } else { | 258 } else { |
| 251 config.append("_gpu"); | 259 config.append("_gpu"); |
| 252 } | 260 } |
| 253 break; | 261 break; |
| 254 #if SK_ANGLE | 262 #if SK_ANGLE |
| 255 case kAngle_DeviceType: | 263 case kAngle_DeviceType: |
| 256 config.append("_angle"); | 264 config.append("_angle"); |
| 257 break; | 265 break; |
| 258 #endif | 266 #endif |
| 267 #if SK_MESA |
| 268 case kMesa_DeviceType: |
| 269 config.append("_mesa"); |
| 270 break; |
| 271 #endif |
| 259 default: | 272 default: |
| 260 // Assume that no extra info means bitmap. | 273 // Assume that no extra info means bitmap. |
| 261 break; | 274 break; |
| 262 } | 275 } |
| 263 #endif | 276 #endif |
| 264 config.append(fDrawFiltersConfig.c_str()); | 277 config.append(fDrawFiltersConfig.c_str()); |
| 265 return config; | 278 return config; |
| 266 } | 279 } |
| 267 | 280 |
| 268 #if SK_SUPPORT_GPU | 281 #if SK_SUPPORT_GPU |
| 269 bool isUsingGpuDevice() { | 282 bool isUsingGpuDevice() { |
| 270 switch (fDeviceType) { | 283 switch (fDeviceType) { |
| 271 case kGPU_DeviceType: | 284 case kGPU_DeviceType: |
| 272 // fall through | 285 // fall through |
| 273 #if SK_ANGLE | 286 #if SK_ANGLE |
| 274 case kAngle_DeviceType: | 287 case kAngle_DeviceType: |
| 288 // fall through |
| 289 #endif |
| 290 #if SK_MESA |
| 291 case kMesa_DeviceType: |
| 275 #endif | 292 #endif |
| 276 return true; | 293 return true; |
| 277 default: | 294 default: |
| 278 return false; | 295 return false; |
| 279 } | 296 } |
| 280 } | 297 } |
| 281 | 298 |
| 282 SkGLContextHelper* getGLContext() { | 299 SkGLContextHelper* getGLContext() { |
| 283 GrContextFactory::GLContextType glContextType | 300 GrContextFactory::GLContextType glContextType |
| 284 = GrContextFactory::kNull_GLContextType; | 301 = GrContextFactory::kNull_GLContextType; |
| 285 switch(fDeviceType) { | 302 switch(fDeviceType) { |
| 286 case kGPU_DeviceType: | 303 case kGPU_DeviceType: |
| 287 glContextType = GrContextFactory::kNative_GLContextType; | 304 glContextType = GrContextFactory::kNative_GLContextType; |
| 288 break; | 305 break; |
| 289 #if SK_ANGLE | 306 #if SK_ANGLE |
| 290 case kAngle_DeviceType: | 307 case kAngle_DeviceType: |
| 291 glContextType = GrContextFactory::kANGLE_GLContextType; | 308 glContextType = GrContextFactory::kANGLE_GLContextType; |
| 292 break; | 309 break; |
| 293 #endif | 310 #endif |
| 311 #if SK_MESA |
| 312 case kMesa_DeviceType: |
| 313 glContextType = GrContextFactory::kMESA_GLContextType; |
| 314 break; |
| 315 #endif |
| 294 default: | 316 default: |
| 295 return NULL; | 317 return NULL; |
| 296 } | 318 } |
| 297 return fGrContextFactory.getGLContext(glContextType); | 319 return fGrContextFactory.getGLContext(glContextType); |
| 298 } | 320 } |
| 299 | 321 |
| 300 GrContext* getGrContext() { | 322 GrContext* getGrContext() { |
| 301 return fGrContext; | 323 return fGrContext; |
| 302 } | 324 } |
| 303 #endif | 325 #endif |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 608 |
| 587 typedef PictureRenderer INHERITED; | 609 typedef PictureRenderer INHERITED; |
| 588 }; | 610 }; |
| 589 | 611 |
| 590 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 612 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 591 extern PictureRenderer* CreatePictureCloneRenderer(); | 613 extern PictureRenderer* CreatePictureCloneRenderer(); |
| 592 | 614 |
| 593 } | 615 } |
| 594 | 616 |
| 595 #endif // PictureRenderer_DEFINED | 617 #endif // PictureRenderer_DEFINED |
| OLD | NEW |