Check continueTask per-line, not per-pixel

This commit is contained in:
David Thomas 2025-06-13 15:36:18 +01:00
parent 87fc82a978
commit 484f8d69bf
No known key found for this signature in database
GPG Key ID: 553E822E460EE293
1 changed files with 5 additions and 14 deletions

View File

@ -240,14 +240,11 @@ void dither_rgb_image_to_indexed(DitheringAlgorithmBase& algorithm,
ASSERT(srcIt != srcBits.end()); ASSERT(srcIt != srcBits.end());
ASSERT(dstIt != dstBits.end()); ASSERT(dstIt != dstBits.end());
*dstIt = algorithm.ditherRgbPixelToIndex(dithering.matrix(), *srcIt, x, y, rgbmap, palette); *dstIt = algorithm.ditherRgbPixelToIndex(dithering.matrix(), *srcIt, x, y, rgbmap, palette);
}
if (delegate) { if (delegate) {
if (!delegate->continueTask()) if (!delegate->continueTask())
return; return;
}
}
if (delegate) {
delegate->notifyTaskProgress(double(y + 1) / double(h)); delegate->notifyTaskProgress(double(y + 1) / double(h));
} }
} }
@ -262,10 +259,6 @@ void dither_rgb_image_to_indexed(DitheringAlgorithmBase& algorithm,
for (int x = w - 1; x >= 0; --x, --dstIt) { for (int x = w - 1; x >= 0; --x, --dstIt) {
ASSERT(dstIt == doc::get_pixel_address_fast<doc::IndexedTraits>(dstImage, x, y)); ASSERT(dstIt == doc::get_pixel_address_fast<doc::IndexedTraits>(dstImage, x, y));
*dstIt = algorithm.ditherRgbToIndex2D(x, y, rgbmap, palette, -1); *dstIt = algorithm.ditherRgbToIndex2D(x, y, rgbmap, palette, -1);
if (delegate) {
if (!delegate->continueTask())
return;
}
} }
dstIt += w + 1; dstIt += w + 1;
} }
@ -273,14 +266,12 @@ void dither_rgb_image_to_indexed(DitheringAlgorithmBase& algorithm,
for (int x = 0; x < w; ++x, ++dstIt) { for (int x = 0; x < w; ++x, ++dstIt) {
ASSERT(dstIt == doc::get_pixel_address_fast<doc::IndexedTraits>(dstImage, x, y)); ASSERT(dstIt == doc::get_pixel_address_fast<doc::IndexedTraits>(dstImage, x, y));
*dstIt = algorithm.ditherRgbToIndex2D(x, y, rgbmap, palette, +1); *dstIt = algorithm.ditherRgbToIndex2D(x, y, rgbmap, palette, +1);
}
}
if (delegate) { if (delegate) {
if (!delegate->continueTask()) if (!delegate->continueTask())
return; return;
}
}
}
if (delegate) {
delegate->notifyTaskProgress(double(y + 1) / double(h)); delegate->notifyTaskProgress(double(y + 1) / double(h));
} }
} }