diff options
Diffstat (limited to 'src/core/SkTileGridPicture.cpp')
-rw-r--r-- | src/core/SkTileGridPicture.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/core/SkTileGridPicture.cpp b/src/core/SkTileGridPicture.cpp index 8a39d4949b..7a8d5932ac 100644 --- a/src/core/SkTileGridPicture.cpp +++ b/src/core/SkTileGridPicture.cpp @@ -10,18 +10,19 @@ #include "SkPictureStateTree.h" #include "SkTileGrid.h" - -SkTileGridPicture::SkTileGridPicture(int tileWidth, int tileHeight, int width, int height, - int borderPixels) { - SkASSERT(borderPixels >= 0); - fTileWidth = tileWidth; - fTileHeight = tileHeight; - fXTileCount = (width + tileWidth - 1) / tileWidth; - fYTileCount = (height + tileHeight - 1) / tileHeight; - fBorderPixels = borderPixels; +SkTileGridPicture::SkTileGridPicture(int width, int height, const TileGridInfo& info) { + SkASSERT(info.fMargin.width() >= 0); + SkASSERT(info.fMargin.height() >= 0); + fInfo = info; + // Note: SkIRects are non-inclusive of the right() column and bottom() row. + // For example, an SkIRect at 0,0 with a size of (1,1) will only have + // content at pixel (0,0) and will report left=0 and right=1, hence the + // "-1"s below. + fXTileCount = (width + info.fTileInterval.width() - 1) / info.fTileInterval.width(); + fYTileCount = (height + info.fTileInterval.height() - 1) / info.fTileInterval.height(); } SkBBoxHierarchy* SkTileGridPicture::createBBoxHierarchy() const { - return SkNEW_ARGS(SkTileGrid, (fTileWidth, fTileHeight, fXTileCount, fYTileCount, - fBorderPixels, SkTileGridNextDatum<SkPictureStateTree::Draw>)); + return SkNEW_ARGS(SkTileGrid, (fXTileCount, fYTileCount, fInfo, + SkTileGridNextDatum<SkPictureStateTree::Draw>)); } |