[Spice-devel] [PATCH spice-gtk] Fix spice_display_get_pixbuf() with offset area

Marc-André Lureau marcandre.lureau at gmail.com
Thu Mar 13 06:23:55 PDT 2014


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 at 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 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gtk/spice-widget.c b/gtk/spice-widget.c
index f5adf66..233f36c 100644
--- a/gtk/spice-widget.c
+++ b/gtk/spice-widget.c
@@ -2585,8 +2585,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.8.5.3



More information about the Spice-devel mailing list