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

Unified Diff: ash/common/wallpaper/wallpaper_controller_unittest.cc

Issue 2792133002: Paint: remove readPixels. (Closed)
Patch Set: update Created 3 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 | « no previous file | ash/laser/laser_pointer_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wallpaper/wallpaper_controller_unittest.cc
diff --git a/ash/common/wallpaper/wallpaper_controller_unittest.cc b/ash/common/wallpaper/wallpaper_controller_unittest.cc
index 4cb2fba3d0530ecaa647a807d5b6427f4dfd94a1..76a9027a952269a9b9d69ef954224714d36754ea 100644
--- a/ash/common/wallpaper/wallpaper_controller_unittest.cc
+++ b/ash/common/wallpaper/wallpaper_controller_unittest.cc
@@ -165,18 +165,15 @@ class WallpaperControllerTest : public test::AshTestBase {
gfx::Canvas canvas(size, device_scale_factor, true);
view->OnPaint(&canvas);
- int canvas_width = canvas.sk_canvas()->imageInfo().width();
- int canvas_height = canvas.sk_canvas()->imageInfo().height();
- SkBitmap bitmap;
- bitmap.allocN32Pixels(canvas_width, canvas_height);
- canvas.sk_canvas()->readPixels(&bitmap, 0, 0);
-
- for (int i = 0; i < canvas_width; i++) {
- for (int j = 0; j < canvas_height; j++) {
- if (i >= (canvas_width - image_width) / 2 &&
- i < (canvas_width + image_width) / 2 &&
- j >= (canvas_height - image_height) / 2 &&
- j < (canvas_height + image_height) / 2) {
+ SkBitmap bitmap = canvas.GetBitmap();
+ int bitmap_width = bitmap.width();
+ int bitmap_height = bitmap.height();
+ for (int i = 0; i < bitmap_width; i++) {
+ for (int j = 0; j < bitmap_height; j++) {
+ if (i >= (bitmap_width - image_width) / 2 &&
+ i < (bitmap_width + image_width) / 2 &&
+ j >= (bitmap_height - image_height) / 2 &&
+ j < (bitmap_height + image_height) / 2) {
EXPECT_EQ(color, bitmap.getColor(i, j));
} else {
EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(i, j));
« no previous file with comments | « no previous file | ash/laser/laser_pointer_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698