Applied #11097: wxGraphicsContext::DrawBitmap: x and y coords should not be affected by stretch factor

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@66928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2011-02-16 23:31:13 +00:00
parent ca8fdde6a7
commit 75ffc4c69c

View File

@@ -1290,15 +1290,14 @@ void wxCairoContext::DrawGraphicsBitmapInternal(const wxGraphicsBitmap &bmp, wxD
wxSize size = data->GetSize();
PushState();
// prepare to draw the image
cairo_translate(m_context, x, y);
// 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.
wxDouble scaleX = w / size.GetWidth();
wxDouble scaleY = h / size.GetHeight();
cairo_scale(m_context, scaleX, scaleY);
// prepare to draw the image
cairo_translate(m_context, x, y);
cairo_set_source(m_context, pattern);
// use the original size here since the context is scaled already...
cairo_rectangle(m_context, 0, 0, size.GetWidth(), size.GetHeight());