moves bitmap parameters to options object

This commit is contained in:
gellert 2016-12-13 21:30:45 +01:00
parent 39875c90f1
commit a609e52a14
3 changed files with 16 additions and 10 deletions

View file

@ -408,14 +408,17 @@ mate::Handle<NativeImage> NativeImage::CreateFromBuffer(
mate::Arguments* args, v8::Local<v8::Value> buffer) {
int width = 0;
int height = 0;
if (args->Length() >= 3) {
args->GetNext(&width);
args->GetNext(&height);
}
double scale_factor = 1.;
args->GetNext(&scale_factor);
mate::Dictionary options;
if (args->GetNext(&options)) {
options.Get("width", &width);
options.Get("height", &height);
options.Get("scaleFactor", &scale_factor);
}
gfx::ImageSkia image_skia;
AddImageSkiaRep(&image_skia,
reinterpret_cast<unsigned char*>(node::Buffer::Data(buffer)),