michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #ifndef SkTileGridPicture_DEFINED michael@0: #define SkTileGridPicture_DEFINED michael@0: michael@0: #include "SkPicture.h" michael@0: #include "SkPoint.h" michael@0: #include "SkSize.h" michael@0: michael@0: /** michael@0: * Subclass of SkPicture that override the behavior of the michael@0: * kOptimizeForClippedPlayback_RecordingFlag by creating an SkTileGrid michael@0: * structure rather than an R-Tree. The tile grid has lower recording michael@0: * and playback costs, but is less effective at eliminating extraneous michael@0: * primitives for arbitrary query rectangles. It is most effective for michael@0: * tiled playback when the tile structure is known at record time. michael@0: */ michael@0: class SK_API SkTileGridPicture : public SkPicture { michael@0: public: michael@0: struct TileGridInfo { michael@0: /** Tile placement interval */ michael@0: SkISize fTileInterval; michael@0: michael@0: /** Pixel coverage overlap between adjacent tiles */ michael@0: SkISize fMargin; michael@0: michael@0: /** Offset added to device-space bounding box positions to convert michael@0: * them to tile-grid space. This can be used to adjust the "phase" michael@0: * of the tile grid to match probable query rectangles that will be michael@0: * used to search into the tile grid. As long as the offset is smaller michael@0: * or equal to the margin, there is no need to extend the domain of michael@0: * the tile grid to prevent data loss. michael@0: */ michael@0: SkIPoint fOffset; michael@0: }; michael@0: /** michael@0: * Constructor michael@0: * @param width recording canvas width in device pixels michael@0: * @param height recording canvas height in device pixels michael@0: * @param info description of the tiling layout michael@0: */ michael@0: SkTileGridPicture(int width, int height, const TileGridInfo& info); michael@0: michael@0: virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE; michael@0: michael@0: private: michael@0: int fXTileCount, fYTileCount; michael@0: TileGridInfo fInfo; michael@0: }; michael@0: michael@0: #endif