]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/image.cpp
fix for calculating the header window height (patch 805791)
[wxWidgets.git] / src / common / image.cpp
index 5192bc06d82624615a223c22b73fd72852bd5a86..b24e45100f4bd02c321e5cbe8c779ebd39134ddb 100644 (file)
@@ -7,7 +7,7 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
 #pragma implementation "image.h"
 #endif
 
@@ -219,6 +219,11 @@ wxImage wxImage::Copy() const
 
     memcpy( data, GetData(), M_IMGDATA->m_width*M_IMGDATA->m_height*3 );
 
+    // also copy the image options
+    wxImageRefData *imgData = (wxImageRefData *)image.m_refData;
+    imgData->m_optionNames = M_IMGDATA->m_optionNames;
+    imgData->m_optionValues = M_IMGDATA->m_optionValues;
+
     return image;
 }
 
@@ -303,9 +308,9 @@ wxImage wxImage::ShrinkBy( int xFactor , int yFactor ) const
             }
             else
             {
-                *(target_data++) = avgRed / counter ;
-                *(target_data++) = avgGreen / counter ;
-                *(target_data++) = avgBlue / counter ;
+                *(target_data++) = (unsigned char)(avgRed / counter);
+                *(target_data++) = (unsigned char)(avgGreen / counter);
+                *(target_data++) = (unsigned char)(avgBlue / counter);
             }
         }
     }