[qpainter] take redirected device offsets into account in acquire_source_surface

This commit is contained in:
Vladimir Vukicevic 2008-04-20 06:50:50 -07:00
parent f7ea6e0bc4
commit 6e1b75baa7

View File

@ -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;
}