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

Unified Diff: ash/desktop_background/desktop_background_view.cc

Issue 2039173003: [Merge to M52]Fill the canvas with black background before painting wallpaper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/desktop_background/desktop_background_view.cc
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index 04311087b32f677f6f7683bda9398d8ab094c045..83cd5b998dbacd9410c9b9ad979cd22c9015e086 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -138,10 +138,13 @@ void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) {
gfx::ImageSkia wallpaper = controller->GetWallpaper();
WallpaperLayout wallpaper_layout = controller->GetWallpaperLayout();
- if (wallpaper.isNull()) {
- canvas->FillRect(GetLocalBounds(), SK_ColorBLACK);
+ // Wallpapers with png format could be partially transparent.
+ // Fill the canvas with black background to make it opaque
+ // before painting wallpaper
+ canvas->FillRect(GetLocalBounds(), SK_ColorBLACK);
+
+ if (wallpaper.isNull())
return;
- }
if (wallpaper_layout == WALLPAPER_LAYOUT_CENTER_CROPPED) {
// The dimension with the smallest ratio must be cropped, the other one
@@ -177,8 +180,6 @@ void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) {
canvas->DrawImageInt(wallpaper, 0, 0, wallpaper.width(),
wallpaper.height(), 0, 0, width(), height(), true);
} else {
- // Fill with black to make sure that the entire area is opaque.
- canvas->FillRect(GetLocalBounds(), SK_ColorBLACK);
float image_scale = canvas->image_scale();
gfx::Rect wallpaper_rect(0, 0, wallpaper.width() / image_scale,
wallpaper.height() / image_scale);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698