From d16abb90c97b10c6a84b0f5ad5d891e63ae6f535 Mon Sep 17 00:00:00 2001 From: Vladimir Vukicevic Date: Sun, 20 Apr 2008 06:50:50 -0700 Subject: [PATCH] [qpainter] take redirected device offsets into account in acquire_source_surface --- gfx/cairo/cairo/src/cairo-qpainter-surface.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gfx/cairo/cairo/src/cairo-qpainter-surface.cpp b/gfx/cairo/cairo/src/cairo-qpainter-surface.cpp index 9b7af788a73..7170a58140a 100644 --- a/gfx/cairo/cairo/src/cairo-qpainter-surface.cpp +++ b/gfx/cairo/cairo/src/cairo-qpainter-surface.cpp @@ -516,6 +516,8 @@ _cairo_qpainter_surface_acquire_dest_image (void *abstract_surface, return CAIRO_STATUS_SUCCESS; } + QPoint offset; + if (qs->pixmap) { qimg = new QImage(qs->pixmap->toImage()); } else { @@ -525,6 +527,10 @@ _cairo_qpainter_surface_acquire_dest_image (void *abstract_surface, if (!pd) return CAIRO_STATUS_NO_MEMORY; + QPaintDevice *rpd = QPainter::redirected(pd, &offset); + if (rpd) + pd = rpd; + if (pd->devType() == QInternal::Image) { qimg = new QImage(((QImage*) pd)->copy()); } else if (pd->devType() == QInternal::Pixmap) { @@ -544,10 +550,10 @@ _cairo_qpainter_surface_acquire_dest_image (void *abstract_surface, qimg->bytesPerLine()); *image_extra = qimg; - image_rect->x = qs->window.x(); - image_rect->y = qs->window.y(); - image_rect->width = qs->window.width(); - image_rect->height = qs->window.height(); + image_rect->x = qs->window.x() + offset.x(); + image_rect->y = qs->window.y() + offset.y(); + image_rect->width = qs->window.width() - offset.x(); + image_rect->height = qs->window.height() - offset.y(); return CAIRO_STATUS_SUCCESS; }