Simplify StaySequential operation (#4074)

This commit is contained in:
Kleis Auke Wolthuizen
2024-04-19 15:47:49 +02:00
committed by GitHub
parent 36e60bf040
commit aa8bc19362
4 changed files with 20 additions and 21 deletions

View File

@@ -1081,11 +1081,10 @@ namespace sharp {
/*
Ensure decoding remains sequential.
*/
VImage StaySequential(VImage image, VipsAccess access, bool condition) {
static const char* meta = "sharp-copy-memory";
if (access == VIPS_ACCESS_SEQUENTIAL && condition && image.get_typeof(meta) != G_TYPE_INT) {
image = image.copy_memory();
image.set(meta, 1);
VImage StaySequential(VImage image, bool condition) {
if (vips_image_is_sequential(image.get_image()) && condition) {
image = image.copy_memory().copy();
image.remove(VIPS_META_SEQUENTIAL);
}
return image;
}