From 72a90d051ad939d244e2ec2e59dc7df1bcb5c4dc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:44:41 +0000 Subject: [PATCH] store the raw data in bitmap to m_buffer that in wxCairoBitmapData git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77865 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/graphicc.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index f328677524..7a5f6bcea9 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1451,6 +1451,25 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm InitSurface(bufferFormat, stride); #endif // wxHAS_RAW_BITMAP + +#if defined(__WXX11__) + // In include/feature.h, wxHAS_RAW_BITMAP defined for + // __WXGTK20__, __WXMAC__, __WXDFB__ and __WXMSW__. Without WXX11. + // This is because the bitmap in x11 is plain data. + // no need to convert it. + // The code in this block will only work for X11 + cairo_format_t bufferFormat = bmp.GetDepth() == 32 + ? CAIRO_FORMAT_ARGB32 + : CAIRO_FORMAT_RGB24; + + int stride = InitBuffer(bmp.GetWidth(), bmp.GetHeight(), bufferFormat); + + wxBitmap bmpSource = bmp; // we need a non-const instance + + m_buffer = (unsigned char*)bmp.GetBitmap(); + + InitSurface(bufferFormat, stride); +#endif } #if wxUSE_IMAGE