| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "Test.h" | 9 #include "Test.h" |
| 10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkTileGrid.h" | 12 #include "SkTileGrid.h" |
| 13 #include "SkTileGridPicture.h" | 13 #include "SkTileGridPicture.h" |
| 14 | 14 |
| 15 enum Tile { | 15 enum Tile { |
| 16 kTopLeft_Tile = 0x1, | 16 kTopLeft_Tile = 0x1, |
| 17 kTopRight_Tile = 0x2, | 17 kTopRight_Tile = 0x2, |
| 18 kBottomLeft_Tile = 0x4, | 18 kBottomLeft_Tile = 0x4, |
| 19 kBottomRight_Tile = 0x8, | 19 kBottomRight_Tile = 0x8, |
| 20 | 20 |
| 21 kAll_Tile = kTopLeft_Tile | kTopRight_Tile | kBottomLeft_Tile | kBottomRight
_Tile, | 21 kAll_Tile = kTopLeft_Tile | kTopRight_Tile | kBottomLeft_Tile | kBottomRight
_Tile, |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 class MockCanvas : public SkCanvas { | 25 class MockCanvas : public SkCanvas { |
| 26 public: | 26 public: |
| 27 MockCanvas(SkBaseDevice* device) : SkCanvas(device) | 27 MockCanvas(SkBaseDevice* device) : SkCanvas(device) |
| 28 {} | 28 {} |
| 29 | 29 |
| 30 virtual void drawRect(const SkRect& rect, const SkPaint&) | 30 virtual void onDrawRect(const SkRect& rect, const SkPaint&) |
| 31 { | 31 { |
| 32 // This capture occurs before quick reject. | 32 // This capture occurs before quick reject. |
| 33 fRects.push(rect); | 33 fRects.push(rect); |
| 34 } | 34 } |
| 35 | 35 |
| 36 SkTDArray<SkRect> fRects; | 36 SkTDArray<SkRect> fRects; |
| 37 }; | 37 }; |
| 38 } | 38 } |
| 39 | 39 |
| 40 class TileGridTest { | 40 class TileGridTest { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile
); | 274 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile
); |
| 275 | 275 |
| 276 TestUnalignedQuery(reporter); | 276 TestUnalignedQuery(reporter); |
| 277 TestOverlapOffsetQueryAlignment(reporter); | 277 TestOverlapOffsetQueryAlignment(reporter); |
| 278 } | 278 } |
| 279 }; | 279 }; |
| 280 | 280 |
| 281 | 281 |
| 282 #include "TestClassDef.h" | 282 #include "TestClassDef.h" |
| 283 DEFINE_TESTCLASS("TileGrid", TileGridTestClass, TileGridTest::Test) | 283 DEFINE_TESTCLASS("TileGrid", TileGridTestClass, TileGridTest::Test) |
| OLD | NEW |