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

Unified Diff: ui/gfx/compositor/layer_unittest.cc

Issue 8558033: Revert 110783 - Adds a bounds parameter to ui::Compositor::ReadPixels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/compositor/compositor_gl.cc ('k') | ui/gfx/compositor/test/test_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/compositor/layer_unittest.cc
===================================================================
--- ui/gfx/compositor/layer_unittest.cc (revision 110784)
+++ ui/gfx/compositor/layer_unittest.cc (working copy)
@@ -170,11 +170,6 @@
GetCompositor()->Draw(false);
}
- bool ReadPixels(SkBitmap* bitmap) {
- return GetCompositor()->ReadPixels(bitmap,
- gfx::Rect(GetCompositor()->size()));
- }
-
void RunPendingMessages() {
MessageLoopForUI::current()->RunAllPending();
}
@@ -1093,24 +1088,16 @@
TEST_F(LayerWithRealCompositorTest, MAYBE_DrawPixels) {
scoped_ptr<Layer> layer(CreateColorLayer(SK_ColorRED,
gfx::Rect(0, 0, 500, 500)));
- scoped_ptr<Layer> layer2(CreateColorLayer(SK_ColorBLUE,
- gfx::Rect(0, 0, 500, 10)));
-
- layer->Add(layer2.get());
-
DrawTree(layer.get());
SkBitmap bitmap;
- gfx::Size size = GetCompositor()->size();
- ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap,
- gfx::Rect(0, 10,
- size.width(), size.height() - 10)));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
SkAutoLockPixels lock(bitmap);
bool is_all_red = true;
for (int x = 0; is_all_red && x < 500; x++)
- for (int y = 0; is_all_red && y < 490; y++)
+ for (int y = 0; is_all_red && y < 500; y++)
is_all_red = is_all_red && (bitmap.getColor(x, y) == SK_ColorRED);
EXPECT_TRUE(is_all_red);
@@ -1236,14 +1223,14 @@
l11->Add(l21.get());
l0->Add(l12.get());
DrawTree(l0.get());
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
// WritePNGFile(bitmap, ref_img1);
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1));
l0->MoveToFront(l11.get());
DrawTree(l0.get());
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
// WritePNGFile(bitmap, ref_img2);
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2));
@@ -1251,21 +1238,21 @@
// l11 is already at the front, should have no effect.
l0->MoveToFront(l11.get());
DrawTree(l0.get());
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2));
// l11 is already at the front, should have no effect.
l0->MoveAbove(l11.get(), l12.get());
DrawTree(l0.get());
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img2));
// should restore to original configuration
l0->MoveAbove(l12.get(), l11.get());
DrawTree(l0.get());
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img1));
}
@@ -1288,7 +1275,7 @@
l0->Add(l11.get());
DrawTree(l0.get());
SkBitmap bitmap;
- ASSERT_TRUE(ReadPixels(&bitmap));
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
ASSERT_FALSE(bitmap.empty());
// WritePNGFile(bitmap, ref_img);
EXPECT_TRUE(IsSameAsPNGFile(bitmap, ref_img));
« no previous file with comments | « ui/gfx/compositor/compositor_gl.cc ('k') | ui/gfx/compositor/test/test_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698