| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 GrContext* getGrContext() { | 359 GrContext* getGrContext() { |
| 360 return fGrContext; | 360 return fGrContext; |
| 361 } | 361 } |
| 362 #endif | 362 #endif |
| 363 | 363 |
| 364 SkCanvas* getCanvas() { | 364 SkCanvas* getCanvas() { |
| 365 return fCanvas; | 365 return fCanvas; |
| 366 } | 366 } |
| 367 | 367 |
| 368 PictureRenderer() | 368 PictureRenderer() |
| 369 : fPicture(NULL) | 369 : fJsonSummaryPtr(NULL) |
| 370 , fJsonSummaryPtr(NULL) | |
| 371 , fDeviceType(kBitmap_DeviceType) | 370 , fDeviceType(kBitmap_DeviceType) |
| 372 , fBBoxHierarchyType(kNone_BBoxHierarchyType) | 371 , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
| 373 , fScaleFactor(SK_Scalar1) | 372 , fScaleFactor(SK_Scalar1) |
| 374 #if SK_SUPPORT_GPU | 373 #if SK_SUPPORT_GPU |
| 375 , fGrContext(NULL) | 374 , fGrContext(NULL) |
| 376 , fSampleCount(0) | 375 , fSampleCount(0) |
| 377 #endif | 376 #endif |
| 378 { | 377 { |
| 379 fGridInfo.fMargin.setEmpty(); | 378 fGridInfo.fMargin.setEmpty(); |
| 380 fGridInfo.fOffset.setZero(); | 379 fGridInfo.fOffset.setZero(); |
| 381 fGridInfo.fTileInterval.set(1, 1); | 380 fGridInfo.fTileInterval.set(1, 1); |
| 382 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); | 381 sk_bzero(fDrawFilters, sizeof(fDrawFilters)); |
| 383 fViewport.set(0, 0); | 382 fViewport.set(0, 0); |
| 384 } | 383 } |
| 385 | 384 |
| 386 #if SK_SUPPORT_GPU | 385 #if SK_SUPPORT_GPU |
| 387 virtual ~PictureRenderer() { | 386 virtual ~PictureRenderer() { |
| 388 SkSafeUnref(fGrContext); | 387 SkSafeUnref(fGrContext); |
| 389 } | 388 } |
| 390 #endif | 389 #endif |
| 391 | 390 |
| 392 protected: | 391 protected: |
| 393 SkAutoTUnref<SkCanvas> fCanvas; | 392 SkAutoTUnref<SkCanvas> fCanvas; |
| 394 SkPicture* fPicture; | 393 SkAutoTUnref<SkPicture> fPicture; |
| 395 bool fUseChecksumBasedFilenames; | 394 bool fUseChecksumBasedFilenames; |
| 396 ImageResultsSummary* fJsonSummaryPtr; | 395 ImageResultsSummary* fJsonSummaryPtr; |
| 397 SkDeviceTypes fDeviceType; | 396 SkDeviceTypes fDeviceType; |
| 398 BBoxHierarchyType fBBoxHierarchyType; | 397 BBoxHierarchyType fBBoxHierarchyType; |
| 399 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; | 398 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount]; |
| 400 SkString fDrawFiltersConfig; | 399 SkString fDrawFiltersConfig; |
| 401 SkString fOutputDir; | 400 SkString fOutputDir; |
| 402 SkString fInputFilename; | 401 SkString fInputFilename; |
| 403 SkTileGridPicture::TileGridInfo fGridInfo; // used when fBBoxHierarchyType i
s TileGrid | 402 SkTileGridPicture::TileGridInfo fGridInfo; // used when fBBoxHierarchyType i
s TileGrid |
| 404 | 403 |
| 405 void buildBBoxHierarchy(); | 404 void buildBBoxHierarchy(); |
| 406 | 405 |
| 407 /** | 406 /** |
| 408 * Return the total width that should be drawn. If the viewport width has be
en set greater than | 407 * Return the total width that should be drawn. If the viewport width has be
en set greater than |
| 409 * 0, this will be the minimum of the current SkPicture's width and the view
port's width. | 408 * 0, this will be the minimum of the current SkPicture's width and the view
port's width. |
| 410 */ | 409 */ |
| 411 int getViewWidth(); | 410 int getViewWidth(); |
| 412 | 411 |
| 413 /** | 412 /** |
| 414 * Return the total height that should be drawn. If the viewport height has
been set greater | 413 * Return the total height that should be drawn. If the viewport height has
been set greater |
| 415 * than 0, this will be the minimum of the current SkPicture's height and th
e viewport's height. | 414 * than 0, this will be the minimum of the current SkPicture's height and th
e viewport's height. |
| 416 */ | 415 */ |
| 417 int getViewHeight(); | 416 int getViewHeight(); |
| 418 | 417 |
| 419 /** | 418 /** |
| 420 * Scales the provided canvas to the scale factor set by setScaleFactor. | 419 * Scales the provided canvas to the scale factor set by setScaleFactor. |
| 421 */ | 420 */ |
| 422 void scaleToScaleFactor(SkCanvas*); | 421 void scaleToScaleFactor(SkCanvas*); |
| 423 | 422 |
| 424 SkPicture* createPicture(); | 423 SkPictureFactory* getFactory(); |
| 425 uint32_t recordFlags(); | 424 uint32_t recordFlags(); |
| 426 SkCanvas* setupCanvas(); | 425 SkCanvas* setupCanvas(); |
| 427 virtual SkCanvas* setupCanvas(int width, int height); | 426 virtual SkCanvas* setupCanvas(int width, int height); |
| 428 | 427 |
| 429 /** | 428 /** |
| 430 * Copy src to dest; if src==NULL, set dest to empty string. | 429 * Copy src to dest; if src==NULL, set dest to empty string. |
| 431 */ | 430 */ |
| 432 static void CopyString(SkString* dest, const SkString* src); | 431 static void CopyString(SkString* dest, const SkString* src); |
| 433 | 432 |
| 434 private: | 433 private: |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 public: | 647 public: |
| 649 virtual void setup() SK_OVERRIDE; | 648 virtual void setup() SK_OVERRIDE; |
| 650 | 649 |
| 651 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 650 virtual bool render(SkBitmap** out = NULL) SK_OVERRIDE; |
| 652 | 651 |
| 653 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"
); } | 652 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"
); } |
| 654 | 653 |
| 655 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"
); } | 654 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"
); } |
| 656 | 655 |
| 657 private: | 656 private: |
| 658 SkAutoTUnref<SkPicture> fReplayer; | 657 SkAutoTUnref<SkPictureRecorder> fRecorder; |
| 659 | 658 |
| 660 virtual SkString getConfigNameInternal() SK_OVERRIDE; | 659 virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 661 | 660 |
| 662 typedef PictureRenderer INHERITED; | 661 typedef PictureRenderer INHERITED; |
| 663 }; | 662 }; |
| 664 | 663 |
| 665 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 664 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 666 extern PictureRenderer* CreatePictureCloneRenderer(); | 665 extern PictureRenderer* CreatePictureCloneRenderer(); |
| 667 | 666 |
| 668 } | 667 } |
| 669 | 668 |
| 670 #endif // PictureRenderer_DEFINED | 669 #endif // PictureRenderer_DEFINED |
| OLD | NEW |