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

Unified Diff: cc/playback/display_list_raster_source_unittest.cc

Issue 1318733006: cc: Do the math for a tile's content rect in layer space once. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/playback/display_list_raster_source_unittest.cc
diff --git a/cc/playback/display_list_raster_source_unittest.cc b/cc/playback/display_list_raster_source_unittest.cc
index 922ba00a9296fe3367592fde9bd4a26feb9d7dea..499a555ca47b4dec81cd15189e308b94a720ec4e 100644
--- a/cc/playback/display_list_raster_source_unittest.cc
+++ b/cc/playback/display_list_raster_source_unittest.cc
@@ -201,23 +201,7 @@ TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) {
// Tile sized iterators. These should find only one pixel ref.
{
std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 1.0, &pixel_refs);
- EXPECT_EQ(1u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(gfx::RectF(32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 2.0, &pixel_refs);
- EXPECT_EQ(1u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(gfx::RectF(32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 128, 128), 0.5, &pixel_refs);
+ raster->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), &pixel_refs);
EXPECT_EQ(1u, pixel_refs.size());
EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
EXPECT_EQ(gfx::RectF(32, 32).ToString(),
@@ -226,23 +210,7 @@ TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) {
// Shifted tile sized iterators. These should find only one pixel ref.
{
std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(260, 260, 256, 256), 1.0, &pixel_refs);
- EXPECT_EQ(1u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[1][1].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(gfx::RectF(260, 260, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(520, 520, 512, 512), 2.0, &pixel_refs);
- EXPECT_EQ(1u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[1][1].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(gfx::RectF(260, 260, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(130, 130, 128, 128), 0.5, &pixel_refs);
+ raster->GatherPixelRefs(gfx::Rect(260, 260, 256, 256), &pixel_refs);
EXPECT_EQ(1u, pixel_refs.size());
EXPECT_EQ(discardable_bitmap[1][1].pixelRef(), pixel_refs[0].pixel_ref);
EXPECT_EQ(gfx::RectF(260, 260, 32, 32).ToString(),
@@ -251,41 +219,13 @@ TEST(DisplayListRasterSourceTest, PixelRefIteratorDiscardableRefsOneTile) {
// Ensure there's no discardable pixel refs in the empty cell
{
std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 256, 256, 256), 1.0, &pixel_refs);
+ raster->GatherPixelRefs(gfx::Rect(0, 256, 256, 256), &pixel_refs);
EXPECT_EQ(0u, pixel_refs.size());
}
// Layer sized iterators. These should find three pixel ref.
{
std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), 1.0, &pixel_refs);
- EXPECT_EQ(3u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(discardable_bitmap[0][1].pixelRef(), pixel_refs[1].pixel_ref);
- EXPECT_EQ(discardable_bitmap[1][1].pixelRef(), pixel_refs[2].pixel_ref);
- EXPECT_EQ(gfx::RectF(32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- EXPECT_EQ(gfx::RectF(260, 0, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect).ToString());
- EXPECT_EQ(gfx::RectF(260, 260, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 1024, 1024), 2.0, &pixel_refs);
- EXPECT_EQ(3u, pixel_refs.size());
- EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
- EXPECT_EQ(discardable_bitmap[0][1].pixelRef(), pixel_refs[1].pixel_ref);
- EXPECT_EQ(discardable_bitmap[1][1].pixelRef(), pixel_refs[2].pixel_ref);
- EXPECT_EQ(gfx::RectF(32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect).ToString());
- EXPECT_EQ(gfx::RectF(260, 0, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect).ToString());
- EXPECT_EQ(gfx::RectF(260, 260, 32, 32).ToString(),
- gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect).ToString());
- }
- {
- std::vector<skia::PositionPixelRef> pixel_refs;
- raster->GatherPixelRefs(gfx::Rect(0, 0, 256, 256), 0.5, &pixel_refs);
+ raster->GatherPixelRefs(gfx::Rect(0, 0, 512, 512), &pixel_refs);
EXPECT_EQ(3u, pixel_refs.size());
EXPECT_EQ(discardable_bitmap[0][0].pixelRef(), pixel_refs[0].pixel_ref);
EXPECT_EQ(discardable_bitmap[0][1].pixelRef(), pixel_refs[1].pixel_ref);

Powered by Google App Engine
This is Rietveld 408576698