[Spice-commits] common/cairo_canvas.c
Izik Eidus
izik at kemper.freedesktop.org
Mon Apr 12 01:50:51 PDT 2010
common/cairo_canvas.c | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
New commits:
commit 85d4355d79f8469a6297b7137202b311c3f03139
Author: Izik Eidus <ieidus at redhat.com>
Date: Mon Apr 12 11:57:34 2010 +0300
fix 16bpp support on cairo_canvas
Signed-off-by: Izik Eidus <ieidus at redhat.com>
diff --git a/common/cairo_canvas.c b/common/cairo_canvas.c
index 17a40a4..205a133 100644
--- a/common/cairo_canvas.c
+++ b/common/cairo_canvas.c
@@ -156,6 +156,33 @@ static void copy_region(SpiceCanvas *spice_canvas,
}
}
+static inline uint8_t get_converted_color(uint8_t color)
+{
+ uint8_t msb;
+
+ msb = color & 0xE0;
+ msb = msb >> 5;
+ color |= msb;
+ return color;
+}
+
+static inline uint32_t get_color(CairoCanvas *canvas, uint32_t color)
+{
+ int shift = canvas->base.color_shift == 8 ? 0 : 3;
+ uint32_t ret;
+
+ if (!shift) {
+ return color;
+ }
+
+ ret = ((color & 0x001f) << 3) | ((color & 0x001c) >> 2);
+ ret |= ((color & 0x03e0) << 6) | ((color & 0x0380) << 1);
+ ret |= ((color & 0x7c00) << 9) | ((color & 0x7000) << 4);
+
+ return ret;
+}
+
+
static void fill_solid_spans(SpiceCanvas *spice_canvas,
SpicePoint *points,
int *widths,
@@ -170,7 +197,7 @@ static void fill_solid_spans(SpiceCanvas *spice_canvas,
points[i].x, points[i].y,
widths[i],
1,
- color);
+ get_color(canvas, color));
}
}
@@ -187,7 +214,7 @@ static void fill_solid_rects(SpiceCanvas *spice_canvas,
rects[i].x1, rects[i].y1,
rects[i].x2 - rects[i].x1,
rects[i].y2 - rects[i].y1,
- color);
+ get_color(canvas, color));
}
}
@@ -205,7 +232,7 @@ static void fill_solid_rects_rop(SpiceCanvas *spice_canvas,
rects[i].x1, rects[i].y1,
rects[i].x2 - rects[i].x1,
rects[i].y2 - rects[i].y1,
- color, rop);
+ get_color(canvas, color), rop);
}
}
More information about the Spice-commits
mailing list