mac: Initialize gfx::ImageSkia from gfx::Image
This commit is contained in:
parent
8faab22f5e
commit
ac8a9afada
2 changed files with 20 additions and 2 deletions
|
@ -16,6 +16,8 @@
|
|||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/base/layout.h"
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
|
||||
namespace mate {
|
||||
|
||||
namespace {
|
||||
|
@ -106,7 +108,6 @@ bool Converter<gfx::ImageSkia>::FromV8(v8::Isolate* isolate,
|
|||
return PopulateImageSkiaRepsFromPath(out, path);
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
gfx::Image* out) {
|
||||
|
@ -117,6 +118,7 @@ bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
|
|||
*out = gfx::Image(image);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mate
|
||||
|
||||
#endif // !defined(OS_MACOSX)
|
||||
|
|
|
@ -10,9 +10,25 @@
|
|||
#include "base/mac/scoped_nsobject.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
|
||||
namespace mate {
|
||||
|
||||
bool Converter<gfx::ImageSkia>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
gfx::ImageSkia* out) {
|
||||
gfx::Image image;
|
||||
if (!ConvertFromV8(isolate, val, &image) || image.IsEmpty())
|
||||
return false;
|
||||
|
||||
gfx::ImageSkia image_skia = image.AsImageSkia();
|
||||
if (image_skia.isNull())
|
||||
return false;
|
||||
|
||||
*out = image_skia;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
gfx::Image* out) {
|
||||
|
|
Loading…
Add table
Reference in a new issue