why did I think that using remove_if was a good idea
This commit is contained in:
parent
e1cfbff5a8
commit
535e6e0e4a
4 changed files with 12 additions and 14 deletions
|
@ -25,8 +25,8 @@ Napi::Value Freeze(const Napi::CallbackInfo &info) {
|
|||
Napi::Object result = Napi::Object::New(env);
|
||||
|
||||
char *fileData = data.Data();
|
||||
char *match = "\x21\xFF\x0BNETSCAPE2.0\x03\x01";
|
||||
char *descriptor = "\x2C\x00\x00\x00\x00";
|
||||
char *match = (char *)"\x21\xFF\x0BNETSCAPE2.0\x03\x01";
|
||||
char *descriptor = (char *)"\x2C\x00\x00\x00\x00";
|
||||
char *lastPos;
|
||||
|
||||
bool none = true;
|
||||
|
|
|
@ -32,7 +32,7 @@ Napi::Value Speed(const Napi::CallbackInfo &info) {
|
|||
|
||||
char *fileData = data.Data();
|
||||
|
||||
char *match = "\x00\x21\xF9\x04";
|
||||
char *match = (char *)"\x00\x21\xF9\x04";
|
||||
|
||||
// if passed a delay, use that. otherwise iterate over every frame.
|
||||
if (delay == 0) {
|
||||
|
@ -98,9 +98,8 @@ Napi::Value Speed(const Napi::CallbackInfo &info) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < speed - 1; ++i) {
|
||||
frames.remove_if([counter = 0](const auto x) mutable {
|
||||
return ++counter % 2 == 0;
|
||||
});
|
||||
auto it = frames.begin();
|
||||
while(it != frames.end() && ++it != frames.end()) it = frames.erase(it);
|
||||
}
|
||||
|
||||
for_each(frames.begin(), frames.end(), magickImage(type));
|
||||
|
@ -142,9 +141,8 @@ Napi::Value Speed(const Napi::CallbackInfo &info) {
|
|||
}
|
||||
|
||||
for (int i = 0; i < speed - 1; ++i) {
|
||||
frames.remove_if([counter = 0](const auto x) mutable {
|
||||
return ++counter % 2 == 0;
|
||||
});
|
||||
auto it = frames.begin();
|
||||
while(it != frames.end() && ++it != frames.end()) it = frames.erase(it);
|
||||
}
|
||||
|
||||
for_each(frames.begin(), frames.end(), magickImage(type));
|
||||
|
|
|
@ -43,7 +43,7 @@ Napi::Value Spin(const Napi::CallbackInfo &info) {
|
|||
image.virtualPixelMethod(Magick::TransparentVirtualPixelMethod);
|
||||
image.scale(Geometry("256x256"));
|
||||
image.alphaChannel(Magick::SetAlphaChannel);
|
||||
double rotation[1] = {360 * i / coalesced.size()};
|
||||
double rotation[1] = {(double)360 * i / coalesced.size()};
|
||||
image.distort(Magick::ScaleRotateTranslateDistortion, 1, rotation);
|
||||
image.magick("GIF");
|
||||
mid.push_back(image);
|
||||
|
|
Loading…
Reference in a new issue