From 314b9fdd63cd4695b54bb7527f809149d265eb28 Mon Sep 17 00:00:00 2001
From: Dave Hawkes <daveh-wine@cadlink.com>
Date: Tue, 5 Feb 2002 19:44:07 +0000
Subject: [PATCH] Fix for GetNearestColor so it returns the true color rather
 than the system palette if the device does not support a palette.

---
 objects/palette.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/objects/palette.c b/objects/palette.c
index 1c020b1408e..9339e32517b 100644
--- a/objects/palette.c
+++ b/objects/palette.c
@@ -618,6 +618,9 @@ COLORREF WINAPI GetNearestColor(
     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 );
-- 
GitLab