diff --git a/src/render/error_diffusion.cpp b/src/render/error_diffusion.cpp index 75f874114..49336e3f6 100644 --- a/src/render/error_diffusion.cpp +++ b/src/render/error_diffusion.cpp @@ -64,15 +64,14 @@ doc::color_t ErrorDiffusionDither::ditherRgbToIndex2D( doc::rgba_getb(color), doc::rgba_geta(color) }; - int u[kChannels]; for (int i=0; imapColor(u[0], u[1], u[2], u[3]): - palette->findBestfit(u[0], u[1], u[2], u[3], m_transparentIndex)); + (rgbmap ? rgbmap->mapColor(v[0], v[1], v[2], v[3]): + palette->findBestfit(v[0], v[1], v[2], v[3], m_transparentIndex)); doc::color_t palColor = palette->getEntry(index); if (m_transparentIndex == index || doc::rgba_geta(palColor) == 0) { @@ -90,10 +89,17 @@ doc::color_t ErrorDiffusionDither::ditherRgbToIndex2D( // TODO using Floyd-Steinberg matrix here but it should be configurable for (int i=0; i