2012-11-07 18:01:46 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2012 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef CopyTilesRenderer_DEFINED
|
|
|
|
#define CopyTilesRenderer_DEFINED
|
|
|
|
|
|
|
|
#include "PictureRenderer.h"
|
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
class SkPicture;
|
|
|
|
class SkString;
|
|
|
|
|
|
|
|
namespace sk_tools {
|
|
|
|
/**
|
|
|
|
* PictureRenderer that draws the picture and then extracts it into tiles. For large pictures,
|
|
|
|
* it will divide the picture into large tiles and draw the picture once for each large tile.
|
|
|
|
*/
|
|
|
|
class CopyTilesRenderer : public TiledPictureRenderer {
|
|
|
|
|
|
|
|
public:
|
2014-08-18 14:52:17 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
|
|
|
CopyTilesRenderer(const GrContext::Options &opts, int x, int y);
|
|
|
|
#else
|
2012-11-07 18:01:46 +00:00
|
|
|
CopyTilesRenderer(int x, int y);
|
2014-08-18 14:52:17 +00:00
|
|
|
#endif
|
2014-07-07 20:46:35 +00:00
|
|
|
virtual void init(const SkPicture* pict,
|
|
|
|
const SkString* writePath,
|
|
|
|
const SkString* mismatchPath,
|
2014-05-15 15:10:48 +00:00
|
|
|
const SkString* inputFilename,
|
2014-10-09 11:59:19 +00:00
|
|
|
bool useChecksumBasedFilenames,
|
2015-03-26 01:17:31 +00:00
|
|
|
bool useMultiPictureDraw) override;
|
2012-11-07 18:01:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Similar to TiledPictureRenderer, this will draw a PNG for each tile. However, the
|
|
|
|
* numbering (and actual tiles) will be different.
|
|
|
|
*/
|
2015-03-26 01:17:31 +00:00
|
|
|
bool render(SkBitmap** out) override;
|
2012-11-07 18:01:46 +00:00
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
bool supportsTimingIndividualTiles() override { return false; }
|
2013-03-04 16:41:06 +00:00
|
|
|
|
2012-11-07 18:01:46 +00:00
|
|
|
private:
|
|
|
|
int fXTilesPerLargeTile;
|
|
|
|
int fYTilesPerLargeTile;
|
|
|
|
|
|
|
|
int fLargeTileWidth;
|
|
|
|
int fLargeTileHeight;
|
|
|
|
|
2015-03-26 01:17:31 +00:00
|
|
|
SkString getConfigNameInternal() override;
|
2012-11-07 18:01:46 +00:00
|
|
|
|
|
|
|
typedef TiledPictureRenderer INHERITED;
|
|
|
|
};
|
|
|
|
} // sk_tools
|
|
|
|
#endif // CopyTilesRenderer_DEFINED
|