2012-12-13 16:39:53 +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 SkTileGridPicture_DEFINED
|
|
|
|
#define SkTileGridPicture_DEFINED
|
|
|
|
|
|
|
|
#include "SkPicture.h"
|
2013-02-27 18:35:16 +00:00
|
|
|
#include "SkPoint.h"
|
|
|
|
#include "SkSize.h"
|
2012-12-13 16:39:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Subclass of SkPicture that override the behavior of the
|
|
|
|
* kOptimizeForClippedPlayback_RecordingFlag by creating an SkTileGrid
|
|
|
|
* structure rather than an R-Tree. The tile grid has lower recording
|
|
|
|
* and playback costs, but is less effective at eliminating extraneous
|
|
|
|
* primitives for arbitrary query rectangles. It is most effective for
|
|
|
|
* tiled playback when the tile structure is known at record time.
|
|
|
|
*/
|
2013-01-16 16:07:39 +00:00
|
|
|
class SK_API SkTileGridPicture : public SkPicture {
|
2012-12-13 16:39:53 +00:00
|
|
|
public:
|
2013-02-27 18:35:16 +00:00
|
|
|
struct TileGridInfo {
|
|
|
|
/** Tile placement interval */
|
|
|
|
SkISize fTileInterval;
|
|
|
|
|
|
|
|
/** Pixel coverage overlap between adjacent tiles */
|
|
|
|
SkISize fMargin;
|
|
|
|
|
|
|
|
/** Offset added to device-space bounding box positions to convert
|
|
|
|
* them to tile-grid space. This can be used to adjust the "phase"
|
|
|
|
* of the tile grid to match probable query rectangles that will be
|
|
|
|
* used to search into the tile grid. As long as the offset is smaller
|
|
|
|
* or equal to the margin, there is no need to extend the domain of
|
|
|
|
* the tile grid to prevent data loss.
|
|
|
|
*/
|
|
|
|
SkIPoint fOffset;
|
|
|
|
};
|
2013-02-08 21:03:30 +00:00
|
|
|
/**
|
|
|
|
* Constructor
|
|
|
|
* @param width recording canvas width in device pixels
|
|
|
|
* @param height recording canvas height in device pixels
|
2013-02-27 18:35:16 +00:00
|
|
|
* @param info description of the tiling layout
|
2013-02-08 21:03:30 +00:00
|
|
|
*/
|
2013-02-27 18:35:16 +00:00
|
|
|
SkTileGridPicture(int width, int height, const TileGridInfo& info);
|
|
|
|
|
2012-12-13 16:39:53 +00:00
|
|
|
virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE;
|
2013-02-27 18:35:16 +00:00
|
|
|
|
2012-12-13 16:39:53 +00:00
|
|
|
private:
|
2013-02-27 18:35:16 +00:00
|
|
|
int fXTileCount, fYTileCount;
|
|
|
|
TileGridInfo fInfo;
|
2012-12-13 16:39:53 +00:00
|
|
|
};
|
|
|
|
|
2012-12-14 02:02:06 +00:00
|
|
|
#endif
|