]> git.saurik.com Git - wxWidgets.git/commitdiff
Handle image hot spot in wxImage::Rotate180().
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Nov 2010 12:09:51 +0000 (12:09 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 14 Nov 2010 12:09:51 +0000 (12:09 +0000)
Set the hot spot coordinates correctly for the image returned from
Rotate180(), just as it's already done by Rotate90().

Closes #12680.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66149 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index 19a690b0fc5446bcccf700309c0a114ef654b34d..8dfb4fca687068e4250515645adf8e855d3044a6 100644 (file)
@@ -1154,6 +1154,18 @@ wxImage wxImage::Rotate180() const
     long height = M_IMGDATA->m_height;
     long width  = M_IMGDATA->m_width;
 
+    if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_X) )
+    {
+        image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X,
+                        width - 1 - GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X));
+    }
+
+    if ( HasOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y) )
+    {
+        image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y,
+                        height - 1 - GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y));
+    }
+
     const unsigned char *source_data = M_IMGDATA->m_data;
     unsigned char *target_data = data + width * height * 3;