Blob Blame History Raw
From 14f6aa569034fdc3b6524b1ec6c90643a10dded0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Thu, 13 Mar 2014 14:21:59 +0100
Subject: [PATCH 2/3] Fix spice_display_get_pixbuf() with offset area
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix screenshot of secondary displays, with an area position != (0,0).

This has never been working correctly since the surface display "area"
was introducted in:

commit e3bb7b1cfd162fcb8943e9d582dab43eeec6ce41
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Tue Jun 12 19:24:47 2012 +0200

    display: learn to restrict display to an area

https://bugzilla.redhat.com/show_bug.cgi?id=1029761
---
 gtk/spice-widget.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index 4e76648..afb6b48 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -2582,8 +2582,9 @@ GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display)
     src = d->data;
     dest = data;
 
-    for (y = d->area.y; y < d->area.height; ++y) {
-        for (x = d->area.x; x < d->area.width; ++x) {
+    src += d->area.y * d->stride + d->area.x * 4;
+    for (y = 0; y < d->area.height; ++y) {
+        for (x = 0; x < d->area.width; ++x) {
           dest[0] = src[x * 4 + 2];
           dest[1] = src[x * 4 + 1];
           dest[2] = src[x * 4 + 0];
-- 
1.7.1