scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef CopyTilesRenderer_DEFINED |
| 9 | #define CopyTilesRenderer_DEFINED |
| 10 | |
| 11 | #include "PictureRenderer.h" |
| 12 | #include "SkTypes.h" |
| 13 | |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 14 | struct GrContextOptions; |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 15 | class SkPicture; |
| 16 | class SkString; |
| 17 | |
| 18 | namespace sk_tools { |
| 19 | /** |
| 20 | * PictureRenderer that draws the picture and then extracts it into tiles. For large pictures, |
| 21 | * it will divide the picture into large tiles and draw the picture once for each large tile. |
| 22 | */ |
| 23 | class CopyTilesRenderer : public TiledPictureRenderer { |
| 24 | |
| 25 | public: |
krajcevski | b1aded8 | 2014-08-18 07:52:17 -0700 | [diff] [blame] | 26 | #if SK_SUPPORT_GPU |
bsalomon | 682c269 | 2015-05-22 14:01:46 -0700 | [diff] [blame] | 27 | CopyTilesRenderer(const GrContextOptions &opts, int x, int y); |
krajcevski | b1aded8 | 2014-08-18 07:52:17 -0700 | [diff] [blame] | 28 | #else |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 29 | CopyTilesRenderer(int x, int y); |
krajcevski | b1aded8 | 2014-08-18 07:52:17 -0700 | [diff] [blame] | 30 | #endif |
robertphillips | ce4dd3d | 2014-07-07 13:46:35 -0700 | [diff] [blame] | 31 | virtual void init(const SkPicture* pict, |
| 32 | const SkString* writePath, |
| 33 | const SkString* mismatchPath, |
commit-bot@chromium.org | 3f04517 | 2014-05-15 15:10:48 +0000 | [diff] [blame] | 34 | const SkString* inputFilename, |
robertphillips | 78c7127 | 2014-10-09 04:59:19 -0700 | [diff] [blame] | 35 | bool useChecksumBasedFilenames, |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 36 | bool useMultiPictureDraw) override; |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the |
| 40 | * numbering (and actual tiles) will be different. |
| 41 | */ |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 42 | bool render(SkBitmap** out) override; |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 43 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 44 | bool supportsTimingIndividualTiles() override { return false; } |
scroggo@google.com | 161e1ba | 2013-03-04 16:41:06 +0000 | [diff] [blame] | 45 | |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 46 | private: |
| 47 | int fXTilesPerLargeTile; |
| 48 | int fYTilesPerLargeTile; |
| 49 | |
| 50 | int fLargeTileWidth; |
| 51 | int fLargeTileHeight; |
| 52 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 53 | SkString getConfigNameInternal() override; |
scroggo@google.com | 4a26d9d | 2012-11-07 18:01:46 +0000 | [diff] [blame] | 54 | |
| 55 | typedef TiledPictureRenderer INHERITED; |
| 56 | }; |
| 57 | } // sk_tools |
| 58 | #endif // CopyTilesRenderer_DEFINED |