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

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 10704199: Implement remaining SkBitmapOperations as ImageSkiaOperations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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: ash/system/web_notification/web_notification_tray.cc
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index bce9b2e2bba95b295d749ade53dd256dd1d9394b..9a761d8a79d04c867964c1b809d57e4491a60bcf 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -16,6 +16,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/gfx/image/image_skia_operations.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/button/menu_button_listener.h"
@@ -54,17 +55,15 @@ const int kToggleExtensionCommand = 1;
const int kShowSettingsCommand = 2;
// The image has three icons: 1 notifiaction, 2 notifications, and 3+.
-SkBitmap GetNotificationImage(int notification_count) {
- SkBitmap image;
- gfx::Image all = ui::ResourceBundle::GetSharedInstance().GetImageNamed(
- IDR_AURA_UBER_TRAY_WEB_NOTIFICATON);
+gfx::ImageSkia GetNotificationImage(int notification_count) {
+ const gfx::ImageSkia* image = ui::ResourceBundle::GetSharedInstance().
+ GetImageSkiaNamed(IDR_AURA_UBER_TRAY_WEB_NOTIFICATON);
int image_index = notification_count - 1;
image_index = std::max(0, std::min(image_index, 2));
- SkIRect region = SkIRect::MakeXYWH(
+ gfx::Rect region(
0, image_index * kNotificationImageIconHeight,
kNotificationImageIconWidth, kNotificationImageIconHeight);
- all.ToSkBitmap()->extractSubset(&image, region);
- return image;
+ return gfx::ImageSkiaOperations::ExtractSubset(*image, region);
}
} // namespace
@@ -830,7 +829,7 @@ void WebNotificationTray::UpdateIcon() {
status_area_widget_->login_status() == user::LOGGED_IN_LOCKED) {
SetVisible(false);
} else {
- icon_->SetImage(gfx::ImageSkia(GetNotificationImage(count)));
+ icon_->SetImage(GetNotificationImage(count));
SetVisible(true);
}
PreferredSizeChanged();
« no previous file with comments | « no previous file | ash/wm/workspace/frame_maximize_button.h » ('j') | chrome/browser/chromeos/status/network_menu_icon.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698