Fix converting SkColor to NSColor

Close #4992.
This commit is contained in:
Cheng Zhao 2016-04-02 21:17:38 +09:00
parent cb470cb94b
commit 1980d85f3e

View file

@ -19,6 +19,7 @@
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "native_mate/dictionary.h" #include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h"
#include "ui/gfx/skia_util.h" #include "ui/gfx/skia_util.h"
namespace { namespace {
@ -805,12 +806,8 @@ bool NativeWindowMac::IsKiosk() {
} }
void NativeWindowMac::SetBackgroundColor(const std::string& color_name) { void NativeWindowMac::SetBackgroundColor(const std::string& color_name) {
SkColor background_color = ParseHexColor(color_name); SkColor color = ParseHexColor(color_name);
NSColor *color = [NSColor colorWithCalibratedRed:SkColorGetR(background_color) [window_ setBackgroundColor:skia::SkColorToCalibratedNSColor(color)];
green:SkColorGetG(background_color)
blue:SkColorGetB(background_color)
alpha:SkColorGetA(background_color)/255.0f];
[window_ setBackgroundColor:color];
} }
void NativeWindowMac::SetHasShadow(bool has_shadow) { void NativeWindowMac::SetHasShadow(bool has_shadow) {