]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/rgncmn.cpp
[ 1493802 ] Allow multiple wxComboCtrl::SetPopupControl calls.
[wxWidgets.git] / src / common / rgncmn.cpp
index 2b1b5b6600a5b234021b58cc2d7e1043524c1ae7..a32f24e8cf25a6089db563e2c8bf1e4233a6db0f 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        rgncmn.cpp
+// Name:        src/common/rgncmn.cpp
 // Purpose:     Methods of wxRegion that have a generic implementation
 // Author:      Robin Dunn
 // Modified by:
@@ -9,24 +9,24 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "rgncmn.h"
-#endif
-
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #include "wx/region.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/dcmemory.h"
+#endif //WX_PRECOMP
+
 #include "wx/bitmap.h"
+
 #if wxUSE_IMAGE
-#include "wx/image.h"
+    #include "wx/image.h"
 #endif
-#include "wx/dcmemory.h"
 
 
 //---------------------------------------------------------------------------
@@ -60,9 +60,9 @@ static bool DoRegionUnion(wxRegion& region,
 {
     unsigned char hiR, hiG, hiB;
 
-    hiR = wxMin(0xFF, loR + tolerance);
-    hiG = wxMin(0xFF, loG + tolerance);
-    hiB = wxMin(0xFF, loB + tolerance);
+    hiR = (unsigned char)wxMin(0xFF, loR + tolerance);
+    hiG = (unsigned char)wxMin(0xFF, loG + tolerance);
+    hiB = (unsigned char)wxMin(0xFF, loB + tolerance);
 
     // Loop through the image row by row, pixel by pixel, building up
     // rectangles to add to the region.
@@ -101,10 +101,11 @@ static bool DoRegionUnion(wxRegion& region,
 
     return true;
 }
+
 
 bool wxRegion::Union(const wxBitmap& bmp)
 {
+#if (!defined(__WXMSW__) || wxUSE_WXDIB)
     if (bmp.GetMask())
     {
         wxImage image = bmp.ConvertToImage();
@@ -116,6 +117,7 @@ bool wxRegion::Union(const wxBitmap& bmp)
                              0);
     }
     else
+#endif
     {
         return Union(0, 0, bmp.GetWidth(), bmp.GetHeight());
     }
@@ -125,12 +127,16 @@ bool wxRegion::Union(const wxBitmap& bmp,
                      const wxColour& transColour,
                      int   tolerance)
 {
+#if (!defined(__WXMSW__) || wxUSE_WXDIB)
     wxImage image = bmp.ConvertToImage();
     return DoRegionUnion(*this, image,
                          transColour.Red(),
                          transColour.Green(),
                          transColour.Blue(),
                          tolerance);
+#else
+    return false;
+#endif
 }
 
 #else