From fb14d960c3b9b727074acd24199e56dafe002850 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Fri, 5 Dec 2008 07:47:51 +0000 Subject: [PATCH] use simpler method to draw bitmap git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57124 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/print.cpp | 88 +++-------------------------------------------- 1 file changed, 4 insertions(+), 84 deletions(-) diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index a7c6f95081..615e986dc5 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -34,10 +34,8 @@ #include "wx/gtk/private.h" #include "wx/dynlib.h" #include "wx/paper.h" -#include "wx/rawbmp.h" #include -#include #if wxUSE_GRAPHICS_CONTEXT #include "wx/graphics.h" @@ -1653,84 +1651,13 @@ void wxGtkPrinterDCImpl::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoor { wxCHECK_RET( bitmap.IsOk(), wxT("Invalid bitmap in wxGtkPrinterDCImpl::DoDrawBitmap")); - cairo_surface_t* surface; x = wxCoord(XLOG2DEV(x)); y = wxCoord(YLOG2DEV(y)); int bw = bitmap.GetWidth(); int bh = bitmap.GetHeight(); wxBitmap bmpSource = bitmap; // we need a non-const instance. - unsigned char* buffer = new unsigned char[bw*bh*4]; - wxUint32* data = (wxUint32*)buffer; - - wxMask *mask = NULL; - if (useMask) mask = bmpSource.GetMask(); - - // 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. - if (bmpSource.HasAlpha() || mask) - { - surface = cairo_image_surface_create_for_data( - buffer, CAIRO_FORMAT_ARGB32, bw, bh, bw*4); - wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh)); - wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data.")); - - wxAlphaPixelData::Iterator p(pixData); - int y, x; - for (y=0; y