| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 * @param mismatchPath The output directory within which this renderer shoul
d write any images | 89 * @param mismatchPath The output directory within which this renderer shoul
d write any images |
| 90 * which do not match expectations, or NULL if this renderer should not
write mismatches. | 90 * which do not match expectations, or NULL if this renderer should not
write mismatches. |
| 91 * @param inputFilename The name of the input file we are rendering. | 91 * @param inputFilename The name of the input file we are rendering. |
| 92 * @param useChecksumBasedFilenames Whether to use checksum-based filenames
when writing | 92 * @param useChecksumBasedFilenames Whether to use checksum-based filenames
when writing |
| 93 * bitmap images to disk. | 93 * bitmap images to disk. |
| 94 */ | 94 */ |
| 95 virtual void init(SkPicture* pict, const SkString* writePath, const SkString
* mismatchPath, | 95 virtual void init(SkPicture* pict, const SkString* writePath, const SkString
* mismatchPath, |
| 96 const SkString* inputFilename, bool useChecksumBasedFilena
mes); | 96 const SkString* inputFilename, bool useChecksumBasedFilena
mes); |
| 97 | 97 |
| 98 /** | 98 /** |
| 99 * TODO(epoger): Temporary hack, while we work on http://skbug.com/2584 ('be
nch_pictures is |
| 100 * timing reading pixels and writing json files'), such that: |
| 101 * - render_pictures can call this method and continue to work |
| 102 * - any other callers (bench_pictures) will skip calls to write() by defaul
t |
| 103 */ |
| 104 void enableWrites() { fEnableWrites = true; } |
| 105 |
| 106 /** |
| 99 * Set the viewport so that only the portion listed gets drawn. | 107 * Set the viewport so that only the portion listed gets drawn. |
| 100 */ | 108 */ |
| 101 void setViewport(SkISize size) { fViewport = size; } | 109 void setViewport(SkISize size) { fViewport = size; } |
| 102 | 110 |
| 103 /** | 111 /** |
| 104 * Set the scale factor at which draw the picture. | 112 * Set the scale factor at which draw the picture. |
| 105 */ | 113 */ |
| 106 void setScaleFactor(SkScalar scale) { fScaleFactor = scale; } | 114 void setScaleFactor(SkScalar scale) { fScaleFactor = scale; } |
| 107 | 115 |
| 108 /** | 116 /** |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 return fCanvas; | 346 return fCanvas; |
| 339 } | 347 } |
| 340 | 348 |
| 341 SkPicture* getPicture() { | 349 SkPicture* getPicture() { |
| 342 return fPicture; | 350 return fPicture; |
| 343 } | 351 } |
| 344 | 352 |
| 345 PictureRenderer() | 353 PictureRenderer() |
| 346 : fJsonSummaryPtr(NULL) | 354 : fJsonSummaryPtr(NULL) |
| 347 , fDeviceType(kBitmap_DeviceType) | 355 , fDeviceType(kBitmap_DeviceType) |
| 356 , fEnableWrites(false) |
| 348 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 357 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
| 349 , fScaleFactor(SK_Scalar1) | 358 , fScaleFactor(SK_Scalar1) |
| 350 #if SK_SUPPORT_GPU | 359 #if SK_SUPPORT_GPU |
| 351 , fGrContext(NULL) | 360 , fGrContext(NULL) |
| 352 , fSampleCount(0) | 361 , fSampleCount(0) |
| 353 #endif | 362 #endif |
| 354 { | 363 { |
| 355 fGridInfo.fMargin.setEmpty(); | 364 fGridInfo.fMargin.setEmpty(); |
| 356 fGridInfo.fOffset.setZero(); | 365 fGridInfo.fOffset.setZero(); |
| 357 fGridInfo.fTileInterval.set(1, 1); | 366 fGridInfo.fTileInterval.set(1, 1); |
| 358 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 367 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
| 359 fViewport.set(0, 0); | 368 fViewport.set(0, 0); |
| 360 } | 369 } |
| 361 | 370 |
| 362 #if SK_SUPPORT_GPU | 371 #if SK_SUPPORT_GPU |
| 363 virtual ~PictureRenderer() { | 372 virtual ~PictureRenderer() { |
| 364 SkSafeUnref(fGrContext); | 373 SkSafeUnref(fGrContext); |
| 365 } | 374 } |
| 366 #endif | 375 #endif |
| 367 | 376 |
| 368 protected: | 377 protected: |
| 369 SkAutoTUnref<SkCanvas> fCanvas; | 378 SkAutoTUnref<SkCanvas> fCanvas; |
| 370 SkAutoTUnref<SkPicture> fPicture; | 379 SkAutoTUnref<SkPicture> fPicture; |
| 371 bool fUseChecksumBasedFilenames; | 380 bool fUseChecksumBasedFilenames; |
| 372 ImageResultsAndExpectations* fJsonSummaryPtr; | 381 ImageResultsAndExpectations* fJsonSummaryPtr; |
| 373 SkDeviceTypes fDeviceType; | 382 SkDeviceTypes fDeviceType; |
| 383 bool fEnableWrites; |
| 374 BBoxHierarchyType fBBoxHierarchyType; | 384 BBoxHierarchyType fBBoxHierarchyType; |
| 375 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; | 385 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; |
| 376 SkString fDrawFiltersConfig; | 386 SkString fDrawFiltersConfig; |
| 377 SkString fWritePath; | 387 SkString fWritePath; |
| 378 SkString fMismatchPath; | 388 SkString fMismatchPath; |
| 379 SkString fInputFilename; | 389 SkString fInputFilename; |
| 380 SkTileGridFactory::TileGridInfo fGridInfo; // used when fBBoxHierarchyType i
s TileGrid | 390 SkTileGridFactory::TileGridInfo fGridInfo; // used when fBBoxHierarchyType i
s TileGrid |
| 381 | 391 |
| 382 void buildBBoxHierarchy(); | 392 void buildBBoxHierarchy(); |
| 383 | 393 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 648 |
| 639 typedef PictureRenderer INHERITED; | 649 typedef PictureRenderer INHERITED; |
| 640 }; | 650 }; |
| 641 | 651 |
| 642 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 652 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 643 extern PictureRenderer* CreatePictureCloneRenderer(); | 653 extern PictureRenderer* CreatePictureCloneRenderer(); |
| 644 | 654 |
| 645 } | 655 } |
| 646 | 656 |
| 647 #endif // PictureRenderer_DEFINED | 657 #endif // PictureRenderer_DEFINED |
| OLD | NEW |