blob: 5ff4175eede05ad9e399126407c5c346a9d4096d [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
bsalomon682c2692015-05-22 14:01:46 -070014struct GrContextOptions;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000015class SkPicture;
16class SkString;
17
18namespace 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:
krajcevskib1aded82014-08-18 07:52:17 -070026#if SK_SUPPORT_GPU
bsalomon682c2692015-05-22 14:01:46 -070027 CopyTilesRenderer(const GrContextOptions &opts, int x, int y);
krajcevskib1aded82014-08-18 07:52:17 -070028#else
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000029 CopyTilesRenderer(int x, int y);
krajcevskib1aded82014-08-18 07:52:17 -070030#endif
robertphillipsce4dd3d2014-07-07 13:46:35 -070031 virtual void init(const SkPicture* pict,
32 const SkString* writePath,
33 const SkString* mismatchPath,
commit-bot@chromium.org3f045172014-05-15 15:10:48 +000034 const SkString* inputFilename,
robertphillips78c71272014-10-09 04:59:19 -070035 bool useChecksumBasedFilenames,
mtklein36352bf2015-03-25 18:17:31 -070036 bool useMultiPictureDraw) override;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000037
38 /**
39 * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the
40 * numbering (and actual tiles) will be different.
41 */
mtklein36352bf2015-03-25 18:17:31 -070042 bool render(SkBitmap** out) override;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000043
mtklein36352bf2015-03-25 18:17:31 -070044 bool supportsTimingIndividualTiles() override { return false; }
scroggo@google.com161e1ba2013-03-04 16:41:06 +000045
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000046 private:
47 int fXTilesPerLargeTile;
48 int fYTilesPerLargeTile;
49
50 int fLargeTileWidth;
51 int fLargeTileHeight;
52
mtklein36352bf2015-03-25 18:17:31 -070053 SkString getConfigNameInternal() override;
scroggo@google.com4a26d9d2012-11-07 18:01:46 +000054
55 typedef TiledPictureRenderer INHERITED;
56 };
57} // sk_tools
58#endif // CopyTilesRenderer_DEFINED