From 4f66bc51cd4b2333db0c511d2bb53f1becc9ff38 Mon Sep 17 00:00:00 2001 From: Essem Date: Mon, 6 Jun 2022 19:16:14 -0500 Subject: [PATCH] Some cleanup --- natives/colors.cc | 2 -- natives/deepfry.cc | 10 ++++++---- natives/uncaption.cc | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/natives/colors.cc b/natives/colors.cc index 7489e3d..dc91a4f 100644 --- a/natives/colors.cc +++ b/natives/colors.cc @@ -14,8 +14,6 @@ Napi::Value Colors(const Napi::CallbackInfo &info) { try { Napi::Object obj = info[0].As(); Napi::Buffer data = obj.Get("data").As>(); - bool old = - obj.Has("old") ? obj.Get("old").As().Value() : false; string color = obj.Get("color").As().Utf8Value(); string type = obj.Get("type").As().Utf8Value(); int delay = diff --git a/natives/deepfry.cc b/natives/deepfry.cc index 8c62998..5019e40 100644 --- a/natives/deepfry.cc +++ b/natives/deepfry.cc @@ -17,10 +17,12 @@ Napi::Value Deepfry(const Napi::CallbackInfo &info) { Napi::Object result = Napi::Object::New(env); - VImage in = VImage::new_from_buffer( - data.Data(), data.Length(), "", - VImage::option()->set("access", "sequential")->set("n", -1)) - .colourspace(VIPS_INTERPRETATION_sRGB); + VOption *options = VImage::option()->set("access", "sequential"); + + VImage in = + VImage::new_from_buffer(data.Data(), data.Length(), "", + type == "gif" ? options->set("n", -1) : options) + .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255); int page_height = vips_image_get_page_height(in.get_image()); diff --git a/natives/uncaption.cc b/natives/uncaption.cc index 9a56cc7..726103b 100644 --- a/natives/uncaption.cc +++ b/natives/uncaption.cc @@ -18,11 +18,11 @@ Napi::Value Uncaption(const Napi::CallbackInfo &info) { int delay = obj.Has("delay") ? obj.Get("delay").As().Int32Value() : 0; - VOption *options = VImage::option()->set("access", "sequential"); + VOption *options = VImage::option(); VImage in = VImage::new_from_buffer(data.Data(), data.Length(), "", - type == "gif" ? options->set("n", -1) : options) + type == "gif" ? options->set("n", -1)->set("access", "sequential") : options) .colourspace(VIPS_INTERPRETATION_sRGB); if (!in.has_alpha()) in = in.bandjoin(255);