blob: 507e0fd2d4d4a2176dfe6a9c9b6b718420eb4952 [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,
robertphillips78c71272014-10-09 04:59:19 -070034 bool useChecksumBasedFilenames,
35 bool useMultiPictureDraw) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000036
37 /**
38 * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the
39 * numbering (and actual tiles) will be different.
40 */
mtklein72c9faa2015-01-09 10:06:39 -080041 bool render(SkBitmap** out) SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000042
mtklein72c9faa2015-01-09 10:06:39 -080043 bool supportsTimingIndividualTiles() SK_OVERRIDE { return false; }
scroggo@google.com161e1ba2013-03-04 16:41:06 +000044
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000045 private:
46 int fXTilesPerLargeTile;
47 int fYTilesPerLargeTile;
48
49 int fLargeTileWidth;
50 int fLargeTileHeight;
51
mtklein72c9faa2015-01-09 10:06:39 -080052 SkString getConfigNameInternal() SK_OVERRIDE;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000053
54 typedef TiledPictureRenderer INHERITED;
55 };
56} // sk_tools
57#endif // CopyTilesRenderer_DEFINED