Index: tests/TileGridTest.cpp |
=================================================================== |
--- tests/TileGridTest.cpp (revision 10994) |
+++ tests/TileGridTest.cpp (working copy) |
@@ -7,10 +7,10 @@ |
*/ |
#include "Test.h" |
+#include "SkBitmapDevice.h" |
+#include "SkCanvas.h" |
#include "SkTileGrid.h" |
#include "SkTileGridPicture.h" |
-#include "SkCanvas.h" |
-#include "SkDevice.h" |
enum Tile { |
kTopLeft_Tile = 0x1, |
@@ -24,7 +24,7 @@ |
namespace { |
class MockCanvas : public SkCanvas { |
public: |
- MockCanvas(SkDevice* device) : SkCanvas(device) |
+ MockCanvas(SkBaseDevice* device) : SkCanvas(device) |
{} |
virtual void drawRect(const SkRect& rect, const SkPaint&) |
@@ -80,14 +80,14 @@ |
// Test parts of top-left tile |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
picture.draw(&mockCanvas); |
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count()); |
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]); |
} |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-7.99f), SkFloatToScalar(-7.99f)); |
picture.draw(&mockCanvas); |
@@ -96,7 +96,7 @@ |
} |
// Corner overlap |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-9.5f), SkFloatToScalar(-9.5f)); |
picture.draw(&mockCanvas); |
@@ -106,7 +106,7 @@ |
} |
// Intersect bottom right tile, but does not overlap rect 2 |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-16.0f), SkFloatToScalar(-16.0f)); |
picture.draw(&mockCanvas); |
@@ -115,7 +115,7 @@ |
} |
// Out of bounds queries, snap to border tiles |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(2.0f), SkFloatToScalar(0.0f)); |
picture.draw(&mockCanvas); |
@@ -123,7 +123,7 @@ |
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]); |
} |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(0.0f), SkFloatToScalar(2.0f)); |
picture.draw(&mockCanvas); |
@@ -131,7 +131,7 @@ |
REPORTER_ASSERT(reporter, rect1 == mockCanvas.fRects[0]); |
} |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-22.0f), SkFloatToScalar(-16.0f)); |
picture.draw(&mockCanvas); |
@@ -139,7 +139,7 @@ |
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]); |
} |
{ |
- SkDevice device(store); |
+ SkBitmapDevice device(store); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-16.0f), SkFloatToScalar(-22.0f)); |
picture.draw(&mockCanvas); |
@@ -185,7 +185,7 @@ |
{ |
// The offset should cancel the top and left borders of the top left tile |
// So a look-up at interval 0-10 should be grid aligned, |
- SkDevice device(tileBitmap); |
+ SkBitmapDevice device(tileBitmap); |
MockCanvas mockCanvas(&device); |
picture.draw(&mockCanvas); |
REPORTER_ASSERT(reporter, 1 == mockCanvas.fRects.count()); |
@@ -193,7 +193,7 @@ |
} |
{ |
// Encroaching border by one pixel |
- SkDevice device(moreThanATileBitmap); |
+ SkBitmapDevice device(moreThanATileBitmap); |
MockCanvas mockCanvas(&device); |
picture.draw(&mockCanvas); |
REPORTER_ASSERT(reporter, 2 == mockCanvas.fRects.count()); |
@@ -204,7 +204,7 @@ |
// Tile stride is 8 (tileWidth - 2 * border pixels |
// so translating by 8, should make query grid-aligned |
// with middle tile. |
- SkDevice device(tileBitmap); |
+ SkBitmapDevice device(tileBitmap); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkIntToScalar(-8), SkIntToScalar(-8)); |
picture.draw(&mockCanvas); |
@@ -212,7 +212,7 @@ |
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]); |
} |
{ |
- SkDevice device(tileBitmap); |
+ SkBitmapDevice device(tileBitmap); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-7.9f), SkFloatToScalar(-7.9f)); |
picture.draw(&mockCanvas); |
@@ -221,7 +221,7 @@ |
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[1]); |
} |
{ |
- SkDevice device(tileBitmap); |
+ SkBitmapDevice device(tileBitmap); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-8.1f), SkFloatToScalar(-8.1f)); |
picture.draw(&mockCanvas); |
@@ -233,7 +233,7 @@ |
// Regression test for crbug.com/234688 |
// Once the 2x2 device region is inset by margin, it yields an empty |
// adjusted region, sitting right on top of the tile boundary. |
- SkDevice device(tinyBitmap); |
+ SkBitmapDevice device(tinyBitmap); |
MockCanvas mockCanvas(&device); |
mockCanvas.translate(SkFloatToScalar(-8.0f), SkFloatToScalar(-8.0f)); |
picture.draw(&mockCanvas); |