Adding option to SkTileGrid for specifying border pixels.
The purpose of this patch is to make it possible for the chromium compositor to
generate a TileGrid structure that is better suited for scaled playback.
Review URL: https://codereview.appspot.com/7300072
git-svn-id: http://skia.googlecode.com/svn/trunk@7680 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/TileGridTest.cpp b/tests/TileGridTest.cpp
index 1946b9f..afde41d 100644
--- a/tests/TileGridTest.cpp
+++ b/tests/TileGridTest.cpp
@@ -39,8 +39,9 @@
class TileGridTest {
public:
- static void verifyTileHits(skiatest::Reporter* reporter, SkIRect rect, uint32_t tileMask) {
- SkTileGrid grid(10, 10, 2, 2, NULL);
+ static void verifyTileHits(skiatest::Reporter* reporter, SkIRect rect, uint32_t tileMask,
+ int borderPixels = 0) {
+ SkTileGrid grid(10, 10, 2, 2, borderPixels, NULL);
grid.insert(NULL, rect, false);
REPORTER_ASSERT(reporter, grid.tile(0,0).count() ==
((tileMask & kTopLeft_Tile)? 1 : 0));
@@ -119,6 +120,12 @@
verifyTileHits(reporter, SkIRect::MakeXYWH(10, 10, 1, 1), kAll_Tile);
verifyTileHits(reporter, SkIRect::MakeXYWH(11, 11, 1, 1), kBottomRight_Tile);
+ // BorderPixels
+ verifyTileHits(reporter, SkIRect::MakeXYWH(0, 0, 7, 7), kTopLeft_Tile, 1);
+ verifyTileHits(reporter, SkIRect::MakeXYWH(0, 0, 8, 8), kAll_Tile, 1);
+ verifyTileHits(reporter, SkIRect::MakeXYWH(11, 11, 1, 1), kAll_Tile, 1);
+ verifyTileHits(reporter, SkIRect::MakeXYWH(12, 12, 1, 1), kBottomRight_Tile, 1);
+
// BBoxes that overlap tiles
verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 1), kTopLeft_Tile | kTopRight_Tile);
verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 1, 10), kTopLeft_Tile |