From 9c547dc321ca4b6cb366f428bcc356f2222bb303 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Mon, 10 Jul 2023 13:36:26 +0100 Subject: [PATCH] Use copy rather than cache to prevent affine overcompute More predictable behaviour, see commit 14c3346 for context --- src/pipeline.cc | 2 +- test/unit/extract.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pipeline.cc b/src/pipeline.cc index 26cf68f3..a7b1b7fa 100644 --- a/src/pipeline.cc +++ b/src/pipeline.cc @@ -119,7 +119,7 @@ class PipelineWorker : public Napi::AsyncWorker { MultiPageUnsupported(nPages, "Rotate"); std::vector background; std::tie(image, background) = sharp::ApplyAlpha(image, baton->rotationBackground, FALSE); - image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background)).cache(); + image = image.rotate(baton->rotationAngle, VImage::option()->set("background", background)).copy_memory(); } } diff --git a/test/unit/extract.js b/test/unit/extract.js index efbb7581..760e90ef 100644 --- a/test/unit/extract.js +++ b/test/unit/extract.js @@ -180,7 +180,7 @@ describe('Partial image extraction', function () { if (err) throw err; assert.strictEqual(380, info.width); assert.strictEqual(280, info.height); - fixtures.assertSimilar(fixtures.expected('rotate-extract-45.jpg'), data, { threshold: 7 }, done); + fixtures.assertSimilar(fixtures.expected('rotate-extract-45.jpg'), data, done); }); });