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

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

Issue 8561016: Adds a bounds parameter to ui::Compositor::ReadPixels (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nicer revision 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
Index: ui/gfx/compositor/layer_unittest.cc
diff --git a/ui/gfx/compositor/layer_unittest.cc b/ui/gfx/compositor/layer_unittest.cc
index aa16ceb94be5cac90380c21c9715ca8924ca3def..91bbc6438d96e453f226170e7a6891565819c32f 100644
--- a/ui/gfx/compositor/layer_unittest.cc
+++ b/ui/gfx/compositor/layer_unittest.cc
@@ -1007,16 +1007,24 @@ TEST_F(LayerWithNullDelegateTest, SetBoundsSchedulesPaint) {
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;
- ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap));
+ gfx::Size size = GetCompositor()->size();
+ ASSERT_TRUE(GetCompositor()->ReadPixels(&bitmap,
+ gfx::Rect(0, 10,
+ size.width(), size.height() - 10)));
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 < 500; y++)
+ for (int y = 0; is_all_red && y < 490; y++)
is_all_red = is_all_red && (bitmap.getColor(x, y) == SK_ColorRED);
EXPECT_TRUE(is_all_red);

Powered by Google App Engine
This is Rietveld 408576698