| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 fGrContext->ref(); | 213 fGrContext->ref(); |
| 214 return true; | 214 return true; |
| 215 } | 215 } |
| 216 #endif | 216 #endif |
| 217 } | 217 } |
| 218 | 218 |
| 219 #if SK_SUPPORT_GPU | 219 #if SK_SUPPORT_GPU |
| 220 void setSampleCount(int sampleCount) { | 220 void setSampleCount(int sampleCount) { |
| 221 fSampleCount = sampleCount; | 221 fSampleCount = sampleCount; |
| 222 } | 222 } |
| 223 |
| 224 void setUseDFText(bool useDFText) { |
| 225 fUseDFText = useDFText; |
| 226 } |
| 223 #endif | 227 #endif |
| 224 | 228 |
| 225 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { | 229 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { |
| 226 memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); | 230 memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); |
| 227 fDrawFiltersConfig = configName; | 231 fDrawFiltersConfig = configName; |
| 228 } | 232 } |
| 229 | 233 |
| 230 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { | 234 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { |
| 231 fBBoxHierarchyType = bbhType; | 235 fBBoxHierarchyType = bbhType; |
| 232 } | 236 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 config.append("_"); | 271 config.append("_"); |
| 268 config.appendS32(fGridInfo.fTileInterval.width()); | 272 config.appendS32(fGridInfo.fTileInterval.width()); |
| 269 config.append("x"); | 273 config.append("x"); |
| 270 config.appendS32(fGridInfo.fTileInterval.height()); | 274 config.appendS32(fGridInfo.fTileInterval.height()); |
| 271 } | 275 } |
| 272 #if SK_SUPPORT_GPU | 276 #if SK_SUPPORT_GPU |
| 273 switch (fDeviceType) { | 277 switch (fDeviceType) { |
| 274 case kGPU_DeviceType: | 278 case kGPU_DeviceType: |
| 275 if (fSampleCount) { | 279 if (fSampleCount) { |
| 276 config.appendf("_msaa%d", fSampleCount); | 280 config.appendf("_msaa%d", fSampleCount); |
| 281 } else if (fUseDFText) { |
| 282 config.append("_gpudft"); |
| 277 } else { | 283 } else { |
| 278 config.append("_gpu"); | 284 config.append("_gpu"); |
| 279 } | 285 } |
| 280 break; | 286 break; |
| 281 case kNVPR_DeviceType: | 287 case kNVPR_DeviceType: |
| 282 config.appendf("_nvprmsaa%d", fSampleCount); | 288 config.appendf("_nvprmsaa%d", fSampleCount); |
| 283 break; | 289 break; |
| 284 #if SK_ANGLE | 290 #if SK_ANGLE |
| 285 case kAngle_DeviceType: | 291 case kAngle_DeviceType: |
| 286 config.append("_angle"); | 292 config.append("_angle"); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 result["bbh"] = tmp.c_str(); | 324 result["bbh"] = tmp.c_str(); |
| 319 } | 325 } |
| 320 #if SK_SUPPORT_GPU | 326 #if SK_SUPPORT_GPU |
| 321 SkString tmp; | 327 SkString tmp; |
| 322 switch (fDeviceType) { | 328 switch (fDeviceType) { |
| 323 case kGPU_DeviceType: | 329 case kGPU_DeviceType: |
| 324 if (0 != fSampleCount) { | 330 if (0 != fSampleCount) { |
| 325 tmp = "msaa"; | 331 tmp = "msaa"; |
| 326 tmp.appendS32(fSampleCount); | 332 tmp.appendS32(fSampleCount); |
| 327 result["config"] = tmp.c_str(); | 333 result["config"] = tmp.c_str(); |
| 334 } else if (fUseDFText) { |
| 335 result["config"] = "gpudft"; |
| 328 } else { | 336 } else { |
| 329 result["config"] = "gpu"; | 337 result["config"] = "gpu"; |
| 330 } | 338 } |
| 331 break; | 339 break; |
| 332 case kNVPR_DeviceType: | 340 case kNVPR_DeviceType: |
| 333 tmp = "nvprmsaa"; | 341 tmp = "nvprmsaa"; |
| 334 tmp.appendS32(fSampleCount); | 342 tmp.appendS32(fSampleCount); |
| 335 result["config"] = tmp.c_str(); | 343 result["config"] = tmp.c_str(); |
| 336 break; | 344 break; |
| 337 #if SK_ANGLE | 345 #if SK_ANGLE |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 #endif | 429 #endif |
| 422 : fJsonSummaryPtr(NULL) | 430 : fJsonSummaryPtr(NULL) |
| 423 , fDeviceType(kBitmap_DeviceType) | 431 , fDeviceType(kBitmap_DeviceType) |
| 424 , fEnableWrites(false) | 432 , fEnableWrites(false) |
| 425 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 433 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
| 426 , fScaleFactor(SK_Scalar1) | 434 , fScaleFactor(SK_Scalar1) |
| 427 #if SK_SUPPORT_GPU | 435 #if SK_SUPPORT_GPU |
| 428 , fGrContextFactory(opts) | 436 , fGrContextFactory(opts) |
| 429 , fGrContext(NULL) | 437 , fGrContext(NULL) |
| 430 , fSampleCount(0) | 438 , fSampleCount(0) |
| 439 , fUseDFText(false) |
| 431 #endif | 440 #endif |
| 432 { | 441 { |
| 433 fGridInfo.fMargin.setEmpty(); | 442 fGridInfo.fMargin.setEmpty(); |
| 434 fGridInfo.fOffset.setZero(); | 443 fGridInfo.fOffset.setZero(); |
| 435 fGridInfo.fTileInterval.set(1, 1); | 444 fGridInfo.fTileInterval.set(1, 1); |
| 436 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 445 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
| 437 fViewport.set(0, 0); | 446 fViewport.set(0, 0); |
| 438 } | 447 } |
| 439 | 448 |
| 440 #if SK_SUPPORT_GPU | 449 #if SK_SUPPORT_GPU |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 */ | 497 */ |
| 489 static void CopyString(SkString* dest, const SkString* src); | 498 static void CopyString(SkString* dest, const SkString* src); |
| 490 | 499 |
| 491 private: | 500 private: |
| 492 SkISize fViewport; | 501 SkISize fViewport; |
| 493 SkScalar fScaleFactor; | 502 SkScalar fScaleFactor; |
| 494 #if SK_SUPPORT_GPU | 503 #if SK_SUPPORT_GPU |
| 495 GrContextFactory fGrContextFactory; | 504 GrContextFactory fGrContextFactory; |
| 496 GrContext* fGrContext; | 505 GrContext* fGrContext; |
| 497 int fSampleCount; | 506 int fSampleCount; |
| 507 bool fUseDFText; |
| 498 #endif | 508 #endif |
| 499 | 509 |
| 500 virtual SkString getConfigNameInternal() = 0; | 510 virtual SkString getConfigNameInternal() = 0; |
| 501 | 511 |
| 502 typedef SkRefCnt INHERITED; | 512 typedef SkRefCnt INHERITED; |
| 503 }; | 513 }; |
| 504 | 514 |
| 505 /** | 515 /** |
| 506 * This class does not do any rendering, but its render function executes record
ing, which we want | 516 * This class does not do any rendering, but its render function executes record
ing, which we want |
| 507 * to time. | 517 * to time. |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 731 |
| 722 #if SK_SUPPORT_GPU | 732 #if SK_SUPPORT_GPU |
| 723 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); | 733 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); |
| 724 #else | 734 #else |
| 725 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 735 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 726 #endif | 736 #endif |
| 727 | 737 |
| 728 } | 738 } |
| 729 | 739 |
| 730 #endif // PictureRenderer_DEFINED | 740 #endif // PictureRenderer_DEFINED |
| OLD | NEW |