- fix for grayscale
authorFelix Domke <tmbinc@elitedvb.net>
Thu, 1 Sep 2005 00:33:15 +0000 (00:33 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Thu, 1 Sep 2005 00:33:15 +0000 (00:33 +0000)
lib/gdi/gpixmap.cpp

index dbf53838087fa3dc81b836dd6ceeecc33fb0c773..8fc263999b42df517a96fccd0157e8ee60d9e131 100644 (file)
@@ -469,6 +469,10 @@ fail:
 
 gColor gPalette::findColor(const gRGB &rgb) const
 {
 
 gColor gPalette::findColor(const gRGB &rgb) const
 {
+               /* grayscale? */
+       if (!data)
+               return (rgb.r + rgb.g + rgb.b) / 3;
+       
        int difference=1<<30, best_choice=0;
        for (int t=0; t<colors; t++)
        {
        int difference=1<<30, best_choice=0;
        for (int t=0; t<colors; t++)
        {