aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 16:39:53 +0000
committerGravatar junov@chromium.org <junov@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-13 16:39:53 +0000
commit3cb834bd27a16cc60ff30adae96659558c2dc91f (patch)
tree1122324a71c09a0c4b772ec4ac04d9f3ce8a567c /tools
parent4c1f091b6835a771dc86f5a784dce693de4f4555 (diff)
Modifying SkTileGrid to support arbitrary query rectangles.
Exposing SkTileGrid functionality in the public API through SkTileGridPicture. This patch also makes TileGrid and Rtree testable in gm, which revealed errors. TEST=gm with '--tileGrid' BUG=http://code.google.com/p/chromium/issues/detail?id=164636 Review URL: https://codereview.appspot.com/6933044 git-svn-id: http://skia.googlecode.com/svn/trunk@6783 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureRenderer.cpp28
1 files changed, 3 insertions, 25 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp
index 1f975cf3e4..034e8fc396 100644
--- a/tools/PictureRenderer.cpp
+++ b/tools/PictureRenderer.cpp
@@ -24,7 +24,7 @@
#include "SkStream.h"
#include "SkString.h"
#include "SkTemplates.h"
-#include "SkTileGrid.h"
+#include "SkTileGridPicture.h"
#include "SkTDArray.h"
#include "SkThreadUtils.h"
#include "SkTypes.h"
@@ -624,22 +624,6 @@ public:
}
};
-class TileGridPicture : public SkPicture {
-public:
- TileGridPicture(int tileWidth, int tileHeight, int xTileCount, int yTileCount) {
- fTileWidth = tileWidth;
- fTileHeight = tileHeight;
- fXTileCount = xTileCount;
- fYTileCount = yTileCount;
- }
-
- virtual SkBBoxHierarchy* createBBoxHierarchy() const SK_OVERRIDE{
- return SkNEW_ARGS(SkTileGrid, (fTileWidth, fTileHeight, fXTileCount, fYTileCount));
- }
-private:
- int fTileWidth, fTileHeight, fXTileCount, fYTileCount;
-};
-
SkPicture* PictureRenderer::createPicture() {
switch (fBBoxHierarchyType) {
case kNone_BBoxHierarchyType:
@@ -647,14 +631,8 @@ SkPicture* PictureRenderer::createPicture() {
case kRTree_BBoxHierarchyType:
return SkNEW(RTreePicture);
case kTileGrid_BBoxHierarchyType:
- {
- int xTileCount = fPicture->width() / fGridWidth +
- ((fPicture->width() % fGridWidth) ? 1 : 0);
- int yTileCount = fPicture->height() / fGridHeight +
- ((fPicture->height() % fGridHeight) ? 1 : 0);
- return SkNEW_ARGS(TileGridPicture, (fGridWidth, fGridHeight, xTileCount,
- yTileCount));
- }
+ return SkNEW_ARGS(SkTileGridPicture, (fGridWidth, fGridHeight, fPicture->width(),
+ fPicture->height()));
}
SkASSERT(0); // invalid bbhType
return NULL;