mac: Convert from ImageSkia to NSImage to reserve DPI info.

This commit is contained in:
Cheng Zhao 2014-06-23 12:59:10 +08:00
parent 17842e06aa
commit 6cac69238c

View file

@ -6,7 +6,7 @@
#include "atom/browser/ui/cocoa/atom_menu_controller.h" #include "atom/browser/ui/cocoa/atom_menu_controller.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "skia/ext/skia_utils_mac.h" #include "ui/gfx/image/image.h"
@interface StatusItemController : NSObject { @interface StatusItemController : NSObject {
atom::TrayIconCocoa* trayIcon_; // weak atom::TrayIconCocoa* trayIcon_; // weak
@ -50,17 +50,17 @@ TrayIconCocoa::~TrayIconCocoa() {
void TrayIconCocoa::SetImage(const gfx::ImageSkia& image) { void TrayIconCocoa::SetImage(const gfx::ImageSkia& image) {
if (!image.isNull()) { if (!image.isNull()) {
NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap()); gfx::Image neutral(image);
if (ns_image) if (!neutral.IsEmpty())
[item_ setImage:ns_image]; [item_ setImage:neutral.ToNSImage()];
} }
} }
void TrayIconCocoa::SetPressedImage(const gfx::ImageSkia& image) { void TrayIconCocoa::SetPressedImage(const gfx::ImageSkia& image) {
if (!image.isNull()) { if (!image.isNull()) {
NSImage* ns_image = gfx::SkBitmapToNSImage(*image.bitmap()); gfx::Image neutral(image);
if (ns_image) if (!neutral.IsEmpty())
[item_ setAlternateImage:ns_image]; [item_ setAlternateImage:neutral.ToNSImage()];
} }
} }