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 CopyTilesRenderer_DEFINED 9 #define CopyTilesRenderer_DEFINED 10 11 #include "PictureRenderer.h" 12 #include "SkTypes.h" 13 14 class SkPicture; 15 class SkString; 16 17 namespace 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: 25 #if SK_SUPPORT_GPU 26 CopyTilesRenderer(const GrContext::Options &opts, int x, int y); 27 #else 28 CopyTilesRenderer(int x, int y); 29 #endif 30 virtual void init(const SkPicture* pict, 31 const SkString* writePath, 32 const SkString* mismatchPath, 33 const SkString* inputFilename, 34 bool useChecksumBasedFilenames) SK_OVERRIDE; 35 36 /** 37 * Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the 38 * numbering (and actual tiles) will be different. 39 */ 40 virtual bool render(SkBitmap** out) SK_OVERRIDE; 41 42 virtual bool supportsTimingIndividualTiles() SK_OVERRIDE { return false; } 43 44 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 57