From 75fd21164ea6646afa1f6f6f79bba1016ec6416b Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 18 Jan 2011 19:21:36 -0300 Subject: [PATCH] Fix color_utils::color_for_image() when the color is of index type and the imgtype is indexed. --- src/app/color_utils.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/color_utils.cpp b/src/app/color_utils.cpp index 823626162..293f68b05 100644 --- a/src/app/color_utils.cpp +++ b/src/app/color_utils.cpp @@ -123,7 +123,10 @@ int color_utils::color_for_image(const Color& color, int imgtype) c = _graya(color.getGray(), 255); break; case IMAGE_INDEXED: - c = get_current_palette()->findBestfit(color.getRed(), color.getGreen(), color.getBlue()); + if (color.getType() == Color::IndexType) + c = color.getIndex(); + else + c = get_current_palette()->findBestfit(color.getRed(), color.getGreen(), color.getBlue()); break; }