diff options
author | junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-27 18:35:16 +0000 |
---|---|---|
committer | junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-02-27 18:35:16 +0000 |
commit | 29b19e53cfac5af4f9bd5d361436d1097f349a34 (patch) | |
tree | f00138de9091031ecbb929f6800b080be8f7c02e /include | |
parent | d1c53aae59ee44377be8bc0cc15e54d46aa530ce (diff) |
Change SkTileGride geometry calculations to match the Chromium compositor.
This patch changes the semantics of tileWidth/Height to include the border region, and
uses an offset to take into account the fact that there is no outer border for outer
tiles. This patch also fixes a previous bug where the right column and bottom row were
considered to be included in bounds that are expressed as an SkIRect.
Companion Chromium CL required for roll: https://codereview.chromium.org/12221077/
TEST=TileGrid unit test
Review URL: https://codereview.appspot.com/7350050
git-svn-id: http://skia.googlecode.com/svn/trunk@7885 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkTileGridPicture.h | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/include/core/SkTileGridPicture.h b/include/core/SkTileGridPicture.h index 28d545a467..b28f3d3b55 100644 --- a/include/core/SkTileGridPicture.h +++ b/include/core/SkTileGridPicture.h @@ -9,6 +9,8 @@ #define SkTileGridPicture_DEFINED #include "SkPicture.h" +#include "SkPoint.h" +#include "SkSize.h" /** * Subclass of SkPicture that override the behavior of the @@ -20,23 +22,35 @@ */ class SK_API SkTileGridPicture : public SkPicture { public: + 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; + }; /** * Constructor - * @param tileWidth horizontal stride between consecutive tiles - * @param tileHeight vertical stride between consecutive tiles * @param width recording canvas width in device pixels * @param height recording canvas height in device pixels - * @param borderPixels pixels of overlap between adjacent tiles. Set this - * value to match the border overlap that is applied to tiles by user - * code. Properly setting this value will help improve performance - * when performing tile-aligned playbacks with query regions that - * match tile bounds outset by borderPixels pixels. Such outsets - * are often used to prevent filtering artifacts at tile boundaries. + * @param info description of the tiling layout */ - SkTileGridPicture(int tileWidth, int tileHeight, int width, int height, int borderPixels = 0); + SkTileGridPicture(int width, int height, const TileGridInfo& info); + virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE; + private: - int fTileWidth, fTileHeight, fXTileCount, fYTileCount, fBorderPixels; + int fXTileCount, fYTileCount; + TileGridInfo fInfo; }; #endif |