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
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 16768c7..caab64a 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -42,6 +42,9 @@
void PictureRenderer::init(SkPicture* pict) {
SkASSERT(NULL == fPicture);
SkASSERT(NULL == fCanvas.get());
+ fGridInfo.fMargin.setEmpty();
+ fGridInfo.fOffset.setZero();
+ fGridInfo.fTileInterval.set(1, 1);
if (fPicture != NULL || NULL != fCanvas.get()) {
return;
}
@@ -800,8 +803,8 @@
case kRTree_BBoxHierarchyType:
return SkNEW(RTreePicture);
case kTileGrid_BBoxHierarchyType:
- return SkNEW_ARGS(SkTileGridPicture, (fGridWidth, fGridHeight, fPicture->width(),
- fPicture->height()));
+ return SkNEW_ARGS(SkTileGridPicture, (fPicture->width(),
+ fPicture->height(), fGridInfo));
}
SkASSERT(0); // invalid bbhType
return NULL;