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

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
« no previous file with comments | « no previous file | ash/wm/workspace/frame_maximize_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ac0afdc0b0eb60507113252b79ee0dd99478c9da..72b8984e24d71a1a526ab5efe841baa3772e1fa4 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"
@@ -60,21 +61,19 @@ 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));
// The original width of the image looks too big, so we need to inset
// it somewhat.
- SkIRect region = SkIRect::MakeXYWH(
- kNotificationImageIconInset, image_index * kNotificationImageIconHeight,
- kNotificationImageIconWidth - 2 * kNotificationImageIconInset,
- kNotificationImageIconHeight);
-
- all.ToSkBitmap()->extractSubset(&image, region);
- return image;
+ gfx::Rect region(
+ kNotificationImageIconInset,
+ image_index * kNotificationImageIconHeight,
+ kNotificationImageIconWidth - 2 * kNotificationImageIconInset,
+ kNotificationImageIconHeight);
+ return gfx::ImageSkiaOperations::ExtractSubset(*image, region);
}
} // namespace
@@ -878,7 +877,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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698