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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 void setSampleCount(int sampleCount) { | 220 void setSampleCount(int sampleCount) { |
221 fSampleCount = sampleCount; | 221 fSampleCount = sampleCount; |
222 } | 222 } |
223 | 223 |
224 void setUseDFText(bool useDFText) { | 224 void setUseDFText(bool useDFText) { |
225 fUseDFText = useDFText; | 225 fUseDFText = useDFText; |
226 } | 226 } |
227 #endif | 227 #endif |
228 | 228 |
229 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { | 229 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& c
onfigName) { |
230 memcpy(fDrawFilters, filters, sizeof(fDrawFilters)); | 230 fHasDrawFilters = false; |
231 fDrawFiltersConfig = configName; | 231 fDrawFiltersConfig = configName; |
| 232 |
| 233 for (size_t i = 0; i < SK_ARRAY_COUNT(fDrawFilters); ++i) { |
| 234 fDrawFilters[i] = filters[i]; |
| 235 fHasDrawFilters |= SkToBool(filters[i]); |
| 236 } |
232 } | 237 } |
233 | 238 |
234 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { | 239 void setBBoxHierarchyType(BBoxHierarchyType bbhType) { |
235 fBBoxHierarchyType = bbhType; | 240 fBBoxHierarchyType = bbhType; |
236 } | 241 } |
237 | 242 |
238 BBoxHierarchyType getBBoxHierarchyType() { return fBBoxHierarchyType; } | 243 BBoxHierarchyType getBBoxHierarchyType() { return fBBoxHierarchyType; } |
239 | 244 |
240 void setJsonSummaryPtr(ImageResultsAndExpectations* jsonSummaryPtr) { | 245 void setJsonSummaryPtr(ImageResultsAndExpectations* jsonSummaryPtr) { |
241 fJsonSummaryPtr = jsonSummaryPtr; | 246 fJsonSummaryPtr = jsonSummaryPtr; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 413 |
409 #if SK_SUPPORT_GPU | 414 #if SK_SUPPORT_GPU |
410 explicit PictureRenderer(const GrContextOptions &opts) | 415 explicit PictureRenderer(const GrContextOptions &opts) |
411 #else | 416 #else |
412 PictureRenderer() | 417 PictureRenderer() |
413 #endif | 418 #endif |
414 : fJsonSummaryPtr(NULL) | 419 : fJsonSummaryPtr(NULL) |
415 , fDeviceType(kBitmap_DeviceType) | 420 , fDeviceType(kBitmap_DeviceType) |
416 , fEnableWrites(false) | 421 , fEnableWrites(false) |
417 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 422 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
| 423 , fHasDrawFilters(false) |
418 , fScaleFactor(SK_Scalar1) | 424 , fScaleFactor(SK_Scalar1) |
419 #if SK_SUPPORT_GPU | 425 #if SK_SUPPORT_GPU |
420 , fGrContextFactory(opts) | 426 , fGrContextFactory(opts) |
421 , fGrContext(NULL) | 427 , fGrContext(NULL) |
422 , fSampleCount(0) | 428 , fSampleCount(0) |
423 , fUseDFText(false) | 429 , fUseDFText(false) |
424 #endif | 430 #endif |
425 { | 431 { |
426 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 432 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
427 fViewport.set(0, 0); | 433 fViewport.set(0, 0); |
428 } | 434 } |
429 | 435 |
430 #if SK_SUPPORT_GPU | 436 #if SK_SUPPORT_GPU |
431 virtual ~PictureRenderer() { | 437 virtual ~PictureRenderer() { |
432 SkSafeUnref(fGrContext); | 438 SkSafeUnref(fGrContext); |
433 } | 439 } |
434 #endif | 440 #endif |
435 | 441 |
436 protected: | 442 protected: |
437 SkAutoTUnref<SkCanvas> fCanvas; | 443 SkAutoTUnref<SkCanvas> fCanvas; |
438 SkAutoTUnref<const SkPicture> fPicture; | 444 SkAutoTUnref<const SkPicture> fPicture; |
439 bool fUseChecksumBasedFilenames; | 445 bool fUseChecksumBasedFilenames; |
440 bool fUseMultiPictureDraw; | 446 bool fUseMultiPictureDraw; |
441 ImageResultsAndExpectations* fJsonSummaryPtr; | 447 ImageResultsAndExpectations* fJsonSummaryPtr; |
442 SkDeviceTypes fDeviceType; | 448 SkDeviceTypes fDeviceType; |
443 bool fEnableWrites; | 449 bool fEnableWrites; |
444 BBoxHierarchyType fBBoxHierarchyType; | 450 BBoxHierarchyType fBBoxHierarchyType; |
| 451 bool fHasDrawFilters; |
445 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; | 452 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; |
446 SkString fDrawFiltersConfig; | 453 SkString fDrawFiltersConfig; |
447 SkString fWritePath; | 454 SkString fWritePath; |
448 SkString fMismatchPath; | 455 SkString fMismatchPath; |
449 SkString fInputFilename; | 456 SkString fInputFilename; |
450 | 457 |
451 void buildBBoxHierarchy(); | 458 void buildBBoxHierarchy(); |
452 | 459 |
453 /** | 460 /** |
454 * Return the total width that should be drawn. If the viewport width has be
en set greater than | 461 * Return the total width that should be drawn. If the viewport width has be
en set greater than |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 | 718 |
712 #if SK_SUPPORT_GPU | 719 #if SK_SUPPORT_GPU |
713 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& op
ts); | 720 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContextOptions& op
ts); |
714 #else | 721 #else |
715 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 722 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
716 #endif | 723 #endif |
717 | 724 |
718 } | 725 } |
719 | 726 |
720 #endif // PictureRenderer_DEFINED | 727 #endif // PictureRenderer_DEFINED |
OLD | NEW |