blob: b24414223c15be0d336aa7b4c0f1256960030f5f [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:
krajcevskib1aded82014-08-18 07:52:17 -070025#if SK_SUPPORT_GPU
26 CopyTilesRenderer(const GrContext::Options &opts, int x, int y);
27#else
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000028 CopyTilesRenderer(int x, int y);
krajcevskib1aded82014-08-18 07:52:17 -070029#endif
robertphillipsce4dd3d2014-07-07 13:46:35 -070030 virtual void init(const SkPicture* pict,
31 const SkString* writePath,
32 const SkString* mismatchPath,
commit-bot@chromium.org3f045172014-05-15 15:10:48 +000033 const SkString* inputFilename,
commit-bot@chromium.orgf5e315c2014-03-19 17:26:07 +000034 bool useChecksumBasedFilenames) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000035
36 /**
37 * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the
38 * numbering (and actual tiles) will be different.
39 */
commit-bot@chromium.orgf5e315c2014-03-19 17:26:07 +000040 virtual bool render(SkBitmap** out) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000041
scroggo@google.com161e1ba2013-03-04 16:41:06 +000042 virtual bool supportsTimingIndividualTiles() SK_OVERRIDE { return false; }
43
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000044 private:
45 int fXTilesPerLargeTile;
46 int fYTilesPerLargeTile;
47
48 int fLargeTileWidth;
49 int fLargeTileHeight;
50
51 virtual SkString getConfigNameInternal() SK_OVERRIDE;
52
53 typedef TiledPictureRenderer INHERITED;
54 };
55} // sk_tools
56#endif // CopyTilesRenderer_DEFINED