From: Vadim Zeitlin Date: Sun, 14 Nov 2010 12:09:51 +0000 (+0000) Subject: Handle image hot spot in wxImage::Rotate180(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0547ad09ccbc8f853502bf496f411c1623a68382 Handle image hot spot in wxImage::Rotate180(). 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 --- diff --git a/src/common/image.cpp b/src/common/image.cpp index 19a690b0fc..8dfb4fca68 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -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;