From 0f99ce3d757a5d1b95d1821b2e0eef968ef659a7 Mon Sep 17 00:00:00 2001
From: Dimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Date: Tue, 15 Nov 2005 23:26:06 +0000
Subject: [PATCH] only remap the disabled bitmap of a toolbarbutton when
 allowed by system (settings), otherwise colour artifacts can appear

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/msw/tbar95.cpp | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp
index 754543b932..1da408f33b 100644
--- a/src/msw/tbar95.cpp
+++ b/src/msw/tbar95.cpp
@@ -679,17 +679,20 @@ bool wxToolBar::Realize()
                         wxImage imgGreyed;
                         wxCreateGreyedImage(bmp.ConvertToImage(), imgGreyed);
 
-                        // we need to have light grey background colour for
-                        // MapBitmap() to work correctly
-                        for ( int y = 0; y < h; y++ )
+                        if (doRemap)
                         {
-                            for ( int x = 0; x < w; x++ )
+                            // we need to have light grey background colour for
+                            // MapBitmap() to work correctly
+                            for ( int y = 0; y < h; y++ )
                             {
-                                if ( imgGreyed.IsTransparent(x, y) )
-                                    imgGreyed.SetRGB(x, y,
-                                                     wxLIGHT_GREY->Red(),
-                                                     wxLIGHT_GREY->Green(),
-                                                     wxLIGHT_GREY->Blue());
+                                for ( int x = 0; x < w; x++ )
+                                {
+                                    if ( imgGreyed.IsTransparent(x, y) )
+                                        imgGreyed.SetRGB(x, y,
+                                                         wxLIGHT_GREY->Red(),
+                                                         wxLIGHT_GREY->Green(),
+                                                         wxLIGHT_GREY->Blue());
+                                }
                             }
                         }
 
@@ -697,7 +700,10 @@ bool wxToolBar::Realize()
                     }
 #endif // wxUSE_IMAGE
 
-                    MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
+                    if (doRemap)
+                    {
+                        MapBitmap(bmpDisabled.GetHBITMAP(), w, h);
+                    }
 
                     m_disabledImgList->Add(bmpDisabled);
                 }
-- 
2.45.2