X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d52ca536a0ecb6e69474d30461f6128497505a0..4c624eb1e57635e0164f6745dc05375b72240a37:/src/gtk/print.cpp diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index a7c6f95081..451fe2a82a 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" @@ -213,25 +211,6 @@ extern "C" printout->OnEndPrinting(); } - - static gboolean - gtk_preview_print_callback(GtkPrintOperation * WXUNUSED(operation), - GtkPrintOperationPreview * WXUNUSED(preview), - GtkPrintContext *context, - GtkWindow *parent, - gpointer user_data) - { - wxPrintout *printout = (wxPrintout *) user_data; - - printout->SetIsPreview(true); - - /* We create a Cairo context with 72dpi resolution. This resolution is - * only used for positioning. */ - cairo_t *cairo = gdk_cairo_create(GTK_WIDGET(parent)->window); - gtk_print_context_set_cairo_context(context, cairo, 72, 72); - - return false; - } } //---------------------------------------------------------------------------- @@ -857,8 +836,6 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) native->SetPrintJob( printOp ); - printout->SetIsPreview(false); - wxPrinterToGtkData dataToSend; dataToSend.printer = this; dataToSend.printout = printout; @@ -867,7 +844,6 @@ bool wxGtkPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt ) g_signal_connect (printOp, "begin-print", G_CALLBACK (gtk_begin_print_callback), &dataToSend); g_signal_connect (printOp, "draw-page", G_CALLBACK (gtk_draw_page_print_callback), &dataToSend); g_signal_connect (printOp, "end-print", G_CALLBACK (gtk_end_print_callback), printout); - g_signal_connect (printOp, "preview", G_CALLBACK (gtk_preview_print_callback), printout); // This is used to setup the DC and // show the dialog if desired @@ -1175,7 +1151,7 @@ void* wxGtkPrinterDCImpl::GetCairoContext() const bool wxGtkPrinterDCImpl::DoFloodFill(wxCoord WXUNUSED(x1), wxCoord WXUNUSED(y1), const wxColour& WXUNUSED(col), - int WXUNUSED(style)) + wxFloodFillStyle WXUNUSED(style)) { // We can't access the given coord as a Cairo context is scalable, ie a // coord doesn't mean anything in this context. @@ -1429,7 +1405,9 @@ void wxGtkPrinterDCImpl::DoDrawLines(int n, wxPoint points[], wxCoord xoffset, w cairo_stroke ( m_cairo); } -void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) +void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle) { if (n==0) return; @@ -1463,7 +1441,9 @@ void wxGtkPrinterDCImpl::DoDrawPolygon(int n, wxPoint points[], wxCoord xoffset, cairo_restore(m_cairo); } -void wxGtkPrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], wxCoord xoffset, wxCoord yoffset, int fillStyle) +void wxGtkPrinterDCImpl::DoDrawPolyPolygon(int n, int count[], wxPoint points[], + wxCoord xoffset, wxCoord yoffset, + wxPolygonFillMode fillStyle) { wxDCImpl::DoDrawPolyPolygon( n, count, points, xoffset, yoffset, fillStyle ); } @@ -1622,7 +1602,7 @@ void wxGtkPrinterDCImpl::DoDrawSpline(const wxPointList *points) bool wxGtkPrinterDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, - int rop, bool useMask, + wxRasterOperationMode rop, bool useMask, wxCoord WXUNUSED_UNLESS_DEBUG(xsrcMask), wxCoord WXUNUSED_UNLESS_DEBUG(ysrcMask)) { @@ -1653,84 +1633,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