[byzanz] Record the cursor properly on 64bit machines
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [byzanz] Record the cursor properly on 64bit machines
- Date: Tue, 23 Mar 2010 21:05:01 +0000 (UTC)
commit 3eba4cb70f52060c7e4fc34a55caadb989d7a0d9
Author: Benjamin Otte <otte redhat com>
Date: Tue Mar 23 21:57:54 2010 +0100
Record the cursor properly on 64bit machines
src/byzanzlayercursor.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/src/byzanzlayercursor.c b/src/byzanzlayercursor.c
index 65e2460..8659a39 100644
--- a/src/byzanzlayercursor.c
+++ b/src/byzanzlayercursor.c
@@ -141,11 +141,22 @@ byzanz_layer_cursor_render (ByzanzLayer *layer,
return;
cursor_surface = cairo_image_surface_create_for_data ((guchar *) cursor->pixels,
- CAIRO_FORMAT_ARGB32, cursor->width, cursor->height, cursor->width * 4);
+ CAIRO_FORMAT_ARGB32, cursor->width * sizeof (unsigned long) / 4, cursor->height,
+ cursor->width * sizeof (unsigned long));
cairo_save (cr);
- cairo_translate (cr, clayer->cursor_x, clayer->cursor_y);
- cairo_set_source_surface (cr, cursor_surface, -(double) cursor->xhot, -(double) cursor->yhot);
+
+ cairo_translate (cr, clayer->cursor_x - cursor->xhot, clayer->cursor_y - cursor->yhot);
+
+ /* This is neeed to map an unsigned long array to a uint32_t array */
+ cairo_scale (cr, 4.0 / sizeof (unsigned long), 1);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+ cairo_translate (cr, (4.0 - sizeof (unsigned long)) / sizeof (unsigned long), 0);
+#endif
+
+ cairo_set_source_surface (cr, cursor_surface, 0, 0);
+ /* Next line is also neeed for mapping the unsigned long array to a uint32_t array */
+ cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
cairo_paint (cr);
cairo_restore (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]