blob: df38faa3de4a9bb4758a42b6e906e0ebd203dd75 [file] [log] [blame]
caryclark@google.com411bb722012-11-06 21:29:16 +00001/*
keyar@chromium.org451bb9f2012-07-26 17:27:57 +00002 * 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 PictureRenderer_DEFINED
9#define PictureRenderer_DEFINED
scroggo@google.coma62da2f2012-11-02 21:28:12 +000010
11#include "SkCountdown.h"
caryclark@google.coma3622372012-11-06 21:26:13 +000012#include "SkDrawFilter.h"
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +000013#include "SkMath.h"
reed@google.comea6a3062012-11-06 22:14:54 +000014#include "SkPaint.h"
scroggo@google.com9a412522012-09-07 15:21:18 +000015#include "SkPicture.h"
scroggo@google.comacfb30e2012-09-18 14:32:35 +000016#include "SkRect.h"
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000017#include "SkRefCnt.h"
scroggo@google.coma62da2f2012-11-02 21:28:12 +000018#include "SkRunnable.h"
scroggo@google.com9a412522012-09-07 15:21:18 +000019#include "SkString.h"
scroggo@google.coma62da2f2012-11-02 21:28:12 +000020#include "SkTDArray.h"
21#include "SkThreadPool.h"
22#include "SkTypes.h"
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000023
keyar@chromium.org06125642012-08-20 15:03:33 +000024#if SK_SUPPORT_GPU
25#include "GrContextFactory.h"
26#include "GrContext.h"
27#endif
28
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000029class SkBitmap;
30class SkCanvas;
keyar@chromium.org4ea96c52012-08-20 15:03:29 +000031class SkGLContext;
scroggo@google.coma62da2f2012-11-02 21:28:12 +000032class SkThread;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000033
34namespace sk_tools {
35
scroggo@google.comcbcef702012-12-13 22:09:28 +000036class TiledPictureRenderer;
37
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000038class PictureRenderer : public SkRefCnt {
scroggo@google.comcbcef702012-12-13 22:09:28 +000039
keyar@chromium.org451bb9f2012-07-26 17:27:57 +000040public:
keyar@chromium.orgc81686c2012-08-20 15:04:04 +000041 enum SkDeviceTypes {
42 kBitmap_DeviceType,
43#if SK_SUPPORT_GPU
44 kGPU_DeviceType
45#endif
46 };
47
junov@chromium.org9313ca42012-11-02 18:11:49 +000048 enum BBoxHierarchyType {
49 kNone_BBoxHierarchyType = 0,
50 kRTree_BBoxHierarchyType,
junov@chromium.org7b537062012-11-06 18:58:43 +000051 kTileGrid_BBoxHierarchyType,
junov@chromium.org9313ca42012-11-02 18:11:49 +000052 };
53
caryclark@google.coma3622372012-11-06 21:26:13 +000054 // this uses SkPaint::Flags as a base and adds additional flags
55 enum DrawFilterFlags {
56 kNone_DrawFilterFlag = 0,
caryclark@google.come3e940c2012-11-07 16:42:17 +000057 kBlur_DrawFilterFlag = 0x4000, // toggles between blur and no blur
reed@google.com457d8a72012-12-18 18:20:44 +000058 kHinting_DrawFilterFlag = 0x8000, // toggles between no hinting and normal hinting
59 kSlightHinting_DrawFilterFlag = 0x10000, // toggles between slight and normal hinting
60 kAAClip_DrawFilterFlag = 0x20000, // toggles between soft and hard clip
caryclark@google.coma3622372012-11-06 21:26:13 +000061 };
62
63 SK_COMPILE_ASSERT(!(kBlur_DrawFilterFlag & SkPaint::kAllFlags), blur_flag_must_be_greater);
64 SK_COMPILE_ASSERT(!(kHinting_DrawFilterFlag & SkPaint::kAllFlags),
65 hinting_flag_must_be_greater);
66 SK_COMPILE_ASSERT(!(kSlightHinting_DrawFilterFlag & SkPaint::kAllFlags),
67 slight_hinting_flag_must_be_greater);
68
scroggo@google.coma62da2f2012-11-02 21:28:12 +000069 /**
70 * Called with each new SkPicture to render.
71 */
keyar@chromium.org9d696c02012-08-07 17:11:33 +000072 virtual void init(SkPicture* pict);
scroggo@google.com9a412522012-09-07 15:21:18 +000073
74 /**
scroggo@google.comc0d5e542012-12-13 21:40:48 +000075 * Set the viewport so that only the portion listed gets drawn.
76 */
77 void setViewport(SkISize size) { fViewport = size; }
78
79 /**
scroggo@google.com82ec0b02012-12-17 19:25:54 +000080 * Set the scale factor at which draw the picture.
81 */
82 void setScaleFactor(SkScalar scale) { fScaleFactor = scale; }
83
84 /**
scroggo@google.com9a412522012-09-07 15:21:18 +000085 * Perform any setup that should done prior to each iteration of render() which should not be
86 * timed.
87 */
88 virtual void setup() {}
89
90 /**
91 * Perform work that is to be timed. Typically this is rendering, but is also used for recording
92 * and preparing picture for playback by the subclasses which do those.
scroggo@google.com81f9d2e2012-09-20 14:54:21 +000093 * If path is non-null, subclass implementations should call write().
94 * @param path If non-null, also write the output to the file specified by path. path should
95 * have no extension; it will be added by write().
borenet@google.com070d3542012-10-26 13:26:55 +000096 * @return bool True if rendering succeeded and, if path is non-null, the output was
97 * successfully written to a file.
scroggo@google.com9a412522012-09-07 15:21:18 +000098 */
edisonn@google.com84f548c2012-12-18 22:24:03 +000099 virtual bool render(const SkString* path, SkBitmap** out = NULL) = 0;
scroggo@google.com9a412522012-09-07 15:21:18 +0000100
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000101 /**
102 * Called once finished with a particular SkPicture, before calling init again, and before
103 * being done with this Renderer.
104 */
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000105 virtual void end();
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000106
scroggo@google.comcbcef702012-12-13 22:09:28 +0000107 /**
108 * If this PictureRenderer is actually a TiledPictureRender, return a pointer to this as a
109 * TiledPictureRender so its methods can be called.
110 */
111 virtual TiledPictureRenderer* getTiledRenderer() { return NULL; }
112
scroggo@google.com08085f82013-01-28 20:40:24 +0000113 /**
114 * Resets the GPU's state. Does nothing if the backing is raster. For a GPU renderer, calls
115 * flush, and calls finish if callFinish is true.
116 * @param callFinish Whether to call finish.
117 */
118 void resetState(bool callFinish);
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000119
keyar@chromium.orgc81686c2012-08-20 15:04:04 +0000120 void setDeviceType(SkDeviceTypes deviceType) {
121 fDeviceType = deviceType;
keyar@chromium.orgfe6391a2012-08-20 15:03:41 +0000122 }
123
caryclark@google.come3e940c2012-11-07 16:42:17 +0000124 void setDrawFilters(DrawFilterFlags const * const filters, const SkString& configName) {
125 memcpy(fDrawFilters, filters, sizeof(fDrawFilters));
caryclark@google.coma3622372012-11-06 21:26:13 +0000126 fDrawFiltersConfig = configName;
127 }
128
junov@chromium.org9313ca42012-11-02 18:11:49 +0000129 void setBBoxHierarchyType(BBoxHierarchyType bbhType) {
130 fBBoxHierarchyType = bbhType;
131 }
132
junov@chromium.org7b537062012-11-06 18:58:43 +0000133 void setGridSize(int width, int height) {
134 fGridWidth = width;
135 fGridHeight = height;
136 }
137
keyar@chromium.orgfe6391a2012-08-20 15:03:41 +0000138 bool isUsingBitmapDevice() {
keyar@chromium.org78a35c52012-08-20 15:03:44 +0000139 return kBitmap_DeviceType == fDeviceType;
keyar@chromium.org4ea96c52012-08-20 15:03:29 +0000140 }
141
scroggo@google.com9a412522012-09-07 15:21:18 +0000142 virtual SkString getPerIterTimeFormat() { return SkString("%.2f"); }
143
144 virtual SkString getNormalTimeFormat() { return SkString("%6.2f"); }
145
scroggo@google.com0a049b82012-11-02 22:01:26 +0000146 /**
147 * Reports the configuration of this PictureRenderer.
148 */
149 SkString getConfigName() {
150 SkString config = this->getConfigNameInternal();
scroggo@google.comc4013c12012-12-13 22:07:08 +0000151 if (!fViewport.isEmpty()) {
152 config.appendf("_viewport_%ix%i", fViewport.width(), fViewport.height());
153 }
scroggo@google.com0a049b82012-11-02 22:01:26 +0000154 if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) {
155 config.append("_rtree");
junov@chromium.org7b537062012-11-06 18:58:43 +0000156 } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) {
157 config.append("_grid");
scroggo@google.com0a049b82012-11-02 22:01:26 +0000158 }
159#if SK_SUPPORT_GPU
160 if (this->isUsingGpuDevice()) {
161 config.append("_gpu");
162 }
163#endif
caryclark@google.coma3622372012-11-06 21:26:13 +0000164 config.append(fDrawFiltersConfig.c_str());
scroggo@google.com0a049b82012-11-02 22:01:26 +0000165 return config;
166 }
167
keyar@chromium.org4ea96c52012-08-20 15:03:29 +0000168#if SK_SUPPORT_GPU
keyar@chromium.orgfe6391a2012-08-20 15:03:41 +0000169 bool isUsingGpuDevice() {
keyar@chromium.org78a35c52012-08-20 15:03:44 +0000170 return kGPU_DeviceType == fDeviceType;
keyar@chromium.orgfe6391a2012-08-20 15:03:41 +0000171 }
keyar@chromium.org77a55222012-08-20 15:03:47 +0000172
173 SkGLContext* getGLContext() {
174 if (this->isUsingGpuDevice()) {
175 return fGrContextFactory.getGLContext(GrContextFactory::kNative_GLContextType);
176 } else {
177 return NULL;
178 }
179 }
robertphillips@google.com163c84b2012-09-13 15:40:37 +0000180
181 GrContext* getGrContext() {
182 return fGrContext;
183 }
keyar@chromium.org4ea96c52012-08-20 15:03:29 +0000184#endif
185
keyar@chromium.org02dfb122012-08-20 15:03:36 +0000186 PictureRenderer()
keyar@chromium.org06125642012-08-20 15:03:33 +0000187 : fPicture(NULL)
188 , fDeviceType(kBitmap_DeviceType)
junov@chromium.org50ff9bd2012-11-02 19:16:22 +0000189 , fBBoxHierarchyType(kNone_BBoxHierarchyType)
junov@chromium.org7b537062012-11-06 18:58:43 +0000190 , fGridWidth(0)
191 , fGridHeight(0)
keyar@chromium.org06125642012-08-20 15:03:33 +0000192#if SK_SUPPORT_GPU
193 , fGrContext(fGrContextFactory.get(GrContextFactory::kNative_GLContextType))
194#endif
mike@reedtribe.org3af2b8d2012-12-24 18:26:43 +0000195 , fScaleFactor(SK_Scalar1)
caryclark@google.come3e940c2012-11-07 16:42:17 +0000196 {
197 sk_bzero(fDrawFilters, sizeof(fDrawFilters));
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000198 fViewport.set(0, 0);
caryclark@google.come3e940c2012-11-07 16:42:17 +0000199 }
keyar@chromium.org06125642012-08-20 15:03:33 +0000200
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000201protected:
202 SkAutoTUnref<SkCanvas> fCanvas;
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000203 SkPicture* fPicture;
204 SkDeviceTypes fDeviceType;
205 BBoxHierarchyType fBBoxHierarchyType;
206 DrawFilterFlags fDrawFilters[SkDrawFilter::kTypeCount];
207 SkString fDrawFiltersConfig;
208 int fGridWidth, fGridHeight; // used when fBBoxHierarchyType is TileGrid
keyar@chromium.org06125642012-08-20 15:03:33 +0000209
210#if SK_SUPPORT_GPU
211 GrContextFactory fGrContextFactory;
212 GrContext* fGrContext;
213#endif
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000214
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000215 void buildBBoxHierarchy();
216
217 /**
218 * Return the total width that should be drawn. If the viewport width has been set greater than
219 * 0, this will be the minimum of the current SkPicture's width and the viewport's width.
220 */
221 int getViewWidth();
222
223 /**
224 * Return the total height that should be drawn. If the viewport height has been set greater
225 * than 0, this will be the minimum of the current SkPicture's height and the viewport's height.
226 */
227 int getViewHeight();
228
scroggo@google.com82ec0b02012-12-17 19:25:54 +0000229 /**
230 * Scales the provided canvas to the scale factor set by setScaleFactor.
231 */
232 void scaleToScaleFactor(SkCanvas*);
233
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000234 SkPicture* createPicture();
235 uint32_t recordFlags();
236 SkCanvas* setupCanvas();
237 virtual SkCanvas* setupCanvas(int width, int height);
238
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000239private:
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000240 SkISize fViewport;
scroggo@google.com82ec0b02012-12-17 19:25:54 +0000241 SkScalar fScaleFactor;
scroggo@google.comc0d5e542012-12-13 21:40:48 +0000242
scroggo@google.com0a049b82012-11-02 22:01:26 +0000243 virtual SkString getConfigNameInternal() = 0;
244
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000245 typedef SkRefCnt INHERITED;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000246};
247
scroggo@google.com9a412522012-09-07 15:21:18 +0000248/**
249 * This class does not do any rendering, but its render function executes recording, which we want
250 * to time.
251 */
252class RecordPictureRenderer : public PictureRenderer {
edisonn@google.com84f548c2012-12-18 22:24:03 +0000253 virtual bool render(const SkString*, SkBitmap** out = NULL) SK_OVERRIDE;
scroggo@google.com9a412522012-09-07 15:21:18 +0000254
255 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); }
256
257 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); }
scroggo@google.com0a049b82012-11-02 22:01:26 +0000258
djsollen@google.comfd9720c2012-11-06 16:54:40 +0000259protected:
260 virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE;
261
scroggo@google.com0a049b82012-11-02 22:01:26 +0000262private:
263 virtual SkString getConfigNameInternal() SK_OVERRIDE;
scroggo@google.com9a412522012-09-07 15:21:18 +0000264};
265
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000266class PipePictureRenderer : public PictureRenderer {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000267public:
edisonn@google.com84f548c2012-12-18 22:24:03 +0000268 virtual bool render(const SkString*, SkBitmap** out = NULL) SK_OVERRIDE;
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000269
270private:
scroggo@google.com0a049b82012-11-02 22:01:26 +0000271 virtual SkString getConfigNameInternal() SK_OVERRIDE;
272
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000273 typedef PictureRenderer INHERITED;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000274};
275
276class SimplePictureRenderer : public PictureRenderer {
keyar@chromium.org163b5672012-08-01 17:53:29 +0000277public:
junov@chromium.org9313ca42012-11-02 18:11:49 +0000278 virtual void init(SkPicture* pict) SK_OVERRIDE;
279
edisonn@google.com84f548c2012-12-18 22:24:03 +0000280 virtual bool render(const SkString*, SkBitmap** out = NULL) SK_OVERRIDE;
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000281
282private:
scroggo@google.com0a049b82012-11-02 22:01:26 +0000283 virtual SkString getConfigNameInternal() SK_OVERRIDE;
284
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000285 typedef PictureRenderer INHERITED;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000286};
287
288class TiledPictureRenderer : public PictureRenderer {
289public:
290 TiledPictureRenderer();
291
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000292 virtual void init(SkPicture* pict) SK_OVERRIDE;
scroggo@google.com81f9d2e2012-09-20 14:54:21 +0000293
scroggo@google.com81f9d2e2012-09-20 14:54:21 +0000294 /**
295 * Renders to tiles, rather than a single canvas. If a path is provided, a separate file is
296 * created for each tile, named "path0.png", "path1.png", etc.
297 * Multithreaded mode currently does not support writing to a file.
298 */
edisonn@google.com84f548c2012-12-18 22:24:03 +0000299 virtual bool render(const SkString* path, SkBitmap** out = NULL) SK_OVERRIDE;
scroggo@google.com81f9d2e2012-09-20 14:54:21 +0000300
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000301 virtual void end() SK_OVERRIDE;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000302
keyar@chromium.orgcc6e5ef2012-07-27 20:09:26 +0000303 void setTileWidth(int width) {
304 fTileWidth = width;
305 }
306
307 int getTileWidth() const {
308 return fTileWidth;
309 }
310
311 void setTileHeight(int height) {
312 fTileHeight = height;
313 }
314
315 int getTileHeight() const {
316 return fTileHeight;
317 }
318
319 void setTileWidthPercentage(double percentage) {
320 fTileWidthPercentage = percentage;
321 }
322
keyar@chromium.org163b5672012-08-01 17:53:29 +0000323 double getTileWidthPercentage() const {
keyar@chromium.orgcc6e5ef2012-07-27 20:09:26 +0000324 return fTileWidthPercentage;
325 }
326
327 void setTileHeightPercentage(double percentage) {
328 fTileHeightPercentage = percentage;
329 }
330
keyar@chromium.org163b5672012-08-01 17:53:29 +0000331 double getTileHeightPercentage() const {
keyar@chromium.orgcc6e5ef2012-07-27 20:09:26 +0000332 return fTileHeightPercentage;
333 }
334
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000335 void setTileMinPowerOf2Width(int width) {
336 SkASSERT(SkIsPow2(width) && width > 0);
337 if (!SkIsPow2(width) || width <= 0) {
338 return;
339 }
340
341 fTileMinPowerOf2Width = width;
342 }
343
344 int getTileMinPowerOf2Width() const {
345 return fTileMinPowerOf2Width;
346 }
347
scroggo@google.comcbcef702012-12-13 22:09:28 +0000348 virtual TiledPictureRenderer* getTiledRenderer() SK_OVERRIDE { return this; }
349
350 /**
351 * Report the number of tiles in the x and y directions. Must not be called before init.
352 * @param x Output parameter identifying the number of tiles in the x direction.
353 * @param y Output parameter identifying the number of tiles in the y direction.
354 * @return True if the tiles have been set up, and x and y are meaningful. If false, x and y are
355 * unmodified.
356 */
357 bool tileDimensions(int& x, int&y);
358
359 /**
360 * Move to the next tile and return its indices. Must be called before calling drawCurrentTile
361 * for the first time.
362 * @param i Output parameter identifying the column of the next tile to be drawn on the next
363 * call to drawNextTile.
364 * @param j Output parameter identifying the row of the next tile to be drawn on the next call
365 * to drawNextTile.
366 * @param True if the tiles have been created and the next tile to be drawn by drawCurrentTile
367 * is within the range of tiles. If false, i and j are unmodified.
368 */
369 bool nextTile(int& i, int& j);
370
371 /**
372 * Render one tile. This will draw the same tile each time it is called until nextTile is
373 * called. The tile rendered will depend on how many calls have been made to nextTile.
374 * It is an error to call this without first calling nextTile, or if nextTile returns false.
375 */
376 void drawCurrentTile();
377
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000378protected:
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000379 SkTDArray<SkRect> fTileRects;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000380
scroggo@google.com0a049b82012-11-02 22:01:26 +0000381 virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE;
382 virtual SkString getConfigNameInternal() SK_OVERRIDE;
383
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000384private:
scroggo@google.comcbcef702012-12-13 22:09:28 +0000385 int fTileWidth;
386 int fTileHeight;
387 double fTileWidthPercentage;
388 double fTileHeightPercentage;
389 int fTileMinPowerOf2Width;
390
391 // These variables are only used for timing individual tiles.
392 // Next tile to draw in fTileRects.
393 int fCurrentTileOffset;
394 // Number of tiles in the x direction.
395 int fTilesX;
396 // Number of tiles in the y direction.
397 int fTilesY;
scroggo@google.combcdf2ec2012-09-20 14:42:33 +0000398
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000399 void setupTiles();
keyar@chromium.orgf4959ab2012-08-23 20:53:25 +0000400 void setupPowerOf2Tiles();
keyar@chromium.org9d696c02012-08-07 17:11:33 +0000401
402 typedef PictureRenderer INHERITED;
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000403};
404
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000405class CloneData;
406
407class MultiCorePictureRenderer : public TiledPictureRenderer {
408public:
409 explicit MultiCorePictureRenderer(int threadCount);
410
411 ~MultiCorePictureRenderer();
412
413 virtual void init(SkPicture* pict) SK_OVERRIDE;
414
415 /**
416 * Behaves like TiledPictureRenderer::render(), only using multiple threads.
417 */
edisonn@google.com84f548c2012-12-18 22:24:03 +0000418 virtual bool render(const SkString* path, SkBitmap** out = NULL) SK_OVERRIDE;
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000419
420 virtual void end() SK_OVERRIDE;
421
422private:
scroggo@google.com0a049b82012-11-02 22:01:26 +0000423 virtual SkString getConfigNameInternal() SK_OVERRIDE;
424
scroggo@google.coma62da2f2012-11-02 21:28:12 +0000425 const int fNumThreads;
426 SkTDArray<SkCanvas*> fCanvasPool;
427 SkThreadPool fThreadPool;
428 SkPicture* fPictureClones;
429 CloneData** fCloneData;
430 SkCountdown fCountdown;
431
432 typedef TiledPictureRenderer INHERITED;
433};
434
scroggo@google.com9a412522012-09-07 15:21:18 +0000435/**
436 * This class does not do any rendering, but its render function executes turning an SkPictureRecord
437 * into an SkPicturePlayback, which we want to time.
438 */
439class PlaybackCreationRenderer : public PictureRenderer {
440public:
441 virtual void setup() SK_OVERRIDE;
442
edisonn@google.com84f548c2012-12-18 22:24:03 +0000443 virtual bool render(const SkString*, SkBitmap** out = NULL) SK_OVERRIDE;
scroggo@google.com9a412522012-09-07 15:21:18 +0000444
445 virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); }
446
447 virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); }
448
449private:
junov@chromium.org9313ca42012-11-02 18:11:49 +0000450 SkAutoTUnref<SkPicture> fReplayer;
scroggo@google.com0a049b82012-11-02 22:01:26 +0000451
452 virtual SkString getConfigNameInternal() SK_OVERRIDE;
453
scroggo@google.com9a412522012-09-07 15:21:18 +0000454 typedef PictureRenderer INHERITED;
455};
456
reed@google.comfe7b1ed2012-11-29 21:00:39 +0000457extern PictureRenderer* CreateGatherPixelRefsRenderer();
reed@google.com5a34fd32012-12-10 16:05:09 +0000458extern PictureRenderer* CreatePictureCloneRenderer();
reed@google.comfe7b1ed2012-11-29 21:00:39 +0000459
keyar@chromium.org451bb9f2012-07-26 17:27:57 +0000460}
461
462#endif // PictureRenderer_DEFINED