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

Side by Side Diff: cc/base/tiling_data_unittest.cc

Issue 2503303002: ps test.
Patch Set: rebase Created 4 years, 1 month 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 | « cc/base/tiling_data.cc ('k') | cc/tiles/tiling_set_eviction_queue.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/base/tiling_data.h" 5 #include "cc/base/tiling_data.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 int YIndex(const gfx::Size& max_texture_size, 40 int YIndex(const gfx::Size& max_texture_size,
41 const gfx::Size& tiling_size, 41 const gfx::Size& tiling_size,
42 bool has_border_texels, 42 bool has_border_texels,
43 int y_coord) { 43 int y_coord) {
44 TilingData tiling(max_texture_size, tiling_size, has_border_texels); 44 TilingData tiling(max_texture_size, tiling_size, has_border_texels);
45 return tiling.TileYIndexFromSrcCoord(y_coord); 45 return tiling.TileYIndexFromSrcCoord(y_coord);
46 } 46 }
47 47
48 int AbsoluteXIndex(const gfx::Size& max_texture_size,
49 const gfx::Size& tiling_size,
50 bool has_border_texels,
51 int x_coord) {
52 TilingData tiling(max_texture_size, tiling_size, has_border_texels);
53 return tiling.TileAbsoluteXIndexFromSrcCoord(x_coord);
54 }
55
56 int AbsoluteYIndex(const gfx::Size& max_texture_size,
57 const gfx::Size& tiling_size,
58 bool has_border_texels,
59 int y_coord) {
60 TilingData tiling(max_texture_size, tiling_size, has_border_texels);
61 return tiling.TileAbsoluteYIndexFromSrcCoord(y_coord);
62 }
63
48 int MinBorderXIndex(const gfx::Size& max_texture_size, 64 int MinBorderXIndex(const gfx::Size& max_texture_size,
49 const gfx::Size& tiling_size, 65 const gfx::Size& tiling_size,
50 bool has_border_texels, 66 bool has_border_texels,
51 int x_coord) { 67 int x_coord) {
52 TilingData tiling(max_texture_size, tiling_size, has_border_texels); 68 TilingData tiling(max_texture_size, tiling_size, has_border_texels);
53 return tiling.FirstBorderTileXIndexFromSrcCoord(x_coord); 69 return tiling.FirstBorderTileXIndexFromSrcCoord(x_coord);
54 } 70 }
55 71
56 int MinBorderYIndex(const gfx::Size& max_texture_size, 72 int MinBorderYIndex(const gfx::Size& max_texture_size,
57 const gfx::Size& tiling_size, 73 const gfx::Size& tiling_size,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0)); 283 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0));
268 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1)); 284 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1));
269 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2)); 285 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2));
270 286
271 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 0)); 287 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 0));
272 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 1)); 288 EXPECT_EQ(0, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 1));
273 EXPECT_EQ(1, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 2)); 289 EXPECT_EQ(1, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 2));
274 EXPECT_EQ(1, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 3)); 290 EXPECT_EQ(1, XIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 3));
275 } 291 }
276 292
293 TEST(TilingDataTest, TileAbsoluteXIndexFromSrcCoord) {
294 EXPECT_EQ(-2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -4));
295 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -3));
296 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -2));
297 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -1));
298 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0));
299 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1));
300 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2));
301 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3));
302 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4));
303 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5));
304 EXPECT_EQ(2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6));
305 EXPECT_EQ(2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7));
306 EXPECT_EQ(2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8));
307 EXPECT_EQ(3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 9));
308 EXPECT_EQ(3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 10));
309 EXPECT_EQ(3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 11));
310 EXPECT_EQ(4, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 12));
311
312 EXPECT_EQ(-4, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -4));
313 EXPECT_EQ(-3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -3));
314 EXPECT_EQ(-2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -2));
315 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -1));
316 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 0));
317 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 1));
318 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 2));
319 EXPECT_EQ(2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 3));
320 EXPECT_EQ(3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 4));
321 EXPECT_EQ(4, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 5));
322 EXPECT_EQ(5, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 6));
323 EXPECT_EQ(6, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 7));
324 EXPECT_EQ(7, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 8));
325 EXPECT_EQ(7, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 9));
326 EXPECT_EQ(8, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 10));
327 EXPECT_EQ(9, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 11));
328 EXPECT_EQ(10, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 12));
329
330 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, -1));
331 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, 0));
332 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, 1));
333 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, -1));
334 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 0));
335 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 1));
336 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 2));
337 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, -1));
338 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 0));
339 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 1));
340 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 2));
341 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 3));
342
343 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, -2));
344 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, -1));
345 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 0));
346 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 1));
347 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 2));
348 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 3));
349 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 4));
350 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), false, 5));
351
352 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, -1));
353 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, 0));
354 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, 1));
355 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, -1));
356 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 0));
357 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 1));
358 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 2));
359 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, -1));
360 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0));
361 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1));
362 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2));
363 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 3));
364
365 EXPECT_EQ(-2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, -2));
366 EXPECT_EQ(-1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, -1));
367 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 0));
368 EXPECT_EQ(0, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 1));
369 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 2));
370 EXPECT_EQ(1, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 3));
371 EXPECT_EQ(2, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 4));
372 EXPECT_EQ(3, AbsoluteXIndex(gfx::Size(3, 3), gfx::Size(4, 3), true, 5));
373 }
374
277 TEST(TilingDataTest, FirstBorderTileXIndexFromSrcCoord) { 375 TEST(TilingDataTest, FirstBorderTileXIndexFromSrcCoord) {
278 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0)); 376 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0));
279 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1)); 377 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1));
280 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2)); 378 EXPECT_EQ(0, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2));
281 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3)); 379 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3));
282 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4)); 380 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4));
283 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5)); 381 EXPECT_EQ(1, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5));
284 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6)); 382 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6));
285 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7)); 383 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7));
286 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8)); 384 EXPECT_EQ(2, MinBorderXIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8));
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0)); 521 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0));
424 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1)); 522 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1));
425 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2)); 523 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2));
426 524
427 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 0)); 525 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 0));
428 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 1)); 526 EXPECT_EQ(0, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 1));
429 EXPECT_EQ(1, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 2)); 527 EXPECT_EQ(1, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 2));
430 EXPECT_EQ(1, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 3)); 528 EXPECT_EQ(1, YIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 3));
431 } 529 }
432 530
531 TEST(TilingDataTest, TileAbsoluteYIndexFromSrcCoord) {
532 EXPECT_EQ(-2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -4));
533 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -3));
534 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -2));
535 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, -1));
536 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0));
537 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1));
538 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2));
539 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3));
540 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4));
541 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5));
542 EXPECT_EQ(2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6));
543 EXPECT_EQ(2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7));
544 EXPECT_EQ(2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8));
545 EXPECT_EQ(3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 9));
546 EXPECT_EQ(3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 10));
547 EXPECT_EQ(3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 11));
548 EXPECT_EQ(4, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 12));
549
550 EXPECT_EQ(-4, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -4));
551 EXPECT_EQ(-3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -3));
552 EXPECT_EQ(-2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -2));
553 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, -1));
554 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 0));
555 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 1));
556 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 2));
557 EXPECT_EQ(2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 3));
558 EXPECT_EQ(3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 4));
559 EXPECT_EQ(4, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 5));
560 EXPECT_EQ(5, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 6));
561 EXPECT_EQ(6, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 7));
562 EXPECT_EQ(7, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 8));
563 EXPECT_EQ(7, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 9));
564 EXPECT_EQ(8, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 10));
565 EXPECT_EQ(9, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 11));
566 EXPECT_EQ(10, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(10, 10), true, 12));
567
568 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, -1));
569 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, 0));
570 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), false, 1));
571 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, -1));
572 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 0));
573 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 1));
574 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), false, 2));
575 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, -1));
576 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 0));
577 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 1));
578 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 2));
579 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), false, 3));
580
581 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, -2));
582 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, -1));
583 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 0));
584 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 1));
585 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 2));
586 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 3));
587 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 4));
588 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), false, 5));
589
590 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, -1));
591 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, 0));
592 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(1, 1), gfx::Size(1, 1), true, 1));
593 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, -1));
594 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 0));
595 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 1));
596 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(2, 2), gfx::Size(2, 2), true, 2));
597 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, -1));
598 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 0));
599 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 1));
600 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 2));
601 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 3), true, 3));
602
603 EXPECT_EQ(-2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, -2));
604 EXPECT_EQ(-1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, -1));
605 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 0));
606 EXPECT_EQ(0, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 1));
607 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 2));
608 EXPECT_EQ(1, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 3));
609 EXPECT_EQ(2, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 4));
610 EXPECT_EQ(3, AbsoluteYIndex(gfx::Size(3, 3), gfx::Size(3, 4), true, 5));
611 }
612
433 TEST(TilingDataTest, FirstBorderTileYIndexFromSrcCoord) { 613 TEST(TilingDataTest, FirstBorderTileYIndexFromSrcCoord) {
434 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0)); 614 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 0));
435 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1)); 615 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 1));
436 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2)); 616 EXPECT_EQ(0, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 2));
437 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3)); 617 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 3));
438 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4)); 618 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 4));
439 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5)); 619 EXPECT_EQ(1, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 5));
440 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6)); 620 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 6));
441 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7)); 621 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 7));
442 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8)); 622 EXPECT_EQ(2, MinBorderYIndex(gfx::Size(3, 3), gfx::Size(10, 10), false, 8));
(...skipping 917 matching lines...) Expand 10 before | Expand all | Expand 10 after
1360 } 1540 }
1361 1541
1362 TEST(TilingDataTest, DifferenceIteratorNoTiles) { 1542 TEST(TilingDataTest, DifferenceIteratorNoTiles) {
1363 TilingData data(gfx::Size(100, 100), gfx::Size(), false); 1543 TilingData data(gfx::Size(100, 100), gfx::Size(), false);
1364 TestDiff(data, gfx::Rect(100, 100), gfx::Rect(5, 5), 0); 1544 TestDiff(data, gfx::Rect(100, 100), gfx::Rect(5, 5), 0);
1365 } 1545 }
1366 1546
1367 } // namespace 1547 } // namespace
1368 1548
1369 } // namespace cc 1549 } // namespace cc
OLDNEW
« no previous file with comments | « cc/base/tiling_data.cc ('k') | cc/tiles/tiling_set_eviction_queue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698