]> git.saurik.com Git - wxWidgets.git/commitdiff
Second update patch for GTK+ print (DrawBitmap fix)
authorRobert Roebling <robert@roebling.de>
Thu, 13 Sep 2007 12:26:20 +0000 (12:26 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 13 Sep 2007 12:26:20 +0000 (12:26 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@48650 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/print.cpp

index 62e14f527acd257c29ea4b464b8a24413d6e5369..e44a6ede0b8854997d233c8e7d7a0faf7d799720 100644 (file)
@@ -1656,13 +1656,18 @@ void wxGtkPrintDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, b
 
 
     gs_cairo->cairo_save(m_cairo);
-    // In case we're scaling the image by using a width and height different
-    // than the bitmap's size create a pattern transformation on the surface and
-    // draw the transformed pattern.
-    cairo_pattern_t* pattern = gs_cairo->cairo_pattern_create_for_surface(surface);
 
     // Prepare to draw the image.
     gs_cairo->cairo_translate(m_cairo, x, y);
+
+    // Scale the image
+    cairo_filter_t filter = CAIRO_FILTER_BILINEAR;
+    cairo_pattern_t* pattern = cairo_pattern_create_for_surface(surface);
+    cairo_pattern_set_filter(pattern,filter);
+    wxDouble scaleX = (wxDouble) bw * m_DEV2PS / (wxDouble) bw;
+    wxDouble scaleY = (wxDouble) bh * m_DEV2PS / (wxDouble) bh;
+    cairo_scale(m_cairo, scaleX, scaleY);
+
     gs_cairo->cairo_set_source(m_cairo, pattern);
     // Use the original size here since the context is scaled already.
     gs_cairo->cairo_rectangle(m_cairo, 0, 0, bw, bh);