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

Unified Diff: tests/TileGridTest.cpp

Issue 13860011: Fixing numerical rounding edge case in SkTileGrid (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkTileGrid.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/TileGridTest.cpp
===================================================================
--- tests/TileGridTest.cpp (revision 8831)
+++ tests/TileGridTest.cpp (working copy)
@@ -178,6 +178,9 @@
SkBitmap moreThanATileBitmap;
moreThanATileBitmap.setConfig(SkBitmap::kARGB_8888_Config, 11, 11);
moreThanATileBitmap.allocPixels();
+ SkBitmap tinyBitmap;
+ tinyBitmap.setConfig(SkBitmap::kARGB_8888_Config, 2, 2);
+ tinyBitmap.allocPixels();
// Test parts of top-left tile
{
// The offset should cancel the top and left borders of the top left tile
@@ -226,6 +229,20 @@
REPORTER_ASSERT(reporter, rect2 == mockCanvas.fRects[0]);
REPORTER_ASSERT(reporter, rect3 == mockCanvas.fRects[1]);
}
+ {
+ // 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);
+ MockCanvas mockCanvas(&device);
+ mockCanvas.translate(SkFloatToScalar(-8.0f), SkFloatToScalar(-8.0f));
+ picture.draw(&mockCanvas);
+ // This test passes by not asserting. We do not validate the rects recorded
+ // because the result is numerically unstable (floating point equality).
+ // The content of any one of the four tiles of the tilegrid would be a valid
+ // result since any bbox that covers the center point of the canvas will be
+ // recorded in all four tiles.
+ }
}
static void Test(skiatest::Reporter* reporter) {
« 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