Fix for GetNearestColor so it returns the true color rather than the system
palette if the device does not support a palette (ie > 256 colors). This not
quite what the Windows SDK docs say, but it's what happens in practice...

Dave Hawkes

Index: objects/palette.c
===================================================================
RCS file: /home/wine/wine/objects/palette.c,v
retrieving revision 1.39
diff -u -r1.39 palette.c
--- objects/palette.c   2002/01/29 02:53:43     1.39
+++ objects/palette.c   2002/01/29 18:56:20
@@ -618,6 +618,9 @@
     DC                 *dc;
     PALETTEOBJ  *palObj;
 
+    if(!(GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)) {
+        return color;
+    }
     if ( (dc = DC_GetDCPtr( hdc )) )
     {
         HPALETTE hpal = (dc->hPalette)? dc->hPalette : GetStockObject( 
DEFAULT_PALETTE );

Reply via email to