blob: ef1ccb09b4e4ebebece2015ac68138545c4bdd75 [file] [log] [blame]
scroggo@google.com4a26d9d2012-11-07 18:01:46 +00001/*
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
14class SkPicture;
15class SkString;
16
17namespace sk_tools {
18 /**
19 * PictureRenderer that draws the picture and then extracts it into tiles. For large pictures,
20 * it will divide the picture into large tiles and draw the picture once for each large tile.
21 */
22 class CopyTilesRenderer : public TiledPictureRenderer {
23
24 public:
25 CopyTilesRenderer(int x, int y);
commit-bot@chromium.orgf5e315c2014-03-19 17:26:07 +000026 virtual void init(SkPicture* pict, const SkString* outputDir, const SkString* inputFilename,
27 bool useChecksumBasedFilenames) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000028
29 /**
30 * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the
31 * numbering (and actual tiles) will be different.
32 */
commit-bot@chromium.orgf5e315c2014-03-19 17:26:07 +000033 virtual bool render(SkBitmap** out) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000034
scroggo@google.com161e1ba2013-03-04 16:41:06 +000035 virtual bool supportsTimingIndividualTiles() SK_OVERRIDE { return false; }
36
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000037 private:
38 int fXTilesPerLargeTile;
39 int fYTilesPerLargeTile;
40
41 int fLargeTileWidth;
42 int fLargeTileHeight;
43
44 virtual SkString getConfigNameInternal() SK_OVERRIDE;
45
46 typedef TiledPictureRenderer INHERITED;
47 };
48} // sk_tools
49#endif // CopyTilesRenderer_DEFINED