X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/95c0502bae6d1a41a120efb9e6bb1a0ad8227b99..f0776dc43fc145ee8e0d759d2f1b387724e4f17d:/src/generic/graphicc.cpp diff --git a/src/generic/graphicc.cpp b/src/generic/graphicc.cpp index 215968306f..312cd84635 100644 --- a/src/generic/graphicc.cpp +++ b/src/generic/graphicc.cpp @@ -1267,7 +1267,7 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm // Create a surface object and copy the bitmap pixel data to it. if the // image has alpha (or a mask represented as alpha) then we'll use a // different format and iterator than if it doesn't... - const cairo_format_t bufferFormat = bmp.GetDepth() == 32 + cairo_format_t bufferFormat = bmp.GetDepth() == 32 #ifdef __WXGTK__ || bmp.GetMask() #endif @@ -1558,22 +1558,6 @@ wxCairoBitmapData::~wxCairoBitmapData() delete [] m_buffer; } -// ---------------------------------------------------------------------------- -// wxGraphicsBitmap implementation -// ---------------------------------------------------------------------------- - -#if wxUSE_IMAGE - -wxImage wxGraphicsBitmap::ConvertToImage() const -{ - const wxCairoBitmapData* const - data = static_cast(GetGraphicsData()); - - return data ? data->ConvertToImage() : wxNullImage; -} - -#endif // wxUSE_IMAGE - //----------------------------------------------------------------------------- // wxCairoContext implementation //----------------------------------------------------------------------------- @@ -2292,6 +2276,7 @@ public : virtual wxGraphicsBitmap CreateBitmap( const wxBitmap &bitmap ); #if wxUSE_IMAGE virtual wxGraphicsBitmap CreateBitmapFromImage(const wxImage& image); + virtual wxImage CreateImageFromBitmap(const wxGraphicsBitmap& bmp); #endif // wxUSE_IMAGE // create a graphics bitmap from a native bitmap @@ -2361,14 +2346,7 @@ wxGraphicsContext * wxCairoRenderer::CreateContext( const wxMemoryDC& dc) wxGraphicsContext * wxCairoRenderer::CreateContext( const wxPrinterDC& dc) { ENSURE_LOADED_OR_RETURN(NULL); -#ifdef __WXGTK20__ - const wxDCImpl *impl = dc.GetImpl(); - cairo_t* context = (cairo_t*) impl->GetCairoContext(); - if (context) - return new wxCairoContext(this,dc); - else -#endif - return new wxCairoContext(this,dc); + return new wxCairoContext(this, dc); } #ifdef __WXMSW__ @@ -2558,8 +2536,19 @@ wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromImage(const wxImage& image) return bmp; } +wxImage wxCairoRenderer::CreateImageFromBitmap(const wxGraphicsBitmap& bmp) +{ + ENSURE_LOADED_OR_RETURN(wxNullImage); + + const wxCairoBitmapData* const + data = static_cast(bmp.GetGraphicsData()); + + return data ? data->ConvertToImage() : wxNullImage; +} + #endif // wxUSE_IMAGE + wxGraphicsBitmap wxCairoRenderer::CreateBitmapFromNativeBitmap( void* bitmap ) { ENSURE_LOADED_OR_RETURN(wxNullGraphicsBitmap);