mirror of
https://github.com/electron/electron.git
synced 2026-02-18 02:51:53 -05:00
Add converters for gfx::Image
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "ui/gfx/codec/jpeg_codec.h"
|
||||
#include "ui/gfx/codec/png_codec.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/base/layout.h"
|
||||
|
||||
@@ -120,4 +121,15 @@ bool Converter<gfx::ImageSkia>::FromV8(v8::Isolate* isolate,
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Converter<gfx::Image>::FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
gfx::Image* out) {
|
||||
gfx::ImageSkia image;
|
||||
if (!ConvertFromV8(isolate, val, &image))
|
||||
return false;
|
||||
|
||||
*out = gfx::Image(image);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mate
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "native_mate/converter.h"
|
||||
|
||||
namespace gfx {
|
||||
class Image;
|
||||
class ImageSkia;
|
||||
}
|
||||
|
||||
@@ -20,6 +21,13 @@ struct Converter<gfx::ImageSkia> {
|
||||
gfx::ImageSkia* out);
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Converter<gfx::Image> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Handle<v8::Value> val,
|
||||
gfx::Image* out);
|
||||
};
|
||||
|
||||
} // namespace mate
|
||||
|
||||
#endif // ATOM_COMMON_NATIVE_MATE_CONVERTERS_IMAGE_CONVERTER_H_
|
||||
|
||||
Reference in New Issue
Block a user