Fix color_utils::color_for_image() when the color is of index type and the imgtype is indexed.

This commit is contained in:
David Capello 2011-01-18 19:21:36 -03:00
parent ae918802e3
commit 75fd21164e

View File

@ -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;
}