| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 /** | 494 /** |
| 495 * This class does not do any rendering, but its render function executes record
ing, which we want | 495 * This class does not do any rendering, but its render function executes record
ing, which we want |
| 496 * to time. | 496 * to time. |
| 497 */ | 497 */ |
| 498 class RecordPictureRenderer : public PictureRenderer { | 498 class RecordPictureRenderer : public PictureRenderer { |
| 499 public: | 499 public: |
| 500 #if SK_SUPPORT_GPU | 500 #if SK_SUPPORT_GPU |
| 501 RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } | 501 RecordPictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } |
| 502 #endif | 502 #endif |
| 503 | 503 |
| 504 bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 504 bool render(SkBitmap** out = NULL) override; |
| 505 | 505 |
| 506 SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); } | 506 SkString getPerIterTimeFormat() override { return SkString("%.4f"); } |
| 507 | 507 |
| 508 SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); } | 508 SkString getNormalTimeFormat() override { return SkString("%6.4f"); } |
| 509 | 509 |
| 510 protected: | 510 protected: |
| 511 SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE; | 511 SkCanvas* setupCanvas(int width, int height) override; |
| 512 | 512 |
| 513 private: | 513 private: |
| 514 SkString getConfigNameInternal() SK_OVERRIDE; | 514 SkString getConfigNameInternal() override; |
| 515 | 515 |
| 516 typedef PictureRenderer INHERITED; | 516 typedef PictureRenderer INHERITED; |
| 517 }; | 517 }; |
| 518 | 518 |
| 519 class PipePictureRenderer : public PictureRenderer { | 519 class PipePictureRenderer : public PictureRenderer { |
| 520 public: | 520 public: |
| 521 #if SK_SUPPORT_GPU | 521 #if SK_SUPPORT_GPU |
| 522 PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } | 522 PipePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } |
| 523 #endif | 523 #endif |
| 524 | 524 |
| 525 bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 525 bool render(SkBitmap** out = NULL) override; |
| 526 | 526 |
| 527 private: | 527 private: |
| 528 SkString getConfigNameInternal() SK_OVERRIDE; | 528 SkString getConfigNameInternal() override; |
| 529 | 529 |
| 530 typedef PictureRenderer INHERITED; | 530 typedef PictureRenderer INHERITED; |
| 531 }; | 531 }; |
| 532 | 532 |
| 533 class SimplePictureRenderer : public PictureRenderer { | 533 class SimplePictureRenderer : public PictureRenderer { |
| 534 public: | 534 public: |
| 535 #if SK_SUPPORT_GPU | 535 #if SK_SUPPORT_GPU |
| 536 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } | 536 SimplePictureRenderer(const GrContext::Options &opts) : INHERITED(opts) { } |
| 537 #endif | 537 #endif |
| 538 | 538 |
| 539 virtual void init(const SkPicture* pict, | 539 virtual void init(const SkPicture* pict, |
| 540 const SkString* writePath, | 540 const SkString* writePath, |
| 541 const SkString* mismatchPath, | 541 const SkString* mismatchPath, |
| 542 const SkString* inputFilename, | 542 const SkString* inputFilename, |
| 543 bool useChecksumBasedFilenames, | 543 bool useChecksumBasedFilenames, |
| 544 bool useMultiPictureDraw) SK_OVERRIDE; | 544 bool useMultiPictureDraw) override; |
| 545 | 545 |
| 546 bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 546 bool render(SkBitmap** out = NULL) override; |
| 547 | 547 |
| 548 private: | 548 private: |
| 549 SkString getConfigNameInternal() SK_OVERRIDE; | 549 SkString getConfigNameInternal() override; |
| 550 | 550 |
| 551 typedef PictureRenderer INHERITED; | 551 typedef PictureRenderer INHERITED; |
| 552 }; | 552 }; |
| 553 | 553 |
| 554 class TiledPictureRenderer : public PictureRenderer { | 554 class TiledPictureRenderer : public PictureRenderer { |
| 555 public: | 555 public: |
| 556 #if SK_SUPPORT_GPU | 556 #if SK_SUPPORT_GPU |
| 557 TiledPictureRenderer(const GrContext::Options &opts); | 557 TiledPictureRenderer(const GrContext::Options &opts); |
| 558 #else | 558 #else |
| 559 TiledPictureRenderer(); | 559 TiledPictureRenderer(); |
| 560 #endif | 560 #endif |
| 561 | 561 |
| 562 virtual void init(const SkPicture* pict, | 562 virtual void init(const SkPicture* pict, |
| 563 const SkString* writePath, | 563 const SkString* writePath, |
| 564 const SkString* mismatchPath, | 564 const SkString* mismatchPath, |
| 565 const SkString* inputFilename, | 565 const SkString* inputFilename, |
| 566 bool useChecksumBasedFilenames, | 566 bool useChecksumBasedFilenames, |
| 567 bool useMultiPictureDraw) SK_OVERRIDE; | 567 bool useMultiPictureDraw) override; |
| 568 | 568 |
| 569 /** | 569 /** |
| 570 * Renders to tiles, rather than a single canvas. | 570 * Renders to tiles, rather than a single canvas. |
| 571 * If fWritePath was provided, a separate file is | 571 * If fWritePath was provided, a separate file is |
| 572 * created for each tile, named "path0.png", "path1.png", etc. | 572 * created for each tile, named "path0.png", "path1.png", etc. |
| 573 */ | 573 */ |
| 574 bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 574 bool render(SkBitmap** out = NULL) override; |
| 575 | 575 |
| 576 void end() SK_OVERRIDE; | 576 void end() override; |
| 577 | 577 |
| 578 void setTileWidth(int width) { | 578 void setTileWidth(int width) { |
| 579 fTileWidth = width; | 579 fTileWidth = width; |
| 580 } | 580 } |
| 581 | 581 |
| 582 int getTileWidth() const { | 582 int getTileWidth() const { |
| 583 return fTileWidth; | 583 return fTileWidth; |
| 584 } | 584 } |
| 585 | 585 |
| 586 void setTileHeight(int height) { | 586 void setTileHeight(int height) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 613 return; | 613 return; |
| 614 } | 614 } |
| 615 | 615 |
| 616 fTileMinPowerOf2Width = width; | 616 fTileMinPowerOf2Width = width; |
| 617 } | 617 } |
| 618 | 618 |
| 619 int getTileMinPowerOf2Width() const { | 619 int getTileMinPowerOf2Width() const { |
| 620 return fTileMinPowerOf2Width; | 620 return fTileMinPowerOf2Width; |
| 621 } | 621 } |
| 622 | 622 |
| 623 TiledPictureRenderer* getTiledRenderer() SK_OVERRIDE { return this; } | 623 TiledPictureRenderer* getTiledRenderer() override { return this; } |
| 624 | 624 |
| 625 virtual bool supportsTimingIndividualTiles() { return true; } | 625 virtual bool supportsTimingIndividualTiles() { return true; } |
| 626 | 626 |
| 627 /** | 627 /** |
| 628 * Report the number of tiles in the x and y directions. Must not be called
before init. | 628 * Report the number of tiles in the x and y directions. Must not be called
before init. |
| 629 * @param x Output parameter identifying the number of tiles in the x direct
ion. | 629 * @param x Output parameter identifying the number of tiles in the x direct
ion. |
| 630 * @param y Output parameter identifying the number of tiles in the y direct
ion. | 630 * @param y Output parameter identifying the number of tiles in the y direct
ion. |
| 631 * @return True if the tiles have been set up, and x and y are meaningful. I
f false, x and y are | 631 * @return True if the tiles have been set up, and x and y are meaningful. I
f false, x and y are |
| 632 * unmodified. | 632 * unmodified. |
| 633 */ | 633 */ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 648 /** | 648 /** |
| 649 * Render one tile. This will draw the same tile each time it is called unti
l nextTile is | 649 * Render one tile. This will draw the same tile each time it is called unti
l nextTile is |
| 650 * called. The tile rendered will depend on how many calls have been made to
nextTile. | 650 * called. The tile rendered will depend on how many calls have been made to
nextTile. |
| 651 * It is an error to call this without first calling nextTile, or if nextTil
e returns false. | 651 * It is an error to call this without first calling nextTile, or if nextTil
e returns false. |
| 652 */ | 652 */ |
| 653 void drawCurrentTile(); | 653 void drawCurrentTile(); |
| 654 | 654 |
| 655 protected: | 655 protected: |
| 656 SkTDArray<SkIRect> fTileRects; | 656 SkTDArray<SkIRect> fTileRects; |
| 657 | 657 |
| 658 SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE; | 658 SkCanvas* setupCanvas(int width, int height) override; |
| 659 SkString getConfigNameInternal() SK_OVERRIDE; | 659 SkString getConfigNameInternal() override; |
| 660 | 660 |
| 661 private: | 661 private: |
| 662 int fTileWidth; | 662 int fTileWidth; |
| 663 int fTileHeight; | 663 int fTileHeight; |
| 664 double fTileWidthPercentage; | 664 double fTileWidthPercentage; |
| 665 double fTileHeightPercentage; | 665 double fTileHeightPercentage; |
| 666 int fTileMinPowerOf2Width; | 666 int fTileMinPowerOf2Width; |
| 667 | 667 |
| 668 // These variables are only used for timing individual tiles. | 668 // These variables are only used for timing individual tiles. |
| 669 // Next tile to draw in fTileRects. | 669 // Next tile to draw in fTileRects. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 685 /** | 685 /** |
| 686 * This class does not do any rendering, but its render function executes turnin
g an SkPictureRecord | 686 * This class does not do any rendering, but its render function executes turnin
g an SkPictureRecord |
| 687 * into an SkPicturePlayback, which we want to time. | 687 * into an SkPicturePlayback, which we want to time. |
| 688 */ | 688 */ |
| 689 class PlaybackCreationRenderer : public PictureRenderer { | 689 class PlaybackCreationRenderer : public PictureRenderer { |
| 690 public: | 690 public: |
| 691 #if SK_SUPPORT_GPU | 691 #if SK_SUPPORT_GPU |
| 692 PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) {
} | 692 PlaybackCreationRenderer(const GrContext::Options &opts) : INHERITED(opts) {
} |
| 693 #endif | 693 #endif |
| 694 | 694 |
| 695 void setup() SK_OVERRIDE; | 695 void setup() override; |
| 696 | 696 |
| 697 bool render(SkBitmap** out = NULL) SK_OVERRIDE; | 697 bool render(SkBitmap** out = NULL) override; |
| 698 | 698 |
| 699 SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); } | 699 SkString getPerIterTimeFormat() override { return SkString("%.4f"); } |
| 700 | 700 |
| 701 SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); } | 701 SkString getNormalTimeFormat() override { return SkString("%6.4f"); } |
| 702 | 702 |
| 703 private: | 703 private: |
| 704 SkAutoTDelete<SkPictureRecorder> fRecorder; | 704 SkAutoTDelete<SkPictureRecorder> fRecorder; |
| 705 | 705 |
| 706 SkString getConfigNameInternal() SK_OVERRIDE; | 706 SkString getConfigNameInternal() override; |
| 707 | 707 |
| 708 typedef PictureRenderer INHERITED; | 708 typedef PictureRenderer INHERITED; |
| 709 }; | 709 }; |
| 710 | 710 |
| 711 #if SK_SUPPORT_GPU | 711 #if SK_SUPPORT_GPU |
| 712 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); | 712 extern PictureRenderer* CreateGatherPixelRefsRenderer(const GrContext::Options&
opts); |
| 713 #else | 713 #else |
| 714 extern PictureRenderer* CreateGatherPixelRefsRenderer(); | 714 extern PictureRenderer* CreateGatherPixelRefsRenderer(); |
| 715 #endif | 715 #endif |
| 716 | 716 |
| 717 } | 717 } |
| 718 | 718 |
| 719 #endif // PictureRenderer_DEFINED | 719 #endif // PictureRenderer_DEFINED |
| OLD | NEW |