Add deprecated comment to scaleFactor parameter
This commit is contained in:
parent
3b259b4243
commit
8680a08a8d
2 changed files with 10 additions and 2 deletions
|
@ -410,13 +410,14 @@ mate::Handle<NativeImage> NativeImage::CreateFromBuffer(
|
||||||
int height = 0;
|
int height = 0;
|
||||||
double scale_factor = 1.;
|
double scale_factor = 1.;
|
||||||
|
|
||||||
args->GetNext(&scale_factor);
|
|
||||||
|
|
||||||
mate::Dictionary options;
|
mate::Dictionary options;
|
||||||
if (args->GetNext(&options)) {
|
if (args->GetNext(&options)) {
|
||||||
options.Get("width", &width);
|
options.Get("width", &width);
|
||||||
options.Get("height", &height);
|
options.Get("height", &height);
|
||||||
options.Get("scaleFactor", &scale_factor);
|
options.Get("scaleFactor", &scale_factor);
|
||||||
|
} else {
|
||||||
|
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
|
||||||
|
args->GetNext(&scale_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::ImageSkia image_skia;
|
gfx::ImageSkia image_skia;
|
||||||
|
|
|
@ -44,6 +44,13 @@ describe('nativeImage module', () => {
|
||||||
const imageH = nativeImage.createFromBuffer(imageA.toJPEG(100),
|
const imageH = nativeImage.createFromBuffer(imageA.toJPEG(100),
|
||||||
{width: 100, height: 200})
|
{width: 100, height: 200})
|
||||||
assert.deepEqual(imageH.getSize(), {width: 538, height: 190})
|
assert.deepEqual(imageH.getSize(), {width: 538, height: 190})
|
||||||
|
|
||||||
|
const imageI = nativeImage.createFromBuffer(imageA.toBitmap(),
|
||||||
|
{width: 538, height: 190, scaleFactor: 2.0})
|
||||||
|
assert.deepEqual(imageI.getSize(), {width: 269, height: 95})
|
||||||
|
|
||||||
|
const imageJ = nativeImage.createFromBuffer(imageA.toPNG(), 2.0)
|
||||||
|
assert.deepEqual(imageJ.getSize(), {width: 269, height: 95})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue