mirror of
https://github.com/HackPlan/atom-shell.git
synced 2026-04-29 12:15:38 +08:00
mac: Convert from ImageSkia to NSImage to reserve DPI info.
This commit is contained in:
@@ -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()];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user