Add converters for gfx::Image
This commit is contained in:
parent
e1f0f02da9
commit
f972c38bc8
2 changed files with 20 additions and 0 deletions
|
@ -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_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue