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