keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 1 | /* |
| 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 PictureRenderer_DEFINED |
| 9 | #define PictureRenderer_DEFINED |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 10 | |
| 11 | #include "SkCountdown.h" |
keyar@chromium.org | f4959ab | 2012-08-23 20:53:25 +0000 | [diff] [blame] | 12 | #include "SkMath.h" |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 13 | #include "SkPicture.h" |
scroggo@google.com | acfb30e | 2012-09-18 14:32:35 +0000 | [diff] [blame] | 14 | #include "SkRect.h" |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 15 | #include "SkRefCnt.h" |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 16 | #include "SkRunnable.h" |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 17 | #include "SkString.h" |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 18 | #include "SkTDArray.h" |
| 19 | #include "SkThreadPool.h" |
| 20 | #include "SkTypes.h" |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 21 | |
keyar@chromium.org | 0612564 | 2012-08-20 15:03:33 +0000 | [diff] [blame] | 22 | #if SK_SUPPORT_GPU |
| 23 | #include "GrContextFactory.h" |
| 24 | #include "GrContext.h" |
| 25 | #endif |
| 26 | |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 27 | class SkBitmap; |
| 28 | class SkCanvas; |
keyar@chromium.org | 4ea96c5 | 2012-08-20 15:03:29 +0000 | [diff] [blame] | 29 | class SkGLContext; |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 30 | class SkThread; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 31 | |
| 32 | namespace sk_tools { |
| 33 | |
| 34 | class PictureRenderer : public SkRefCnt { |
| 35 | public: |
keyar@chromium.org | c81686c | 2012-08-20 15:04:04 +0000 | [diff] [blame] | 36 | enum SkDeviceTypes { |
| 37 | kBitmap_DeviceType, |
| 38 | #if SK_SUPPORT_GPU |
| 39 | kGPU_DeviceType |
| 40 | #endif |
| 41 | }; |
| 42 | |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 43 | enum BBoxHierarchyType { |
| 44 | kNone_BBoxHierarchyType = 0, |
| 45 | kRTree_BBoxHierarchyType, |
junov@chromium.org | 7b53706 | 2012-11-06 18:58:43 +0000 | [diff] [blame^] | 46 | kTileGrid_BBoxHierarchyType, |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 47 | }; |
| 48 | |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 49 | /** |
| 50 | * Called with each new SkPicture to render. |
| 51 | */ |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 52 | virtual void init(SkPicture* pict); |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * Perform any setup that should done prior to each iteration of render() which should not be |
| 56 | * timed. |
| 57 | */ |
| 58 | virtual void setup() {} |
| 59 | |
| 60 | /** |
| 61 | * Perform work that is to be timed. Typically this is rendering, but is also used for recording |
| 62 | * and preparing picture for playback by the subclasses which do those. |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 63 | * If path is non-null, subclass implementations should call write(). |
| 64 | * @param path If non-null, also write the output to the file specified by path. path should |
| 65 | * have no extension; it will be added by write(). |
borenet@google.com | 070d354 | 2012-10-26 13:26:55 +0000 | [diff] [blame] | 66 | * @return bool True if rendering succeeded and, if path is non-null, the output was |
| 67 | * successfully written to a file. |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 68 | */ |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 69 | virtual bool render(const SkString* path) = 0; |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 70 | |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 71 | /** |
| 72 | * Called once finished with a particular SkPicture, before calling init again, and before |
| 73 | * being done with this Renderer. |
| 74 | */ |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 75 | virtual void end(); |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 76 | |
keyar@chromium.org | 28136b3 | 2012-08-20 15:04:15 +0000 | [diff] [blame] | 77 | void resetState(); |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 78 | |
keyar@chromium.org | c81686c | 2012-08-20 15:04:04 +0000 | [diff] [blame] | 79 | void setDeviceType(SkDeviceTypes deviceType) { |
| 80 | fDeviceType = deviceType; |
keyar@chromium.org | fe6391a | 2012-08-20 15:03:41 +0000 | [diff] [blame] | 81 | } |
| 82 | |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 83 | void setBBoxHierarchyType(BBoxHierarchyType bbhType) { |
| 84 | fBBoxHierarchyType = bbhType; |
| 85 | } |
| 86 | |
junov@chromium.org | 7b53706 | 2012-11-06 18:58:43 +0000 | [diff] [blame^] | 87 | void setGridSize(int width, int height) { |
| 88 | fGridWidth = width; |
| 89 | fGridHeight = height; |
| 90 | } |
| 91 | |
keyar@chromium.org | fe6391a | 2012-08-20 15:03:41 +0000 | [diff] [blame] | 92 | bool isUsingBitmapDevice() { |
keyar@chromium.org | 78a35c5 | 2012-08-20 15:03:44 +0000 | [diff] [blame] | 93 | return kBitmap_DeviceType == fDeviceType; |
keyar@chromium.org | 4ea96c5 | 2012-08-20 15:03:29 +0000 | [diff] [blame] | 94 | } |
| 95 | |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 96 | virtual SkString getPerIterTimeFormat() { return SkString("%.2f"); } |
| 97 | |
| 98 | virtual SkString getNormalTimeFormat() { return SkString("%6.2f"); } |
| 99 | |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 100 | /** |
| 101 | * Reports the configuration of this PictureRenderer. |
| 102 | */ |
| 103 | SkString getConfigName() { |
| 104 | SkString config = this->getConfigNameInternal(); |
| 105 | if (kRTree_BBoxHierarchyType == fBBoxHierarchyType) { |
| 106 | config.append("_rtree"); |
junov@chromium.org | 7b53706 | 2012-11-06 18:58:43 +0000 | [diff] [blame^] | 107 | } else if (kTileGrid_BBoxHierarchyType == fBBoxHierarchyType) { |
| 108 | config.append("_grid"); |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 109 | } |
| 110 | #if SK_SUPPORT_GPU |
| 111 | if (this->isUsingGpuDevice()) { |
| 112 | config.append("_gpu"); |
| 113 | } |
| 114 | #endif |
| 115 | return config; |
| 116 | } |
| 117 | |
keyar@chromium.org | 4ea96c5 | 2012-08-20 15:03:29 +0000 | [diff] [blame] | 118 | #if SK_SUPPORT_GPU |
keyar@chromium.org | fe6391a | 2012-08-20 15:03:41 +0000 | [diff] [blame] | 119 | bool isUsingGpuDevice() { |
keyar@chromium.org | 78a35c5 | 2012-08-20 15:03:44 +0000 | [diff] [blame] | 120 | return kGPU_DeviceType == fDeviceType; |
keyar@chromium.org | fe6391a | 2012-08-20 15:03:41 +0000 | [diff] [blame] | 121 | } |
keyar@chromium.org | 77a5522 | 2012-08-20 15:03:47 +0000 | [diff] [blame] | 122 | |
| 123 | SkGLContext* getGLContext() { |
| 124 | if (this->isUsingGpuDevice()) { |
| 125 | return fGrContextFactory.getGLContext(GrContextFactory::kNative_GLContextType); |
| 126 | } else { |
| 127 | return NULL; |
| 128 | } |
| 129 | } |
robertphillips@google.com | 163c84b | 2012-09-13 15:40:37 +0000 | [diff] [blame] | 130 | |
| 131 | GrContext* getGrContext() { |
| 132 | return fGrContext; |
| 133 | } |
keyar@chromium.org | 4ea96c5 | 2012-08-20 15:03:29 +0000 | [diff] [blame] | 134 | #endif |
| 135 | |
keyar@chromium.org | 02dfb12 | 2012-08-20 15:03:36 +0000 | [diff] [blame] | 136 | PictureRenderer() |
keyar@chromium.org | 0612564 | 2012-08-20 15:03:33 +0000 | [diff] [blame] | 137 | : fPicture(NULL) |
| 138 | , fDeviceType(kBitmap_DeviceType) |
junov@chromium.org | 50ff9bd | 2012-11-02 19:16:22 +0000 | [diff] [blame] | 139 | , fBBoxHierarchyType(kNone_BBoxHierarchyType) |
junov@chromium.org | 7b53706 | 2012-11-06 18:58:43 +0000 | [diff] [blame^] | 140 | , fGridWidth(0) |
| 141 | , fGridHeight(0) |
keyar@chromium.org | 0612564 | 2012-08-20 15:03:33 +0000 | [diff] [blame] | 142 | #if SK_SUPPORT_GPU |
| 143 | , fGrContext(fGrContextFactory.get(GrContextFactory::kNative_GLContextType)) |
| 144 | #endif |
| 145 | {} |
| 146 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 147 | protected: |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 148 | void buildBBoxHierarchy(); |
| 149 | SkPicture* createPicture(); |
| 150 | uint32_t recordFlags(); |
keyar@chromium.org | a474ce3 | 2012-08-20 15:03:57 +0000 | [diff] [blame] | 151 | SkCanvas* setupCanvas(); |
scroggo@google.com | bcdf2ec | 2012-09-20 14:42:33 +0000 | [diff] [blame] | 152 | virtual SkCanvas* setupCanvas(int width, int height); |
keyar@chromium.org | a474ce3 | 2012-08-20 15:03:57 +0000 | [diff] [blame] | 153 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 154 | SkAutoTUnref<SkCanvas> fCanvas; |
| 155 | SkPicture* fPicture; |
keyar@chromium.org | 4ea96c5 | 2012-08-20 15:03:29 +0000 | [diff] [blame] | 156 | SkDeviceTypes fDeviceType; |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 157 | BBoxHierarchyType fBBoxHierarchyType; |
junov@chromium.org | 7b53706 | 2012-11-06 18:58:43 +0000 | [diff] [blame^] | 158 | int fGridWidth, fGridHeight; // used when fBBoxHierarchyType is TileGrid |
keyar@chromium.org | 0612564 | 2012-08-20 15:03:33 +0000 | [diff] [blame] | 159 | |
| 160 | #if SK_SUPPORT_GPU |
| 161 | GrContextFactory fGrContextFactory; |
| 162 | GrContext* fGrContext; |
| 163 | #endif |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 164 | |
| 165 | private: |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 166 | virtual SkString getConfigNameInternal() = 0; |
| 167 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 168 | typedef SkRefCnt INHERITED; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 169 | }; |
| 170 | |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 171 | /** |
| 172 | * This class does not do any rendering, but its render function executes recording, which we want |
| 173 | * to time. |
| 174 | */ |
| 175 | class RecordPictureRenderer : public PictureRenderer { |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 176 | virtual bool render(const SkString*) SK_OVERRIDE; |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 177 | |
| 178 | virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); } |
| 179 | |
| 180 | virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); } |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 181 | |
djsollen@google.com | fd9720c | 2012-11-06 16:54:40 +0000 | [diff] [blame] | 182 | protected: |
| 183 | virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE; |
| 184 | |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 185 | private: |
| 186 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 187 | }; |
| 188 | |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 189 | class PipePictureRenderer : public PictureRenderer { |
keyar@chromium.org | 163b567 | 2012-08-01 17:53:29 +0000 | [diff] [blame] | 190 | public: |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 191 | virtual bool render(const SkString*) SK_OVERRIDE; |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 192 | |
| 193 | private: |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 194 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 195 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 196 | typedef PictureRenderer INHERITED; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 197 | }; |
| 198 | |
| 199 | class SimplePictureRenderer : public PictureRenderer { |
keyar@chromium.org | 163b567 | 2012-08-01 17:53:29 +0000 | [diff] [blame] | 200 | public: |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 201 | virtual void init(SkPicture* pict) SK_OVERRIDE; |
| 202 | |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 203 | virtual bool render(const SkString*) SK_OVERRIDE; |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 204 | |
| 205 | private: |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 206 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 207 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 208 | typedef PictureRenderer INHERITED; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 209 | }; |
| 210 | |
| 211 | class TiledPictureRenderer : public PictureRenderer { |
| 212 | public: |
| 213 | TiledPictureRenderer(); |
| 214 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 215 | virtual void init(SkPicture* pict) SK_OVERRIDE; |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 216 | |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 217 | /** |
| 218 | * Renders to tiles, rather than a single canvas. If a path is provided, a separate file is |
| 219 | * created for each tile, named "path0.png", "path1.png", etc. |
| 220 | * Multithreaded mode currently does not support writing to a file. |
| 221 | */ |
| 222 | virtual bool render(const SkString* path) SK_OVERRIDE; |
| 223 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 224 | virtual void end() SK_OVERRIDE; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 225 | |
keyar@chromium.org | cc6e5ef | 2012-07-27 20:09:26 +0000 | [diff] [blame] | 226 | void setTileWidth(int width) { |
| 227 | fTileWidth = width; |
| 228 | } |
| 229 | |
| 230 | int getTileWidth() const { |
| 231 | return fTileWidth; |
| 232 | } |
| 233 | |
| 234 | void setTileHeight(int height) { |
| 235 | fTileHeight = height; |
| 236 | } |
| 237 | |
| 238 | int getTileHeight() const { |
| 239 | return fTileHeight; |
| 240 | } |
| 241 | |
| 242 | void setTileWidthPercentage(double percentage) { |
| 243 | fTileWidthPercentage = percentage; |
| 244 | } |
| 245 | |
keyar@chromium.org | 163b567 | 2012-08-01 17:53:29 +0000 | [diff] [blame] | 246 | double getTileWidthPercentage() const { |
keyar@chromium.org | cc6e5ef | 2012-07-27 20:09:26 +0000 | [diff] [blame] | 247 | return fTileWidthPercentage; |
| 248 | } |
| 249 | |
| 250 | void setTileHeightPercentage(double percentage) { |
| 251 | fTileHeightPercentage = percentage; |
| 252 | } |
| 253 | |
keyar@chromium.org | 163b567 | 2012-08-01 17:53:29 +0000 | [diff] [blame] | 254 | double getTileHeightPercentage() const { |
keyar@chromium.org | cc6e5ef | 2012-07-27 20:09:26 +0000 | [diff] [blame] | 255 | return fTileHeightPercentage; |
| 256 | } |
| 257 | |
keyar@chromium.org | f4959ab | 2012-08-23 20:53:25 +0000 | [diff] [blame] | 258 | void setTileMinPowerOf2Width(int width) { |
| 259 | SkASSERT(SkIsPow2(width) && width > 0); |
| 260 | if (!SkIsPow2(width) || width <= 0) { |
| 261 | return; |
| 262 | } |
| 263 | |
| 264 | fTileMinPowerOf2Width = width; |
| 265 | } |
| 266 | |
| 267 | int getTileMinPowerOf2Width() const { |
| 268 | return fTileMinPowerOf2Width; |
| 269 | } |
| 270 | |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 271 | protected: |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 272 | SkTDArray<SkRect> fTileRects; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 273 | |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 274 | virtual SkCanvas* setupCanvas(int width, int height) SK_OVERRIDE; |
| 275 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 276 | |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 277 | private: |
scroggo@google.com | bcdf2ec | 2012-09-20 14:42:33 +0000 | [diff] [blame] | 278 | int fTileWidth; |
| 279 | int fTileHeight; |
| 280 | double fTileWidthPercentage; |
| 281 | double fTileHeightPercentage; |
| 282 | int fTileMinPowerOf2Width; |
scroggo@google.com | bcdf2ec | 2012-09-20 14:42:33 +0000 | [diff] [blame] | 283 | |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 284 | void setupTiles(); |
keyar@chromium.org | f4959ab | 2012-08-23 20:53:25 +0000 | [diff] [blame] | 285 | void setupPowerOf2Tiles(); |
keyar@chromium.org | 9d696c0 | 2012-08-07 17:11:33 +0000 | [diff] [blame] | 286 | |
| 287 | typedef PictureRenderer INHERITED; |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 288 | }; |
| 289 | |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 290 | class CloneData; |
| 291 | |
| 292 | class MultiCorePictureRenderer : public TiledPictureRenderer { |
| 293 | public: |
| 294 | explicit MultiCorePictureRenderer(int threadCount); |
| 295 | |
| 296 | ~MultiCorePictureRenderer(); |
| 297 | |
| 298 | virtual void init(SkPicture* pict) SK_OVERRIDE; |
| 299 | |
| 300 | /** |
| 301 | * Behaves like TiledPictureRenderer::render(), only using multiple threads. |
| 302 | */ |
| 303 | virtual bool render(const SkString* path) SK_OVERRIDE; |
| 304 | |
| 305 | virtual void end() SK_OVERRIDE; |
| 306 | |
| 307 | private: |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 308 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 309 | |
scroggo@google.com | a62da2f | 2012-11-02 21:28:12 +0000 | [diff] [blame] | 310 | const int fNumThreads; |
| 311 | SkTDArray<SkCanvas*> fCanvasPool; |
| 312 | SkThreadPool fThreadPool; |
| 313 | SkPicture* fPictureClones; |
| 314 | CloneData** fCloneData; |
| 315 | SkCountdown fCountdown; |
| 316 | |
| 317 | typedef TiledPictureRenderer INHERITED; |
| 318 | }; |
| 319 | |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 320 | /** |
| 321 | * This class does not do any rendering, but its render function executes turning an SkPictureRecord |
| 322 | * into an SkPicturePlayback, which we want to time. |
| 323 | */ |
| 324 | class PlaybackCreationRenderer : public PictureRenderer { |
| 325 | public: |
| 326 | virtual void setup() SK_OVERRIDE; |
| 327 | |
scroggo@google.com | 81f9d2e | 2012-09-20 14:54:21 +0000 | [diff] [blame] | 328 | virtual bool render(const SkString*) SK_OVERRIDE; |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 329 | |
| 330 | virtual SkString getPerIterTimeFormat() SK_OVERRIDE { return SkString("%.4f"); } |
| 331 | |
| 332 | virtual SkString getNormalTimeFormat() SK_OVERRIDE { return SkString("%6.4f"); } |
| 333 | |
| 334 | private: |
junov@chromium.org | 9313ca4 | 2012-11-02 18:11:49 +0000 | [diff] [blame] | 335 | SkAutoTUnref<SkPicture> fReplayer; |
scroggo@google.com | 0a049b8 | 2012-11-02 22:01:26 +0000 | [diff] [blame] | 336 | |
| 337 | virtual SkString getConfigNameInternal() SK_OVERRIDE; |
| 338 | |
scroggo@google.com | 9a41252 | 2012-09-07 15:21:18 +0000 | [diff] [blame] | 339 | typedef PictureRenderer INHERITED; |
| 340 | }; |
| 341 | |
keyar@chromium.org | 451bb9f | 2012-07-26 17:27:57 +0000 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | #endif // PictureRenderer_DEFINED |