Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(216)

Side by Side Diff: tests/TileGridTest.cpp

Issue 465523002: De-parameterize SkNextDatumFunction. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: no <T> Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPictureRecorder.h" 9 #include "SkPictureRecorder.h"
10 #include "SkTileGrid.h" 10 #include "SkTileGrid.h"
(...skipping 19 matching lines...) Expand all
30 30
31 SkTDArray<SkRect> fRects; 31 SkTDArray<SkRect> fRects;
32 }; 32 };
33 33
34 static void verifyTileHits(skiatest::Reporter* reporter, SkIRect rect, 34 static void verifyTileHits(skiatest::Reporter* reporter, SkIRect rect,
35 uint32_t tileMask, int borderPixels = 0) { 35 uint32_t tileMask, int borderPixels = 0) {
36 SkTileGridFactory::TileGridInfo info; 36 SkTileGridFactory::TileGridInfo info;
37 info.fMargin.set(borderPixels, borderPixels); 37 info.fMargin.set(borderPixels, borderPixels);
38 info.fOffset.setZero(); 38 info.fOffset.setZero();
39 info.fTileInterval.set(10 - 2 * borderPixels, 10 - 2 * borderPixels); 39 info.fTileInterval.set(10 - 2 * borderPixels, 10 - 2 * borderPixels);
40 SkTileGrid grid(2, 2, info, NULL); 40 SkTileGrid grid(2, 2, info);
41 grid.insert(NULL, rect, false); 41 grid.insert(NULL, rect, false);
42 REPORTER_ASSERT(reporter, grid.tileCount(0, 0) == 42 REPORTER_ASSERT(reporter, grid.tileCount(0, 0) ==
43 ((tileMask & kTopLeft_Tile)? 1 : 0)); 43 ((tileMask & kTopLeft_Tile)? 1 : 0));
44 REPORTER_ASSERT(reporter, grid.tileCount(1, 0) == 44 REPORTER_ASSERT(reporter, grid.tileCount(1, 0) ==
45 ((tileMask & kTopRight_Tile)? 1 : 0)); 45 ((tileMask & kTopRight_Tile)? 1 : 0));
46 REPORTER_ASSERT(reporter, grid.tileCount(0, 1) == 46 REPORTER_ASSERT(reporter, grid.tileCount(0, 1) ==
47 ((tileMask & kBottomLeft_Tile)? 1 : 0)); 47 ((tileMask & kBottomLeft_Tile)? 1 : 0));
48 REPORTER_ASSERT(reporter, grid.tileCount(1, 1) == 48 REPORTER_ASSERT(reporter, grid.tileCount(1, 1) ==
49 ((tileMask & kBottomRight_Tile)? 1 : 0)); 49 ((tileMask & kBottomRight_Tile)? 1 : 0));
50 } 50 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 verifyTileHits(reporter, SkIRect::MakeXYWH(10, 10, 1, 1), kBottomRight_Tile , 1); 242 verifyTileHits(reporter, SkIRect::MakeXYWH(10, 10, 1, 1), kBottomRight_Tile , 1);
243 verifyTileHits(reporter, SkIRect::MakeXYWH(17, 17, 1, 1), kBottomRight_Tile , 1); 243 verifyTileHits(reporter, SkIRect::MakeXYWH(17, 17, 1, 1), kBottomRight_Tile , 1);
244 244
245 // BBoxes that overlap tiles 245 // BBoxes that overlap tiles
246 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 1), kTopLeft_Tile | kT opRight_Tile); 246 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 1), kTopLeft_Tile | kT opRight_Tile);
247 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 1, 10), kTopLeft_Tile | 247 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 1, 10), kTopLeft_Tile |
248 kBottomLeft_Tile); 248 kBottomLeft_Tile);
249 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 10), kAll_Tile); 249 verifyTileHits(reporter, SkIRect::MakeXYWH(5, 5, 10, 10), kAll_Tile);
250 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile); 250 verifyTileHits(reporter, SkIRect::MakeXYWH(-10, -10, 40, 40), kAll_Tile);
251 } 251 }
OLDNEW
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698