summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cairo_canvas.c336
-rw-r--r--common/cairo_canvas.h36
-rw-r--r--common/canvas_base.c232
-rw-r--r--common/canvas_base.h8
-rw-r--r--common/gdi_canvas.c234
-rw-r--r--common/gdi_canvas.h30
-rw-r--r--common/gl_canvas.c146
-rw-r--r--common/gl_canvas.h32
-rw-r--r--common/lz.c4
-rw-r--r--common/lz.h2
-rw-r--r--common/rect.h28
-rw-r--r--common/region.c112
-rw-r--r--common/region.h10
-rw-r--r--common/rop3.c24
-rw-r--r--common/rop3.h6
15 files changed, 620 insertions, 620 deletions
diff --git a/common/cairo_canvas.c b/common/cairo_canvas.c
index e8f177bb..1a4993da 100644
--- a/common/cairo_canvas.c
+++ b/common/cairo_canvas.c
@@ -35,26 +35,26 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
cairo_new_sub_path(cairo);
cairo_move_to(cairo, fix_to_double(point->x), fix_to_double(point->y));
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
cairo_curve_to(cairo,
@@ -67,8 +67,8 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
cairo_line_to(cairo, fix_to_double(point->x), fix_to_double(point->y));
}
}
- if (flags & PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_END) {
+ if (flags & SPICE_PATH_CLOSE) {
cairo_close_path(cairo);
}
cairo_new_sub_path(cairo);
@@ -76,19 +76,19 @@ static void canvas_set_path(CairoCanvas *canvas, void *addr)
} while (more);
}
-static void canvas_clip(CairoCanvas *canvas, Clip *clip)
+static void canvas_clip(CairoCanvas *canvas, SpiceClip *clip)
{
cairo_t *cairo = canvas->cairo;
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
for (; now < end; now++) {
@@ -98,8 +98,8 @@ static void canvas_clip(CairoCanvas *canvas, Clip *clip)
cairo_clip(cairo);
break;
}
- case CLIP_TYPE_PATH:
- canvas_set_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH:
+ canvas_set_path(canvas, SPICE_GET_ADDRESS(clip->data));
cairo_clip(cairo);
break;
default:
@@ -110,11 +110,11 @@ static void canvas_clip(CairoCanvas *canvas, Clip *clip)
static inline cairo_line_cap_t canvas_line_cap_to_cairo(int end_style)
{
switch (end_style) {
- case LINE_CAP_ROUND:
+ case SPICE_LINE_CAP_ROUND:
return CAIRO_LINE_CAP_ROUND;
- case LINE_CAP_SQUARE:
+ case SPICE_LINE_CAP_SQUARE:
return CAIRO_LINE_CAP_SQUARE;
- case LINE_CAP_BUTT:
+ case SPICE_LINE_CAP_BUTT:
return CAIRO_LINE_CAP_BUTT;
default:
CANVAS_ERROR("bad end style %d", end_style);
@@ -124,18 +124,18 @@ static inline cairo_line_cap_t canvas_line_cap_to_cairo(int end_style)
static inline cairo_line_join_t canvas_line_join_to_cairo(int join_style)
{
switch (join_style) {
- case LINE_JOIN_ROUND:
+ case SPICE_LINE_JOIN_ROUND:
return CAIRO_LINE_JOIN_ROUND;
- case LINE_JOIN_BEVEL:
+ case SPICE_LINE_JOIN_BEVEL:
return CAIRO_LINE_JOIN_BEVEL;
- case LINE_JOIN_MITER:
+ case SPICE_LINE_JOIN_MITER:
return CAIRO_LINE_JOIN_MITER;
default:
CANVAS_ERROR("bad join style %d", join_style);
}
}
-static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, LineAttr *attr)
+static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, SpiceLineAttr *attr)
{
cairo_t *cairo = canvas->cairo;
@@ -146,9 +146,9 @@ static void canvas_set_line_attr_no_dash(CairoCanvas *canvas, LineAttr *attr)
cairo_set_dash(cairo, NULL, 0, 0);
}
-static void canvas_set_dash(CairoCanvas *canvas, UINT8 nseg, ADDRESS addr, int start_is_gap)
+static void canvas_set_dash(CairoCanvas *canvas, UINT8 nseg, SPICE_ADDRESS addr, int start_is_gap)
{
- FIXED28_4* style = (FIXED28_4*)GET_ADDRESS(addr);
+ SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
double offset = 0;
double *local_style;
int i;
@@ -222,7 +222,7 @@ static inline void canvas_invers_16bpp(uint8_t *dest, int dest_stride, uint8_t *
}
static inline void canvas_invers_8bpp(uint8_t *dest, int dest_stride, uint8_t *src, int src_stride,
- int width, uint8_t *end, Palette *palette)
+ int width, uint8_t *end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -242,7 +242,7 @@ static inline void canvas_invers_8bpp(uint8_t *dest, int dest_stride, uint8_t *s
static inline void canvas_invers_4bpp_be(uint8_t* dest, int dest_stride, uint8_t* src,
int src_stride, int width, uint8_t* end,
- Palette *palette)
+ SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -267,7 +267,7 @@ static inline void canvas_invers_4bpp_be(uint8_t* dest, int dest_stride, uint8_t
static inline void canvas_invers_1bpp_be(uint8_t* dest, int dest_stride, uint8_t* src,
int src_stride, int width, uint8_t* end,
- Palette *palette)
+ SpicePalette *palette)
{
uint32_t fore_color;
uint32_t back_color;
@@ -293,10 +293,10 @@ static inline void canvas_invers_1bpp_be(uint8_t* dest, int dest_stride, uint8_t
}
}
-static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bitmap* bitmap,
- Palette *palette)
+static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, SpiceBitmap* bitmap,
+ SpicePalette *palette)
{
- uint8_t* src = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* src = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
int src_stride;
uint8_t* end;
uint8_t* dest;
@@ -307,7 +307,7 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
end = src + (bitmap->y * src_stride);
access_test(&canvas->base, src, bitmap->y * src_stride);
- cairo_surface = cairo_image_surface_create((bitmap->format == BITMAP_FMT_RGBA) ?
+ cairo_surface = cairo_image_surface_create((bitmap->format == SPICE_BITMAP_FMT_RGBA) ?
CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24,
bitmap->x, bitmap->y);
if (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS) {
@@ -317,29 +317,29 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
dest = cairo_image_surface_get_data(cairo_surface);
dest_stride = cairo_image_surface_get_stride(cairo_surface);
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
ASSERT(bitmap->y > 0);
dest += dest_stride * (bitmap->y - 1);
dest_stride = -dest_stride;
}
switch (bitmap->format) {
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
canvas_invers_32bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
canvas_invers_24bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
canvas_invers_16bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
canvas_invers_8bpp(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
canvas_invers_4bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
canvas_invers_1bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
}
@@ -349,22 +349,22 @@ static cairo_surface_t *canvas_bitmap_to_invers_surface(CairoCanvas *canvas, Bit
#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE)
#ifndef CAIRO_CANVAS_CACHE
-static Palette *canvas_get_palette(CairoCanvas *canvas, Bitmap *bitmap)
+static SpicePalette *canvas_get_palette(CairoCanvas *canvas, SpiceBitmap *bitmap)
{
- Palette *local_palette;
- Palette *palette;
+ SpicePalette *local_palette;
+ SpicePalette *palette;
int size;
if (!bitmap->palette) {
return NULL;
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->base.color_shift != 5) {
return palette;
}
- size = sizeof(Palette) + (palette->num_ents << 2);
+ size = sizeof(SpicePalette) + (palette->num_ents << 2);
local_palette = malloc(size);
memcpy(local_palette, palette, size);
canvas_localize_palette(&canvas->base, palette);
@@ -372,9 +372,9 @@ static Palette *canvas_get_palette(CairoCanvas *canvas, Bitmap *bitmap)
return local_palette;
}
-static void free_palette(Bitmap *bitmap, Palette *palette)
+static void free_palette(SpiceBitmap *bitmap, SpicePalette *palette)
{
- if (!palette || palette == GET_ADDRESS(bitmap->palette)) {
+ if (!palette || palette == SPICE_GET_ADDRESS(bitmap->palette)) {
return;
}
free(palette);
@@ -382,20 +382,20 @@ static void free_palette(Bitmap *bitmap, Palette *palette)
#endif
-static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
cairo_surface_t *surface;
cairo_surface_t *invers = NULL;
- access_test(&canvas->base, descriptor, sizeof(ImageDescriptor));
+ access_test(&canvas->base, descriptor, sizeof(SpiceImageDescriptor));
- int cache_me = descriptor->flags & IMAGE_CACHE_ME;
+ int cache_me = descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME;
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(&canvas->base, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(&canvas->base, descriptor, sizeof(SpiceQUICImage));
if (cache_me) {
surface = canvas_get_quic(&canvas->base, image, 0);
} else {
@@ -404,8 +404,8 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
break;
}
#ifdef CAIRO_CANVAS_NO_CHUNKS
- case IMAGE_TYPE_LZ_PLT: {
- access_test(&canvas->base, descriptor, sizeof(LZ_PLTImage));
+ case SPICE_IMAGE_TYPE_LZ_PLT: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZPLTImage));
LZImage *image = (LZImage *)descriptor;
if (cache_me) {
surface = canvas_get_lz(&canvas->base, image, 0);
@@ -414,8 +414,8 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
}
break;
}
- case IMAGE_TYPE_LZ_RGB: {
- access_test(&canvas->base, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_LZ_RGB: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
if (cache_me) {
surface = canvas_get_lz(&canvas->base, image, 0);
@@ -426,19 +426,19 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
}
#endif
#ifdef USE_GLZ
- case IMAGE_TYPE_GLZ_RGB: {
- access_test(&canvas->base, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_GLZ_RGB: {
+ access_test(&canvas->base, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_glz(&canvas->base, image);
break;
}
#endif
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
surface = canvas->base.bits_cache_get(canvas->base.bits_cache_opaque, descriptor->id);
break;
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(&canvas->base, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(&canvas->base, descriptor, sizeof(SpiceBitmapImage));
if (cache_me) {
surface = canvas_get_bits(&canvas->base, &bitmap->bitmap);
} else {
@@ -448,7 +448,7 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
bitmap->bitmap.palette,
bitmap->bitmap.flags));
#else
- Palette *palette = canvas_get_palette(canvas, &bitmap->bitmap);
+ SpicePalette *palette = canvas_get_palette(canvas, &bitmap->bitmap);
surface = canvas_bitmap_to_invers_surface(canvas, &bitmap->bitmap, palette);
free_palette(&bitmap->bitmap, palette);
return surface;
@@ -471,17 +471,17 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
#else
-static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, SpiceBitmap *bitmap)
{
- Palette *palette;
+ SpicePalette *palette;
if (!bitmap->palette) {
return canvas_bitmap_to_invers_surface(canvas, bitmap, NULL);
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->color_shift == 5) {
- int size = sizeof(Palette) + (palette->num_ents << 2);
- Palette *local_palette = malloc(size);
+ int size = sizeof(SpicePalette) + (palette->num_ents << 2);
+ SpicePalette *local_palette = malloc(size);
cairo_surface_t* surface;
memcpy(local_palette, palette, size);
@@ -494,21 +494,21 @@ static cairo_surface_t *canvas_get_invers(CairoCanvas *canvas, Bitmap *bitmap)
}
}
-static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
return canvas_get_quic(canvas, image, 1);
}
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
return canvas_get_invers(canvas, &bitmap->bitmap);
}
default:
@@ -518,7 +518,7 @@ static cairo_surface_t *canvas_get_invers_image(CairoCanvas *canvas, ADDRESS add
#endif
-static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, Point *pos,
+static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, SpicePoint *pos,
int32_t width, int32_t heigth)
{
cairo_surface_t *surface;
@@ -547,10 +547,10 @@ static cairo_surface_t* canvas_surface_from_self(CairoCanvas *canvas, Point *pos
return surface;
}
-static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint32_t invers)
+static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, SpiceBrush *brush, uint32_t invers)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
uint32_t color = (invers) ? ~brush->u.color : brush->u.color;
double r, g, b;
@@ -561,7 +561,7 @@ static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint
r = (double)(color & canvas->base.color_mask) / canvas->base.color_mask;
return cairo_pattern_create_rgb(r, g, b);
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
cairo_surface_t* surface;
cairo_pattern_t *pattern;
cairo_matrix_t matrix;
@@ -583,7 +583,7 @@ static cairo_pattern_t *canvas_get_brush(CairoCanvas *canvas, Brush *brush, uint
cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
return pattern;
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return NULL;
default:
CANVAS_ERROR("invalid brush type");
@@ -604,13 +604,13 @@ static inline int canvas_set_ropd_operator(cairo_t *cairo, uint16_t rop_decripto
{
cairo_operator_t cairo_op;
- if (rop_decriptor & ROPD_OP_PUT) {
+ if (rop_decriptor & SPICE_ROPD_OP_PUT) {
cairo_op = CAIRO_OPERATOR_RASTER_COPY;
- } else if (rop_decriptor & ROPD_OP_XOR) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_XOR) {
cairo_op = CAIRO_OPERATOR_RASTER_XOR;
- } else if (rop_decriptor & ROPD_OP_OR) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_OR) {
cairo_op = CAIRO_OPERATOR_RASTER_OR;
- } else if (rop_decriptor & ROPD_OP_AND) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_AND) {
cairo_op = CAIRO_OPERATOR_RASTER_AND;
} else {
return 0;
@@ -625,16 +625,16 @@ static void canvas_draw_with_pattern(CairoCanvas *canvas, cairo_pattern_t *patte
{
cairo_t *cairo = canvas->cairo;
- if (rop_decriptor & ROPD_OP_BLACKNESS) {
+ if (rop_decriptor & SPICE_ROPD_OP_BLACKNESS) {
cairo_set_source_rgb(cairo, 0, 0, 0);
draw_method(data);
- } else if (rop_decriptor & ROPD_OP_WHITENESS) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_WHITENESS) {
cairo_set_source_rgb(cairo, 1, 1, 1);
draw_method(data);
- } else if (rop_decriptor & ROPD_OP_INVERS) {
+ } else if (rop_decriptor & SPICE_ROPD_OP_INVERS) {
__canvas_draw_invers(canvas, draw_method, data);
} else {
- if (rop_decriptor & ROPD_INVERS_DEST) {
+ if (rop_decriptor & SPICE_ROPD_INVERS_DEST) {
__canvas_draw_invers(canvas, draw_method, data);
}
@@ -644,23 +644,23 @@ static void canvas_draw_with_pattern(CairoCanvas *canvas, cairo_pattern_t *patte
draw_method(data);
}
- if (rop_decriptor & ROPD_INVERS_RES) {
+ if (rop_decriptor & SPICE_ROPD_INVERS_RES) {
__canvas_draw_invers(canvas, draw_method, data);
}
}
}
-static inline void canvas_draw(CairoCanvas *canvas, Brush *brush, uint16_t rop_decriptor,
+static inline void canvas_draw(CairoCanvas *canvas, SpiceBrush *brush, uint16_t rop_decriptor,
DrawMethod draw_method, void *data)
{
- cairo_pattern_t *pattern = canvas_get_brush(canvas, brush, rop_decriptor & ROPD_INVERS_BRUSH);
+ cairo_pattern_t *pattern = canvas_get_brush(canvas, brush, rop_decriptor & SPICE_ROPD_INVERS_BRUSH);
canvas_draw_with_pattern(canvas, pattern, rop_decriptor, draw_method, data);
if (pattern) {
cairo_pattern_destroy(pattern);
}
}
-static cairo_pattern_t *canvas_get_mask_pattern(CairoCanvas *canvas, QMask *mask, int x, int y)
+static cairo_pattern_t *canvas_get_mask_pattern(CairoCanvas *canvas, SpiceQMask *mask, int x, int y)
{
cairo_surface_t *surface;
cairo_pattern_t *pattern;
@@ -692,7 +692,7 @@ static void __draw_mask(void *data)
cairo_mask(((DrawMaskData *)data)->cairo, ((DrawMaskData *)data)->mask);
}
-void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void canvas_draw_fill(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
DrawMaskData draw_data;
draw_data.cairo = canvas->cairo;
@@ -715,8 +715,8 @@ void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
cairo_restore(draw_data.cairo);
}
-static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src_bitmap,
- const Rect *src, const Rect *dest, int invers,
+static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, SPICE_ADDRESS src_bitmap,
+ const SpiceRect *src, const SpiceRect *dest, int invers,
int scale_mode)
{
cairo_pattern_t *pattern;
@@ -724,7 +724,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
cairo_matrix_t matrix;
ASSERT(src_bitmap);
- ASSERT(scale_mode == IMAGE_SCALE_INTERPOLATE || scale_mode == IMAGE_SCALE_NEAREST);
+ ASSERT(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
if (invers) {
surface = canvas_get_invers_image(canvas, src_bitmap);
} else {
@@ -745,7 +745,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
sy = (double)(src->bottom - src->top) / (dest->bottom - dest->top);
cairo_matrix_init_scale(&matrix, sx, sy);
- cairo_pattern_set_filter(pattern, (scale_mode == IMAGE_SCALE_NEAREST) ?
+ cairo_pattern_set_filter(pattern, (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
CAIRO_FILTER_NEAREST : CAIRO_FILTER_GOOD);
cairo_matrix_translate(&matrix, src->left / sx - dest->left, src->top / sy - dest->top);
@@ -757,7 +757,7 @@ static cairo_pattern_t *canvas_src_image_to_pat(CairoCanvas *canvas, ADDRESS src
return pattern;
}
-void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void canvas_draw_copy(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -767,7 +767,7 @@ void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, copy->src_bitmap, &copy->src_area, bbox,
- copy->rop_decriptor & ROPD_INVERS_SRC, copy->scale_mode);
+ copy->rop_decriptor & SPICE_ROPD_INVERS_SRC, copy->scale_mode);
cairo_set_source(cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(cairo, CAIRO_OPERATOR_RASTER_COPY);
@@ -787,11 +787,11 @@ void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
}
#ifdef WIN32
-void canvas_put_image(CairoCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *_src_data,
+void canvas_put_image(CairoCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *_src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
#else
-void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *_src_data,
+void canvas_put_image(CairoCanvas *canvas, const SpiceRect *dest, const uint8_t *_src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
#endif
@@ -807,8 +807,8 @@ void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *_src
cairo_save(cairo);
if (clip) {
- const Rect *now = clip->rects;
- const Rect *end = clip->rects + clip->num_rects;
+ const SpiceRect *now = clip->rects;
+ const SpiceRect *end = clip->rects + clip->num_rects;
for (; now < end; now++) {
cairo_rectangle(cairo, now->left, now->top, now->right - now->left,
now->bottom - now->top);
@@ -927,7 +927,7 @@ static cairo_surface_t *canvas_surf_to_color_maks_invers(cairo_surface_t *surfac
return mask;
}
-void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transparent* transparent)
+void canvas_draw_transparent(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -946,7 +946,7 @@ void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transp
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, transparent->src_bitmap, &transparent->src_area, bbox,
- 0, IMAGE_SCALE_NEAREST);
+ 0, SPICE_IMAGE_SCALE_MODE_NEAREST);
if (cairo_pattern_get_surface(pattern, &surface) != CAIRO_STATUS_SUCCESS) {
CANVAS_ERROR("surfase from pattern pattern failed");
}
@@ -970,7 +970,7 @@ void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transp
cairo_restore(cairo);
}
-void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend)
+void canvas_draw_alpha_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *pattern;
@@ -985,7 +985,7 @@ void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, alpha_blend->src_bitmap, &alpha_blend->src_area, bbox,
- 0, IMAGE_SCALE_INTERPOLATE);
+ 0, SPICE_IMAGE_SCALE_MODE_INTERPOLATE);
cairo_set_source(cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(cairo, CAIRO_OPERATOR_ATOP);
@@ -994,7 +994,7 @@ void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
cairo_restore(cairo);
}
-void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void canvas_draw_opaque(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_pattern_t *pattern;
DrawMaskData draw_data;
@@ -1005,7 +1005,7 @@ void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, opaque->src_bitmap, &opaque->src_area, bbox,
- opaque->rop_decriptor & ROPD_INVERS_SRC, opaque->scale_mode);
+ opaque->rop_decriptor & SPICE_ROPD_INVERS_SRC, opaque->scale_mode);
cairo_set_source(draw_data.cairo, pattern);
cairo_pattern_destroy(pattern);
cairo_set_operator(draw_data.cairo, CAIRO_OPERATOR_RASTER_COPY);
@@ -1031,7 +1031,7 @@ void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
cairo_restore(draw_data.cairo);
}
-void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void canvas_draw_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_pattern_t *pattern;
DrawMaskData mask_data;
@@ -1042,7 +1042,7 @@ void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
canvas_clip(canvas, clip);
pattern = canvas_src_image_to_pat(canvas, blend->src_bitmap, &blend->src_area, bbox,
- blend->rop_decriptor & ROPD_INVERS_SRC, blend->scale_mode);
+ blend->rop_decriptor & SPICE_ROPD_INVERS_SRC, blend->scale_mode);
if ((mask_data.mask = canvas_get_mask_pattern(canvas, &blend->mask, bbox->left, bbox->top))) {
cairo_rectangle(mask_data.cairo,
@@ -1065,8 +1065,8 @@ void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
cairo_restore(mask_data.cairo);
}
-static inline void canvas_fill_common(CairoCanvas *canvas, Rect *bbox, Clip *clip,
- QMask *qxl_mask)
+static inline void canvas_fill_common(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceQMask *qxl_mask)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *mask;
@@ -1088,7 +1088,7 @@ static inline void canvas_fill_common(CairoCanvas *canvas, Rect *bbox, Clip *cli
}
}
-void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void canvas_draw_blackness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1097,7 +1097,7 @@ void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blacknes
cairo_restore(cairo);
}
-void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void canvas_draw_whiteness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1106,7 +1106,7 @@ void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whitenes
cairo_restore(cairo);
}
-void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void canvas_draw_invers(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
@@ -1116,18 +1116,18 @@ void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *inv
cairo_restore(cairo);
}
-void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void canvas_draw_rop3(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_t *cairo = canvas->cairo;
cairo_pattern_t *mask;
cairo_surface_t *d;
cairo_surface_t *s;
- Point pos;
+ SpicePoint pos;
int width;
int heigth;
double x_pos;
double y_pos;
- Point src_pos;
+ SpicePoint src_pos;
cairo_save(cairo);
canvas_clip(canvas, clip);
@@ -1156,9 +1156,9 @@ void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_image_surface_get_height(s) - src_pos.y < heigth) {
CANVAS_ERROR("bad src bitmap size");
}
- if (rop3->brush.type == BRUSH_TYPE_PATTERN) {
+ if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
cairo_surface_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat);
- Point pat_pos;
+ SpicePoint pat_pos;
pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % cairo_image_surface_get_width(p);
pat_pos.y = (bbox->top - rop3->brush.u.pattern.pos.y) % cairo_image_surface_get_height(p);
@@ -1239,8 +1239,8 @@ static inline void __canvas_copy_bits_right(uint8_t *data, const int stride,
}
}
-static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, Rect *dest_rect,
- Point *src_pos)
+static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, SpiceRect *dest_rect,
+ SpicePoint *src_pos)
{
if (dest_rect->top > src_pos->y) {
__canvas_copy_bits_down(data, stride, src_pos->x, src_pos->y,
@@ -1260,11 +1260,11 @@ static inline void __canvas_copy_rect_bits(uint8_t *data, const int stride, Rect
}
}
-static inline void canvas_copy_fix_clip_area(const Rect *dest,
- const Point *src_pos,
- const Rect *now,
- Point *ret_pos,
- Rect *ret_dest)
+static inline void canvas_copy_fix_clip_area(const SpiceRect *dest,
+ const SpicePoint *src_pos,
+ const SpiceRect *now,
+ SpicePoint *ret_pos,
+ SpiceRect *ret_dest)
{
*ret_dest = *now;
rect_sect(ret_dest, dest);
@@ -1272,21 +1272,21 @@ static inline void canvas_copy_fix_clip_area(const Rect *dest,
ret_pos->y = src_pos->y + (ret_dest->top - dest->top);
}
-static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *dest_rect,
- Point *src_pos, QRegion *region)
+static inline void __canvas_copy_region_bits(uint8_t *data, int stride, SpiceRect *dest_rect,
+ SpicePoint *src_pos, QRegion *region)
{
- Rect curr_area;
- Point curr_pos;
- Rect *now;
- Rect *end;
+ SpiceRect curr_area;
+ SpicePoint curr_pos;
+ SpiceRect *now;
+ SpiceRect *end;
if (dest_rect->top > src_pos->y) {
end = region->rects - 1;
now = end + region->num_rects;
if (dest_rect->left < src_pos->x) {
for (; now > end; now--) {
- Rect *line_end = now;
- Rect *line_pos;
+ SpiceRect *line_end = now;
+ SpiceRect *line_pos;
while (now - 1 > end && now->top == now[-1].top) {
now--;
@@ -1314,8 +1314,8 @@ static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *de
end = now + region->num_rects;
if (dest_rect->left > src_pos->x) {
for (; now < end; now++) {
- Rect *line_end = now;
- Rect *line_pos;
+ SpiceRect *line_end = now;
+ SpiceRect *line_pos;
while (now + 1 < end && now->top == now[1].top) {
now++;
@@ -1353,7 +1353,7 @@ static inline void __canvas_copy_region_bits(uint8_t *data, int stride, Rect *de
#endif
-void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void canvas_copy_bits(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
cairo_t *cairo = canvas->cairo;
cairo_surface_t *surface;
@@ -1363,20 +1363,20 @@ void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_po
cairo_save(cairo);
#ifdef FAST_COPY_BITS
switch (clip->type) {
- case CLIP_TYPE_NONE: {
+ case SPICE_CLIP_TYPE_NONE: {
surface = cairo_get_target(cairo);
__canvas_copy_rect_bits(cairo_image_surface_get_data(surface),
cairo_image_surface_get_stride(surface),
bbox, src_pos);
break;
}
- case CLIP_TYPE_RECTS: {
+ case SPICE_CLIP_TYPE_RECTS: {
surface = cairo_get_target(cairo);
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
uint8_t *data = cairo_image_surface_get_data(surface);
int stride = cairo_image_surface_get_stride(surface);
@@ -1410,13 +1410,13 @@ void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_po
cairo_restore(cairo);
}
-static void canvas_draw_raster_str(CairoCanvas *canvas, String *str, int bpp,
- Brush *brush, uint16_t rop_decriptor)
+static void canvas_draw_raster_str(CairoCanvas *canvas, SpiceString *str, int bpp,
+ SpiceBrush *brush, uint16_t rop_decriptor)
{
cairo_surface_t *str_mask;
DrawMaskData draw_data;
cairo_matrix_t matrix;
- Point pos;
+ SpicePoint pos;
str_mask = canvas_get_str_mask(&canvas->base, str, bpp, &pos);
draw_data.cairo = canvas->cairo;
@@ -1433,14 +1433,14 @@ static void canvas_draw_raster_str(CairoCanvas *canvas, String *str, int bpp,
cairo_surface_destroy(str_mask);
}
-static void canvas_draw_vector_str(CairoCanvas *canvas, String *str, Brush *brush,
+static void canvas_draw_vector_str(CairoCanvas *canvas, SpiceString *str, SpiceBrush *brush,
uint16_t rop_decriptor)
{
- VectotGlyph *glyph = (VectotGlyph *)str->data;
+ SpiceVectorGlyph *glyph = (SpiceVectorGlyph *)str->data;
int i;
for (i = 0; i < str->length; i++) {
- VectotGlyph *next_glyph = canvas_next_vector_glyph(glyph);
+ SpiceVectorGlyph *next_glyph = canvas_next_vector_glyph(glyph);
access_test(&canvas->base, glyph, (uint8_t *)next_glyph - (uint8_t *)glyph);
canvas_set_path(canvas, glyph->data);
glyph = next_glyph;
@@ -1449,10 +1449,10 @@ static void canvas_draw_vector_str(CairoCanvas *canvas, String *str, Brush *brus
cairo_new_path(canvas->cairo);
}
-void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void canvas_draw_text(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
cairo_t *cairo = canvas->cairo;
- String *str;
+ SpiceString *str;
cairo_save(cairo);
canvas_clip(canvas, clip);
@@ -1466,13 +1466,13 @@ void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
(DrawMethod)cairo_fill_preserve, cairo);
cairo_new_path(cairo);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
- if (str->flags & STRING_RASTER_A1) {
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
canvas_draw_raster_str(canvas, str, 1, &text->fore_brush, text->fore_mode);
- } else if (str->flags & STRING_RASTER_A4) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
canvas_draw_raster_str(canvas, str, 4, &text->fore_brush, text->fore_mode);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
canvas_draw_raster_str(canvas, str, 8, &text->fore_brush, text->fore_mode);
@@ -1486,7 +1486,7 @@ void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_restore(cairo);
}
-void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void canvas_draw_stroke(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
cairo_t *cairo = canvas->cairo;
@@ -1494,12 +1494,12 @@ void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
canvas_clip(canvas, clip);
canvas_set_line_attr_no_dash(canvas, &stroke->attr);
- canvas_set_path(canvas, GET_ADDRESS(stroke->path));
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
+ canvas_set_path(canvas, SPICE_GET_ADDRESS(stroke->path));
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
canvas_draw(canvas, &stroke->brush, stroke->back_mode,
(DrawMethod)cairo_stroke_preserve, cairo);
canvas_set_dash(canvas, stroke->attr.style_nseg, stroke->attr.style,
- !!(stroke->attr.flags & LINE_ATTR_STARTGAP));
+ !!(stroke->attr.flags & SPICE_LINE_ATTR_STARTGAP));
}
canvas_draw(canvas, &stroke->brush, stroke->fore_mode, (DrawMethod)cairo_stroke_preserve,
cairo);
@@ -1507,7 +1507,7 @@ void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
cairo_restore(cairo);
}
-void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area)
+void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area)
{
cairo_t *cairo = canvas->cairo;
cairo_surface_t* surface;
@@ -1527,14 +1527,14 @@ void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const
}
}
-void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, Rect *clip_rects)
+void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, SpiceRect *clip_rects)
{
cairo_t *cairo = canvas->cairo;
cairo_save(cairo);
if (n_clip_rects) {
- Rect *end = clip_rects + n_clip_rects;
+ SpiceRect *end = clip_rects + n_clip_rects;
for (; clip_rects < end; clip_rects++) {
cairo_rectangle(cairo,
clip_rects->left,
diff --git a/common/cairo_canvas.h b/common/cairo_canvas.h
index d144b35d..da4d229e 100644
--- a/common/cairo_canvas.h
+++ b/common/cairo_canvas.h
@@ -27,33 +27,33 @@
typedef struct CairoCanvas CairoCanvas;
-void canvas_draw_fill(CairoCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void canvas_draw_copy(CairoCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void canvas_draw_opaque(CairoCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void canvas_copy_bits(CairoCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void canvas_draw_text(CairoCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
-void canvas_draw_stroke(CairoCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void canvas_draw_rop3(CairoCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void canvas_draw_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void canvas_draw_blackness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void canvas_draw_whiteness(CairoCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void canvas_draw_invers(CairoCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void canvas_draw_transparent(CairoCanvas *canvas, Rect *bbox, Clip *clip, Transparent* transparent);
-void canvas_draw_alpha_blend(CairoCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
+void canvas_draw_fill(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void canvas_draw_copy(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void canvas_draw_opaque(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void canvas_copy_bits(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void canvas_draw_text(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+void canvas_draw_stroke(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void canvas_draw_rop3(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void canvas_draw_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void canvas_draw_blackness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void canvas_draw_whiteness(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void canvas_draw_invers(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void canvas_draw_transparent(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent* transparent);
+void canvas_draw_alpha_blend(CairoCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
#ifdef WIN32
-void canvas_put_image(CairoCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void canvas_put_image(CairoCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
#else
-void canvas_put_image(CairoCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void canvas_put_image(CairoCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
#endif
void canvas_clear(CairoCanvas *canvas);
-void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area);
-void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, Rect *clip_rects);
+void canvas_read_bits(CairoCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
+void canvas_group_start(CairoCanvas *canvas, int n_clip_rects, SpiceRect *clip_rects);
void canvas_group_end(CairoCanvas *canvas);
-void canvas_set_addr_delta(CairoCanvas *canvas, ADDRESS delta);
+void canvas_set_addr_delta(CairoCanvas *canvas, SPICE_ADDRESS delta);
#ifdef CAIRO_CANVAS_ACCESS_TEST
void canvas_set_access_params(CairoCanvas *canvas, unsigned long base, unsigned long max);
#endif
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 2b8148d7..e4055933 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -79,10 +79,10 @@ typedef struct __declspec (align(1)) LZImage {
#else
typedef struct __attribute__ ((__packed__)) LZImage {
#endif
- ImageDescriptor descriptor;
+ SpiceImageDescriptor descriptor;
union {
- LZ_RGBData lz_rgb;
- LZ_PLTData lz_plt;
+ SpiceLZRGBData lz_rgb;
+ SpiceLZPLTData lz_plt;
};
} LZImage;
@@ -93,7 +93,7 @@ static const cairo_user_data_key_t invers_data_type = {0};
extern mutex_t cairo_surface_user_data_mutex;
#endif
-static inline double fix_to_double(FIXED28_4 fixed)
+static inline double fix_to_double(SPICE_FIXED28_4 fixed)
{
return (double)(fixed & 0x0f) / 0x0f + (fixed >> 4);
}
@@ -150,7 +150,7 @@ typedef struct QuicData {
QuicContext *quic;
jmp_buf jmp_env;
#ifndef CAIRO_CANVAS_NO_CHUNKS
- ADDRESS next;
+ SPICE_ADDRESS next;
get_virt_fn_t get_virt;
void *get_virt_opaque;
validate_virt_fn_t validate_virt;
@@ -200,8 +200,8 @@ typedef struct CanvasBase {
typedef struct ATTR_PACKED DataChunk {
UINT32 size;
- ADDRESS prev;
- ADDRESS next;
+ SPICE_ADDRESS prev;
+ SPICE_ADDRESS next;
UINT8 data[0];
} DataChunk;
@@ -214,7 +214,7 @@ typedef struct ATTR_PACKED DataChunk {
#endif
-static inline void canvas_localize_palette(CanvasBase *canvas, Palette *palette)
+static inline void canvas_localize_palette(CanvasBase *canvas, SpicePalette *palette)
{
if (canvas->color_shift == 5) {
UINT32 *now = palette->ents;
@@ -229,7 +229,7 @@ static inline void canvas_localize_palette(CanvasBase *canvas, Palette *palette)
#ifdef DEBUG_DUMP_COMPRESS
static void dump_surface(cairo_surface_t *surface, int cache);
#endif
-static cairo_surface_t *canvas_get_quic(CanvasBase *canvas, QUICImage *image, int invers)
+static cairo_surface_t *canvas_get_quic(CanvasBase *canvas, SpiceQUICImage *image, int invers)
{
cairo_surface_t *surface = NULL;
QuicData *quic_data = &canvas->quic_data;
@@ -360,7 +360,7 @@ static inline void canvas_copy_16bpp(uint8_t* dest, int dest_stride, uint8_t* sr
}
static inline void canvas_copy_8bpp(uint8_t *dest, int dest_stride, uint8_t *src, int src_stride,
- int width, uint8_t *end, Palette *palette)
+ int width, uint8_t *end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -379,7 +379,7 @@ static inline void canvas_copy_8bpp(uint8_t *dest, int dest_stride, uint8_t *src
}
static inline void canvas_copy_4bpp_be(uint8_t* dest, int dest_stride, uint8_t* src, int src_stride,
- int width, uint8_t* end, Palette *palette)
+ int width, uint8_t* end, SpicePalette *palette)
{
if (!palette) {
CANVAS_ERROR("no palette");
@@ -403,7 +403,7 @@ static inline void canvas_copy_4bpp_be(uint8_t* dest, int dest_stride, uint8_t*
}
static inline void canvas_copy_1bpp_be(uint8_t* dest, int dest_stride, uint8_t* src, int src_stride,
- int width, uint8_t* end, Palette *palette)
+ int width, uint8_t* end, SpicePalette *palette)
{
uint32_t fore_color;
uint32_t back_color;
@@ -429,10 +429,10 @@ static inline void canvas_copy_1bpp_be(uint8_t* dest, int dest_stride, uint8_t*
}
}
-static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bitmap,
- Palette *palette)
+static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap* bitmap,
+ SpicePalette *palette)
{
- uint8_t* src = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* src = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
int src_stride;
uint8_t* end;
uint8_t* dest;
@@ -447,7 +447,7 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
#ifdef WIN32
canvas->dc,
#endif
- (bitmap->format == BITMAP_FMT_RGBA) ? CAIRO_FORMAT_ARGB32 :
+ (bitmap->format == SPICE_BITMAP_FMT_RGBA) ? CAIRO_FORMAT_ARGB32 :
CAIRO_FORMAT_RGB24,
bitmap->x, bitmap->y, FALSE);
if (cairo_surface_status(cairo_surface) != CAIRO_STATUS_SUCCESS) {
@@ -456,30 +456,30 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
}
dest = cairo_image_surface_get_data(cairo_surface);
dest_stride = cairo_image_surface_get_stride(cairo_surface);
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
ASSERT(bitmap->y > 0);
dest += dest_stride * ((int)bitmap->y - 1);
dest_stride = -dest_stride;
}
switch (bitmap->format) {
- case BITMAP_FMT_32BIT:
- case BITMAP_FMT_RGBA:
+ case SPICE_BITMAP_FMT_32BIT:
+ case SPICE_BITMAP_FMT_RGBA:
canvas_copy_32bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_24BIT:
+ case SPICE_BITMAP_FMT_24BIT:
canvas_copy_24bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_16BIT:
+ case SPICE_BITMAP_FMT_16BIT:
canvas_copy_16bpp(dest, dest_stride, src, src_stride, bitmap->x, end);
break;
- case BITMAP_FMT_8BIT:
+ case SPICE_BITMAP_FMT_8BIT:
canvas_copy_8bpp(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_4BIT_BE:
+ case SPICE_BITMAP_FMT_4BIT_BE:
canvas_copy_4bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
canvas_copy_1bpp_be(dest, dest_stride, src, src_stride, bitmap->x, end, palette);
break;
}
@@ -488,23 +488,23 @@ static cairo_surface_t *canvas_bitmap_to_surface(CanvasBase *canvas, Bitmap* bit
#ifdef CAIRO_CANVAS_CACHE
-static inline Palette *canvas_get_palett(CanvasBase *canvas, ADDRESS base_palette, uint8_t flags)
+static inline SpicePalette *canvas_get_palett(CanvasBase *canvas, SPICE_ADDRESS base_palette, uint8_t flags)
{
- Palette *palette;
+ SpicePalette *palette;
if (!base_palette) {
return NULL;
}
- if (flags & BITMAP_PAL_FROM_CACHE) {
+ if (flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE) {
palette = canvas->palette_cache_get(canvas->palette_cache_opaque, base_palette);
- } else if (flags & BITMAP_PAL_CACHE_ME) {
- palette = (Palette *)GET_ADDRESS(base_palette);
- access_test(canvas, palette, sizeof(Palette));
- access_test(canvas, palette, sizeof(Palette) + palette->num_ents * sizeof(uint32_t));
+ } else if (flags & SPICE_BITMAP_FLAGS_PAL_CACHE_ME) {
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(base_palette);
+ access_test(canvas, palette, sizeof(SpicePalette));
+ access_test(canvas, palette, sizeof(SpicePalette) + palette->num_ents * sizeof(uint32_t));
canvas_localize_palette(canvas, palette);
canvas->palette_cache_put(canvas->palette_cache_opaque, palette);
} else {
- palette = (Palette *)GET_ADDRESS(base_palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(base_palette);
canvas_localize_palette(canvas, palette);
}
return palette;
@@ -518,7 +518,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
uint8_t *decomp_buf = NULL;
uint8_t *src;
LzImageType type;
- Palette *palette;
+ SpicePalette *palette;
int alpha;
int n_comp_pixels;
int width;
@@ -533,11 +533,11 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
CANVAS_ERROR("lz error, %s", lz_data->message_buf);
}
- if (image->descriptor.type == IMAGE_TYPE_LZ_RGB) {
+ if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_RGB) {
comp_buf = image->lz_rgb.data;
comp_size = image->lz_rgb.data_size;
palette = NULL;
- } else if (image->descriptor.type == IMAGE_TYPE_LZ_PLT) {
+ } else if (image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) {
comp_buf = image->lz_plt.data;
comp_size = image->lz_plt.data_size;
palette = canvas_get_palett(canvas, image->lz_plt.palette, image->lz_plt.flags);
@@ -569,7 +569,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
ASSERT(width == image->descriptor.width);
ASSERT(height == image->descriptor.height);
- ASSERT((image->descriptor.type == IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height));
+ ASSERT((image->descriptor.type == SPICE_IMAGE_TYPE_LZ_PLT) || (n_comp_pixels == width * height));
#ifdef WIN32
lz_data->decode_data.dc = canvas->dc;
#endif
@@ -612,7 +612,7 @@ static cairo_surface_t *canvas_get_lz(CanvasBase *canvas, LZImage *image, int in
// same byte sequence can be transformed to different RGB pixels by different plts)
static cairo_surface_t *canvas_get_glz(CanvasBase *canvas, LZImage *image)
{
- ASSERT(image->descriptor.type == IMAGE_TYPE_GLZ_RGB);
+ ASSERT(image->descriptor.type == SPICE_IMAGE_TYPE_GLZ_RGB);
#ifdef WIN32
canvas->glz_data.decode_data.dc = canvas->dc;
#endif
@@ -625,9 +625,9 @@ static cairo_surface_t *canvas_get_glz(CanvasBase *canvas, LZImage *image)
//#define DEBUG_DUMP_BITMAP
#ifdef DEBUG_DUMP_BITMAP
-static void dump_bitmap(Bitmap *bitmap, Palette *palette)
+static void dump_bitmap(SpiceBitmap *bitmap, SpicePalette *palette)
{
- uint8_t* data = (uint8_t *)GET_ADDRESS(bitmap->data);
+ uint8_t* data = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
static uint32_t file_id = 0;
uint32_t i, j;
char file_str[200];
@@ -662,10 +662,10 @@ static void dump_bitmap(Bitmap *bitmap, Palette *palette)
#endif
-static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap)
{
cairo_surface_t* surface;
- Palette *palette;
+ SpicePalette *palette;
palette = canvas_get_palett(canvas, bitmap->palette, bitmap->flags);
#ifdef DEBUG_DUMP_BITMAP
@@ -676,7 +676,7 @@ static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
surface = canvas_bitmap_to_surface(canvas, bitmap, palette);
- if (palette && (bitmap->flags & BITMAP_PAL_FROM_CACHE)) {
+ if (palette && (bitmap->flags & SPICE_BITMAP_FLAGS_PAL_FROM_CACHE)) {
canvas->palette_cache_release(palette);
}
@@ -686,17 +686,17 @@ static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
#else
-static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, Bitmap *bitmap)
+static cairo_surface_t *canvas_get_bits(CanvasBase *canvas, SpiceBitmap *bitmap)
{
- Palette *palette;
+ SpicePalette *palette;
if (!bitmap->palette) {
return canvas_bitmap_to_surface(canvas, bitmap, NULL);
}
- palette = (Palette *)GET_ADDRESS(bitmap->palette);
+ palette = (SpicePalette *)SPICE_GET_ADDRESS(bitmap->palette);
if (canvas->color_shift == 5) {
- int size = sizeof(Palette) + (palette->num_ents << 2);
- Palette *local_palette = malloc(size);
+ int size = sizeof(SpicePalette) + (palette->num_ents << 2);
+ SpicePalette *local_palette = malloc(size);
cairo_surface_t* surface;
memcpy(local_palette, palette, size);
@@ -773,49 +773,49 @@ static void __release_surface(void *inv_surf)
//#define DEBUG_LZ
-static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_image(CanvasBase *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
cairo_surface_t *surface;
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
#ifdef DEBUG_LZ
LOG_DEBUG("canvas_get_image image type: " << (int)descriptor->type);
#endif
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
surface = canvas_get_quic(canvas, image, 0);
break;
}
#ifdef CAIRO_CANVAS_NO_CHUNKS
- case IMAGE_TYPE_LZ_PLT: {
- access_test(canvas, descriptor, sizeof(LZ_PLTImage));
+ case SPICE_IMAGE_TYPE_LZ_PLT: {
+ access_test(canvas, descriptor, sizeof(SpiceLZPLTImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_lz(canvas, image, 0);
break;
}
- case IMAGE_TYPE_LZ_RGB: {
- access_test(canvas, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_LZ_RGB: {
+ access_test(canvas, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_lz(canvas, image, 0);
break;
}
#endif
#ifdef USE_GLZ
- case IMAGE_TYPE_GLZ_RGB: {
- access_test(canvas, descriptor, sizeof(LZ_RGBImage));
+ case SPICE_IMAGE_TYPE_GLZ_RGB: {
+ access_test(canvas, descriptor, sizeof(SpiceLZRGBImage));
LZImage *image = (LZImage *)descriptor;
surface = canvas_get_glz(canvas, image);
break;
}
#endif
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
return canvas->bits_cache_get(canvas->bits_cache_opaque, descriptor->id);
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
surface = canvas_get_bits(canvas, &bitmap->bitmap);
break;
}
@@ -823,12 +823,12 @@ static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
CANVAS_ERROR("invalid image type");
}
- if (descriptor->flags & IMAGE_CACHE_ME) {
+ if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME) {
canvas->bits_cache_put(canvas->bits_cache_opaque, descriptor->id, surface);
#ifdef DEBUG_DUMP_SURFACE
dump_surface(surface, 1);
#endif
- } else if (descriptor->type != IMAGE_TYPE_FROM_CACHE) {
+ } else if (descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE) {
#ifdef DEBUG_DUMP_SURFACE
dump_surface(surface, 0);
#endif
@@ -838,21 +838,21 @@ static cairo_surface_t *canvas_get_image(CanvasBase *canvas, ADDRESS addr)
#else
-static cairo_surface_t *canvas_get_image(CairoCanvas *canvas, ADDRESS addr)
+static cairo_surface_t *canvas_get_image(CairoCanvas *canvas, SPICE_ADDRESS addr)
{
- ImageDescriptor *descriptor = (ImageDescriptor *)GET_ADDRESS(addr);
+ SpiceImageDescriptor *descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(addr);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
switch (descriptor->type) {
- case IMAGE_TYPE_QUIC: {
- QUICImage *image = (QUICImage *)descriptor;
- access_test(canvas, descriptor, sizeof(QUICImage));
+ case SPICE_IMAGE_TYPE_QUIC: {
+ SpiceQUICImage *image = (SpiceQUICImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceQUICImage));
return canvas_get_quic(canvas, image, 0);
}
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
return canvas_get_bits(canvas, &bitmap->bitmap);
}
default:
@@ -875,7 +875,7 @@ static inline uint8_t revers_bits(uint8_t byte)
return ret;
}
-static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitmap, int invers)
+static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, SpiceBitmap* bitmap, int invers)
{
cairo_surface_t *surface;
uint8_t *src_line;
@@ -895,7 +895,7 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
cairo_status_to_string(cairo_surface_status(surface)));
}
- src_line = (uint8_t *)GET_ADDRESS(bitmap->data);
+ src_line = (uint8_t *)SPICE_GET_ADDRESS(bitmap->data);
src_stride = bitmap->stride;
end_line = src_line + (bitmap->y * src_stride);
access_test(canvas, src_line, end_line - src_line);
@@ -904,9 +904,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
dest_stride = cairo_image_surface_get_stride(surface);
dest_line = cairo_image_surface_get_data(surface);
#if defined(GL_CANVAS)
- if ((bitmap->flags & BITMAP_TOP_DOWN)) {
+ if ((bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
#else
- if (!(bitmap->flags & BITMAP_TOP_DOWN)) {
+ if (!(bitmap->flags & SPICE_BITMAP_FLAGS_TOP_DOWN)) {
#endif
ASSERT(bitmap->y > 0);
dest_line += dest_stride * ((int)bitmap->y - 1);
@@ -916,9 +916,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
if (invers) {
switch (bitmap->format) {
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#else
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -930,9 +930,9 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
}
break;
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#else
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -951,18 +951,18 @@ static cairo_surface_t *canvas_get_bitmap_mask(CanvasBase *canvas, Bitmap* bitma
} else {
switch (bitmap->format) {
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#else
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
memcpy(dest_line, src_line, line_size);
}
break;
#if defined(GL_CANVAS) || defined(GDI_CANVAS)
- case BITMAP_FMT_1BIT_LE:
+ case SPICE_BITMAP_FMT_1BIT_LE:
#else
- case BITMAP_FMT_1BIT_BE:
+ case SPICE_BITMAP_FMT_1BIT_BE:
#endif
for (; src_line != end_line; src_line += src_stride, dest_line += dest_stride) {
uint8_t *dest = dest_line;
@@ -1092,9 +1092,9 @@ static inline cairo_surface_t* canvas_handle_inverse_user_data(cairo_surface_t*
return inv_surf;
}
-static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
+static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask)
{
- ImageDescriptor *descriptor;
+ SpiceImageDescriptor *descriptor;
cairo_surface_t *surface;
int need_invers;
int is_invers;
@@ -1104,26 +1104,26 @@ static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
return NULL;
}
- descriptor = (ImageDescriptor *)GET_ADDRESS(mask->bitmap);
- access_test(canvas, descriptor, sizeof(ImageDescriptor));
- need_invers = mask->flags & MASK_INVERS;
+ descriptor = (SpiceImageDescriptor *)SPICE_GET_ADDRESS(mask->bitmap);
+ access_test(canvas, descriptor, sizeof(SpiceImageDescriptor));
+ need_invers = mask->flags & SPICE_MASK_FLAGS_INVERS;
#ifdef CAIRO_CANVAS_CACHE
- cache_me = descriptor->flags & IMAGE_CACHE_ME;
+ cache_me = descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME;
#else
cache_me = 0;
#endif
switch (descriptor->type) {
- case IMAGE_TYPE_BITMAP: {
- BitmapImage *bitmap = (BitmapImage *)descriptor;
- access_test(canvas, descriptor, sizeof(BitmapImage));
+ case SPICE_IMAGE_TYPE_BITMAP: {
+ SpiceBitmapImage *bitmap = (SpiceBitmapImage *)descriptor;
+ access_test(canvas, descriptor, sizeof(SpiceBitmapImage));
is_invers = need_invers && !cache_me;
surface = canvas_get_bitmap_mask(canvas, &bitmap->bitmap, is_invers);
break;
}
#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE)
- case IMAGE_TYPE_FROM_CACHE:
+ case SPICE_IMAGE_TYPE_FROM_CACHE:
surface = canvas->bits_cache_get(canvas->bits_cache_opaque, descriptor->id);
is_invers = 0;
break;
@@ -1149,13 +1149,13 @@ static cairo_surface_t *canvas_get_mask(CanvasBase *canvas, QMask *mask)
return surface;
}
-static inline RasterGlyph *canvas_next_raster_glyph(const RasterGlyph *glyph, int bpp)
+static inline SpiceRasterGlyph *canvas_next_raster_glyph(const SpiceRasterGlyph *glyph, int bpp)
{
- return (RasterGlyph *)((uint8_t *)(glyph + 1) +
+ return (SpiceRasterGlyph *)((uint8_t *)(glyph + 1) +
(ALIGN(glyph->width * bpp, 8) * glyph->height >> 3));
}
-static inline void canvas_raster_glyph_box(const RasterGlyph *glyph, Rect *r)
+static inline void canvas_raster_glyph_box(const SpiceRasterGlyph *glyph, SpiceRect *r)
{
ASSERT(r);
r->top = glyph->render_pos.y + glyph->glyph_origin.y;
@@ -1222,15 +1222,15 @@ static inline void canvas_put_bits(uint8_t *dest, int dest_offset, uint8_t *src,
}
}
-static void canvas_put_glyph_bits(RasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride,
- Rect *bounds)
+static void canvas_put_glyph_bits(SpiceRasterGlyph *glyph, int bpp, uint8_t *dest, int dest_stride,
+ SpiceRect *bounds)
{
- Rect glyph_box;
+ SpiceRect glyph_box;
uint8_t *src;
int lines;
int width;
- //todo: support STRING_RASTER_TOP_DOWN
+ //todo: support SPICE_STRING_FLAGS_RASTER_TOP_DOWN
canvas_raster_glyph_box(glyph, &glyph_box);
ASSERT(glyph_box.top >= bounds->top && glyph_box.bottom <= bounds->bottom);
ASSERT(glyph_box.left >= bounds->left && glyph_box.right <= bounds->right);
@@ -1298,11 +1298,11 @@ static void canvas_put_glyph_bits(RasterGlyph *glyph, int bpp, uint8_t *dest, in
}
}
-static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int bpp, Point *pos)
+static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, SpiceString *str, int bpp, SpicePoint *pos)
{
- RasterGlyph *glyph = (RasterGlyph *)str->data;
- RasterGlyph *next_glyph;
- Rect bounds;
+ SpiceRasterGlyph *glyph = (SpiceRasterGlyph *)str->data;
+ SpiceRasterGlyph *next_glyph;
+ SpiceRect bounds;
cairo_surface_t *str_mask;
uint8_t *dest;
int dest_stride;
@@ -1310,16 +1310,16 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
ASSERT(str->length > 0);
- access_test(canvas, glyph, sizeof(RasterGlyph));
+ access_test(canvas, glyph, sizeof(SpiceRasterGlyph));
next_glyph = canvas_next_raster_glyph(glyph, bpp);
access_test(canvas, glyph, (uint8_t*)next_glyph - (uint8_t*)glyph);
canvas_raster_glyph_box(glyph, &bounds);
for (i = 1; i < str->length; i++) {
- Rect glyph_box;
+ SpiceRect glyph_box;
glyph = next_glyph;
- access_test(canvas, glyph, sizeof(RasterGlyph));
+ access_test(canvas, glyph, sizeof(SpiceRasterGlyph));
next_glyph = canvas_next_raster_glyph(glyph, bpp);
access_test(canvas, glyph, (uint8_t*)next_glyph - (uint8_t*)glyph);
canvas_raster_glyph_box(glyph, &glyph_box);
@@ -1335,7 +1335,7 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
}
dest = cairo_image_surface_get_data(str_mask);
dest_stride = cairo_image_surface_get_stride(str_mask);
- glyph = (RasterGlyph *)str->data;
+ glyph = (SpiceRasterGlyph *)str->data;
for (i = 0; i < str->length; i++) {
#if defined(GL_CANVAS)
canvas_put_glyph_bits(glyph, bpp, dest + (bounds.bottom - bounds.top - 1) * dest_stride,
@@ -1351,12 +1351,12 @@ static cairo_surface_t *canvas_get_str_mask(CanvasBase *canvas, String *str, int
return str_mask;
}
-static inline VectotGlyph *canvas_next_vector_glyph(const VectotGlyph *glyph)
+static inline SpiceVectorGlyph *canvas_next_vector_glyph(const SpiceVectorGlyph *glyph)
{
- return (VectotGlyph *)((uint8_t *)(glyph + 1) + glyph->data_size);
+ return (SpiceVectorGlyph *)((uint8_t *)(glyph + 1) + glyph->data_size);
}
-static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const Rect *src_area, int width,
+static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const SpiceRect *src_area, int width,
int hight, int scale_mode)
{
cairo_t *cairo;
@@ -1389,8 +1389,8 @@ static cairo_surface_t *canvas_scale_surface(cairo_surface_t *src, const Rect *s
cairo_matrix_scale(&matrix, sx, sy);
cairo_pattern_set_matrix(pattern, &matrix);
- ASSERT(scale_mode == IMAGE_SCALE_INTERPOLATE || scale_mode == IMAGE_SCALE_NEAREST);
- cairo_pattern_set_filter(pattern, (scale_mode == IMAGE_SCALE_NEAREST) ?
+ ASSERT(scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE || scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST);
+ cairo_pattern_set_filter(pattern, (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) ?
CAIRO_FILTER_NEAREST : CAIRO_FILTER_GOOD);
cairo_set_source(cairo, pattern);
diff --git a/common/canvas_base.h b/common/canvas_base.h
index 36529bd5..8a574e2a 100644
--- a/common/canvas_base.h
+++ b/common/canvas_base.h
@@ -28,13 +28,13 @@ typedef void (*bits_cache_put_fn_t)(void *bits_cache_opaque, uint64_t id, cairo_
typedef cairo_surface_t *(*bits_cache_get_fn_t)(void *bits_cache_opaque, uint64_t id);
#endif
#ifdef CAIRO_CANVAS_CACHE
-typedef void (*palette_cache_put_fn_t)(void *palette_cache_opaque, Palette *palette);
-typedef Palette *(*palette_cache_get_fn_t)(void *palette_cache_opaque, uint64_t id);
-typedef void (*palette_cache_release_fn_t)(Palette *palette);
+typedef void (*palette_cache_put_fn_t)(void *palette_cache_opaque, SpicePalette *palette);
+typedef SpicePalette *(*palette_cache_get_fn_t)(void *palette_cache_opaque, uint64_t id);
+typedef void (*palette_cache_release_fn_t)(SpicePalette *palette);
#endif
typedef void (*glz_decode_fn_t)(void *glz_decoder_opaque, uint8_t *data,
- Palette *plt, void *usr_data);
+ SpicePalette *plt, void *usr_data);
#ifndef CAIRO_CANVAS_NO_CHUNKS
typedef void *(*get_virt_fn_t)(void *get_virt_opaque, unsigned long addr, uint32_t add_size);
typedef void (*validate_virt_fn_t)(void *validate_virt_opaque, unsigned long virt,
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 9c7e6693..b60bef2a 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -35,7 +35,7 @@ struct GdiCanvas {
struct BitmapData {
HBITMAP hbitmap;
HBITMAP prev_hbitmap;
- Point pos;
+ SpicePoint pos;
uint8_t flags;
HDC dc;
int cache;
@@ -321,20 +321,20 @@ static void set_path(GdiCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
BeginPath(canvas->dc);
if (!MoveToEx(canvas->dc, (int)fix_to_double(point->x), (int)fix_to_double(point->y),
NULL)) {
@@ -344,7 +344,7 @@ static void set_path(GdiCanvas *canvas, void *addr)
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
POINT points[3];
@@ -369,9 +369,9 @@ static void set_path(GdiCanvas *canvas, void *addr)
}
}
- if (flags & PATH_END) {
+ if (flags & SPICE_PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_CLOSE) {
if (!CloseFigure(canvas->dc)) {
CANVAS_ERROR("CloseFigure failed");
}
@@ -387,29 +387,29 @@ static void set_path(GdiCanvas *canvas, void *addr)
static void set_scale_mode(GdiCanvas *canvas, uint8_t scale_mode)
{
- if (scale_mode == IMAGE_SCALE_INTERPOLATE) {
+ if (scale_mode == SPICE_IMAGE_SCALE_MODE_INTERPOLATE) {
SetStretchBltMode(canvas->dc, HALFTONE);
- } else if (scale_mode == IMAGE_SCALE_NEAREST) {
+ } else if (scale_mode == SPICE_IMAGE_SCALE_MODE_NEAREST) {
SetStretchBltMode(canvas->dc, COLORONCOLOR);
} else {
CANVAS_ERROR("Unknown ScaleMode");
}
}
-static void set_clip(GdiCanvas *canvas, Clip *clip)
+static void set_clip(GdiCanvas *canvas, SpiceClip *clip)
{
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
if (SelectClipRgn(canvas->dc, NULL) == ERROR) {
CANVAS_ERROR("SelectClipRgn failed");
}
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
if (now < end) {
@@ -443,8 +443,8 @@ static void set_clip(GdiCanvas *canvas, Clip *clip)
}
break;
}
- case CLIP_TYPE_PATH:
- set_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH:
+ set_path(canvas, SPICE_GET_ADDRESS(clip->data));
if (SelectClipPath(canvas->dc, RGN_COPY) == ERROR) {
CANVAS_ERROR("Unable to SelectClipPath");
}
@@ -631,17 +631,17 @@ static inline COLORREF get_color_ref(GdiCanvas *canvas, uint32_t color)
return RGB(r, g, b);
}
-static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
+static HBRUSH get_brush(GdiCanvas *canvas, SpiceBrush *brush)
{
HBRUSH hbrush;
switch (brush->type) {
- case BRUSH_TYPE_SOLID:
+ case SPICE_BRUSH_TYPE_SOLID:
if (!(hbrush = CreateSolidBrush(get_color_ref(canvas, brush->u.color)))) {
CANVAS_ERROR("CreateSolidBrush failed");
}
return hbrush;
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
GdiImage image;
HBRUSH hbrush;
cairo_surface_t *surface;
@@ -666,7 +666,7 @@ static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
cairo_surface_destroy(surface);
return hbrush;
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return NULL;
default:
CANVAS_ERROR("invalid brush type");
@@ -674,13 +674,13 @@ static HBRUSH get_brush(GdiCanvas *canvas, Brush *brush)
}
}
-static HBRUSH set_brush(HDC dc, HBRUSH hbrush, Brush *brush)
+static HBRUSH set_brush(HDC dc, HBRUSH hbrush, SpiceBrush *brush)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
return (HBRUSH)SelectObject(dc, hbrush);
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
HBRUSH prev_hbrush;
prev_hbrush = (HBRUSH)SelectObject(dc, hbrush);
if (!SetBrushOrgEx(dc, brush->u.pattern.pos.x, brush->u.pattern.pos.y, NULL)) {
@@ -711,13 +711,13 @@ uint8_t calc_rop3(uint16_t rop3_bits, int brush)
uint8_t rop3_brush = _rop3_brush;
uint8_t rop3_src_brush;
- if (rop3_bits & ROPD_INVERS_SRC) {
+ if (rop3_bits & SPICE_ROPD_INVERS_SRC) {
rop3_src = ~rop3_src;
}
- if (rop3_bits & ROPD_INVERS_BRUSH) {
+ if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) {
rop3_brush = ~rop3_brush;
}
- if (rop3_bits & ROPD_INVERS_DEST) {
+ if (rop3_bits & SPICE_ROPD_INVERS_DEST) {
rop3_dest = ~rop3_dest;
}
@@ -727,24 +727,24 @@ uint8_t calc_rop3(uint16_t rop3_bits, int brush)
rop3_src_brush = rop3_src;
}
- if (rop3_bits & ROPD_OP_PUT) {
+ if (rop3_bits & SPICE_ROPD_OP_PUT) {
rop3 = rop3_src_brush;
}
- if (rop3_bits & ROPD_OP_OR) {
+ if (rop3_bits & SPICE_ROPD_OP_OR) {
rop3 = rop3_src_brush | rop3_dest;
}
- if (rop3_bits & ROPD_OP_AND) {
+ if (rop3_bits & SPICE_ROPD_OP_AND) {
rop3 = rop3_src_brush & rop3_dest;
}
- if (rop3_bits & ROPD_OP_XOR) {
+ if (rop3_bits & SPICE_ROPD_OP_XOR) {
rop3 = rop3_src_brush ^ rop3_dest;
}
- if (rop3_bits & ROPD_INVERS_RES) {
+ if (rop3_bits & SPICE_ROPD_INVERS_RES) {
rop3 = ~rop3_dest;
}
- if (rop3_bits & ROPD_OP_BLACKNESS || rop3_bits & ROPD_OP_WHITENESS ||
- rop3_bits & ROPD_OP_INVERS) {
+ if (rop3_bits & SPICE_ROPD_OP_BLACKNESS || rop3_bits & SPICE_ROPD_OP_WHITENESS ||
+ rop3_bits & SPICE_ROPD_OP_INVERS) {
CANVAS_ERROR("invalid rop3 type");
}
return rop3;
@@ -756,27 +756,27 @@ uint8_t calc_rop3_src_brush(uint16_t rop3_bits)
uint8_t rop3_src = _rop3_src;
uint8_t rop3_brush = _rop3_brush;
- if (rop3_bits & ROPD_INVERS_SRC) {
+ if (rop3_bits & SPICE_ROPD_INVERS_SRC) {
rop3_src = ~rop3_src;
}
- if (rop3_bits & ROPD_INVERS_BRUSH) {
+ if (rop3_bits & SPICE_ROPD_INVERS_BRUSH) {
rop3_brush = ~rop3_brush;
}
- if (rop3_bits & ROPD_OP_OR) {
+ if (rop3_bits & SPICE_ROPD_OP_OR) {
rop3 = rop3_src | rop3_brush;
}
- if (rop3_bits & ROPD_OP_AND) {
+ if (rop3_bits & SPICE_ROPD_OP_AND) {
rop3 = rop3_src & rop3_brush;
}
- if (rop3_bits & ROPD_OP_XOR) {
+ if (rop3_bits & SPICE_ROPD_OP_XOR) {
rop3 = rop3_src ^ rop3_brush;
}
return rop3;
}
-static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct QMask *mask)
+static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct SpiceQMask *mask)
{
cairo_surface_t *surface;
struct BitmapData bitmap;
@@ -810,7 +810,7 @@ static struct BitmapData get_mask_bitmap(struct GdiCanvas *canvas, struct QMask
return bitmap;
}
-static void gdi_draw_bitmap(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, struct BitmapData *bitmapmask, uint32_t rop3_val)
{
uint32_t rast_oper;
@@ -843,7 +843,7 @@ static void gdi_draw_bitmap(HDC dest_dc, const Rect *src, const Rect *dest,
}
}
-static void gdi_draw_bitmap_redrop(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap_redrop(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, struct BitmapData *bitmapmask,
uint16_t rop, int brush)
{
@@ -861,12 +861,12 @@ static void free_mask(struct BitmapData *bitmap)
}
static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
- String *str, int n, Rect *dest,
- Rect *src, Brush *brush)
+ SpiceString *str, int n, SpiceRect *dest,
+ SpiceRect *src, SpiceBrush *brush)
{
cairo_surface_t *surface;
struct BitmapData bitmap;
- Point pos;
+ SpicePoint pos;
int dest_stride;
uint8_t *bitmap_data;
HBRUSH prev_hbrush;
@@ -941,7 +941,7 @@ static void draw_str_mask_bitmap(struct GdiCanvas *canvas,
free_mask(&bitmap);
}
-static void gdi_draw_image(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride, int bit_width,
int bit_height, struct BitmapData *bitmapmask, uint16_t rop,
int rotate)
@@ -958,7 +958,7 @@ static void gdi_draw_image(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-static void gdi_draw_image_rop3(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image_rop3(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride, int bit_width,
int bit_height, struct BitmapData *bitmapmask, uint8_t rop3,
int rotate)
@@ -975,7 +975,7 @@ static void gdi_draw_image_rop3(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void gdi_canvas_draw_fill(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
HBRUSH prev_hbrush;
HBRUSH brush;
@@ -991,13 +991,13 @@ void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
set_clip(canvas, clip);
prev_hbrush = set_brush(canvas->dc, brush, &fill->brush);
gdi_draw_bitmap_redrop(canvas->dc, bbox, bbox, canvas->dc, &bitmapmask,
- fill->rop_decriptor, fill->brush.type != BRUSH_TYPE_NONE);
+ fill->rop_decriptor, fill->brush.type != SPICE_BRUSH_TYPE_NONE);
free_mask(&bitmapmask);
unset_brush(canvas->dc, prev_hbrush);
}
-void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void gdi_canvas_draw_copy(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1035,18 +1035,18 @@ void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
cairo_surface_destroy(surface);
}
-void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
{
- Rect src;
+ SpiceRect src;
src.top = 0;
src.bottom = src_height;
src.left = 0;
src.right = src_width;
Lock lock(*canvas->lock);
- set_scale_mode(canvas, IMAGE_SCALE_NEAREST);
+ set_scale_mode(canvas, SPICE_IMAGE_SCALE_MODE_NEAREST);
if (clip) {
if (clip->num_rects == 0) {
return;
@@ -1090,15 +1090,15 @@ void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uin
if (dc) {
gdi_draw_bitmap_redrop(canvas->dc, &src, dest, dc,
- NULL, ROPD_OP_PUT, 0);
+ NULL, SPICE_ROPD_OP_PUT, 0);
} else {
gdi_draw_image(canvas->dc, &src, dest, src_data,
- src_stride, src_width, src_height, NULL, ROPD_OP_PUT, 0);
+ src_stride, src_width, src_height, NULL, SPICE_ROPD_OP_PUT, 0);
}
}
-static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const Rect *src,
- const Rect *dest, HDC src_dc, uint32_t color)
+static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src,
+ const SpiceRect *dest, HDC src_dc, uint32_t color)
{
TransparentBlt(dest_dc, dest->left, dest->top, dest->right - dest->left,
dest->bottom - dest->top, src_dc, src->left, src->top,
@@ -1106,8 +1106,8 @@ static void gdi_draw_bitmap_transparent(GdiCanvas *canvas, HDC dest_dc, const Re
RGB(((uint8_t*)&color)[2], ((uint8_t*)&color)[1], ((uint8_t*)&color)[0]));
}
-static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const Rect *src,
- const Rect *dest, const uint8_t *bitmap_data,
+static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const SpiceRect *src,
+ const SpiceRect *dest, const uint8_t *bitmap_data,
int bit_stride, int bit_width, int bit_height,
uint32_t color, int rotate)
{
@@ -1123,8 +1123,8 @@ static void gdi_draw_image_transparent(GdiCanvas *canvas, HDC dest_dc, const Rec
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
- Transparent* transparent)
+void gdi_canvas_draw_transparent(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceTransparent* transparent)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1156,7 +1156,7 @@ void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
cairo_surface_destroy(surface);
}
-static void gdi_draw_bitmap_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_bitmap_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
HDC src_dc, uint8_t alpha, int use_bitmap_alpha)
{
BLENDFUNCTION bf;
@@ -1178,7 +1178,7 @@ static void gdi_draw_bitmap_alpha(HDC dest_dc, const Rect *src, const Rect *dest
}
}
-static void gdi_draw_image_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
+static void gdi_draw_image_alpha(HDC dest_dc, const SpiceRect *src, const SpiceRect *dest,
const uint8_t *bitmap_data, int bit_stride,
int bit_width, int bit_height, uint8_t alpha,
int rotate, int use_bitmap_alpha)
@@ -1195,7 +1195,7 @@ static void gdi_draw_image_alpha(HDC dest_dc, const Rect *src, const Rect *dest,
release_bitmap(dc, bitmap, prev_bitmap, 0);
}
-void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend)
+void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1229,7 +1229,7 @@ void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Alph
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void gdi_canvas_draw_opaque(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1274,7 +1274,7 @@ void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *o
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void gdi_canvas_draw_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1311,7 +1311,7 @@ void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *ble
cairo_surface_destroy(surface);
}
-void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void gdi_canvas_draw_blackness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
struct BitmapData bitmapmask;
@@ -1324,7 +1324,7 @@ void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackn
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void gdi_canvas_draw_invers(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
struct BitmapData bitmapmask;
@@ -1337,7 +1337,7 @@ void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *i
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void gdi_canvas_draw_whiteness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
struct BitmapData bitmapmask;
@@ -1350,7 +1350,7 @@ void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiten
free_mask(&bitmapmask);
}
-void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void gdi_canvas_draw_rop3(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_surface_t *surface;
GdiImage image;
@@ -1392,7 +1392,7 @@ void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_surface_destroy(surface);
}
-void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void gdi_canvas_copy_bits(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
Lock lock(*canvas->lock);
@@ -1402,9 +1402,9 @@ void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_
bbox->bottom - bbox->top, canvas->dc, src_pos->x, src_pos->y, SRCCOPY);
}
-void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void gdi_canvas_draw_text(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
- String *str;
+ SpiceString *str;
Lock lock(*canvas->lock);
set_clip(canvas, clip);
@@ -1422,23 +1422,23 @@ void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
unset_brush(canvas->dc, prev_hbrush);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
- if (str->flags & STRING_RASTER_A1) {
- Rect dest;
- Rect src;
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 1, &dest, &src, &text->fore_brush);
- } else if (str->flags & STRING_RASTER_A4) {
- Rect dest;
- Rect src;
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 4, &dest, &src, &text->fore_brush);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
- Rect dest;
- Rect src;
+ SpiceRect dest;
+ SpiceRect src;
draw_str_mask_bitmap(canvas, str, 8, &dest, &src, &text->fore_brush);
}
@@ -1452,11 +1452,11 @@ void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
static int get_join_style(uint8_t join_style)
{
switch (join_style) {
- case LINE_JOIN_ROUND:
+ case SPICE_LINE_JOIN_ROUND:
return PS_JOIN_ROUND;
- case LINE_JOIN_BEVEL:
+ case SPICE_LINE_JOIN_BEVEL:
return PS_JOIN_BEVEL;
- case LINE_JOIN_MITER:
+ case SPICE_LINE_JOIN_MITER:
return PS_JOIN_MITER;
default:
CANVAS_ERROR("bad join style %d", join_style);
@@ -1466,20 +1466,20 @@ static int get_join_style(uint8_t join_style)
static int get_cap(int end_style)
{
switch (end_style) {
- case LINE_CAP_ROUND:
+ case SPICE_LINE_CAP_ROUND:
return PS_ENDCAP_ROUND;
- case LINE_CAP_SQUARE:
+ case SPICE_LINE_CAP_SQUARE:
return PS_ENDCAP_SQUARE;
- case LINE_CAP_BUTT:
+ case SPICE_LINE_CAP_BUTT:
return PS_ENDCAP_FLAT;
default:
CANVAS_ERROR("bad end style %d", end_style);
}
}
-static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, ADDRESS addr, int start_is_gap)
+static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, SPICE_ADDRESS addr, int start_is_gap)
{
- FIXED28_4* style = (FIXED28_4*)GET_ADDRESS(addr);
+ SPICE_FIXED28_4* style = (SPICE_FIXED28_4*)SPICE_GET_ADDRESS(addr);
double offset = 0;
uint32_t *local_style;
int i;
@@ -1508,7 +1508,7 @@ static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, UINT8 nseg, ADDRESS addr,
return local_style;
}
-void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void gdi_canvas_draw_stroke(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
HPEN hpen;
HPEN prev_hpen;
@@ -1518,7 +1518,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
uint32_t *user_style = NULL;
cairo_surface_t *surface = NULL;
- if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
surface = canvas_get_image(&canvas->base, stroke->brush.u.pattern.pat);
}
@@ -1526,49 +1526,49 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
set_clip(canvas, clip);
switch (stroke->fore_mode) {
- case ROPD_OP_WHITENESS:
+ case SPICE_ROPD_OP_WHITENESS:
SetROP2(canvas->dc, R2_WHITE); //0
break;
- case ROPD_OP_BLACKNESS:
+ case SPICE_ROPD_OP_BLACKNESS:
SetROP2(canvas->dc, R2_BLACK); //1
break;
- case ROPD_OP_INVERS:
+ case SPICE_ROPD_OP_INVERS:
SetROP2(canvas->dc, R2_NOT); //Dn
break;
- case ROPD_OP_PUT:
+ case SPICE_ROPD_OP_PUT:
SetROP2(canvas->dc, R2_COPYPEN); //P
break;
- case ROPD_OP_OR:
+ case SPICE_ROPD_OP_OR:
SetROP2(canvas->dc, R2_MERGEPEN); //DPo
break;
- case ROPD_OP_XOR:
+ case SPICE_ROPD_OP_XOR:
SetROP2(canvas->dc, R2_XORPEN); //DPx
break;
- case ROPD_OP_AND:
+ case SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKPEN); //DPa
break;
- case ROPD_INVERS_BRUSH | ROPD_OP_PUT: //Pn
+ case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_PUT: //Pn
SetROP2(canvas->dc, R2_NOTCOPYPEN);
break;
- case ROPD_OP_XOR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTXORPEN); //DPxn
break;
- case ROPD_OP_OR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTMERGEPEN); //DPon
break;
- case ROPD_OP_AND | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES:
SetROP2(canvas->dc, R2_NOTMASKPEN); //DPan
break;
- case ROPD_INVERS_DEST | ROPD_OP_AND:
+ case SPICE_ROPD_INVERS_DEST | SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKPENNOT); //PDna
break;
- case ROPD_INVERS_BRUSH | ROPD_OP_AND:
+ case SPICE_ROPD_INVERS_BRUSH | SPICE_ROPD_OP_AND:
SetROP2(canvas->dc, R2_MASKNOTPEN); //DPna
break;
- case ROPD_OP_OR | ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH:
SetROP2(canvas->dc, R2_MERGENOTPEN); //DPno
break;
- case ROPD_OP_OR | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST:
SetROP2(canvas->dc, R2_MERGEPENNOT); //PDno
break;
default:
@@ -1576,11 +1576,11 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
}
- if (stroke->brush.type == BRUSH_TYPE_SOLID) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_SOLID) {
logbrush.lbStyle = BS_SOLID | DIB_RGB_COLORS;
logbrush.lbHatch = 0;
logbrush.lbColor = get_color_ref(canvas, stroke->brush.u.color);
- } else if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ } else if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
#if 0
struct {
BITMAPINFO inf;
@@ -1639,10 +1639,10 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
SetMiterLimit(canvas->dc, (FLOAT)fix_to_double(stroke->attr.miter_limit), &old_miter);
#endif
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
user_style = gdi_get_userstyle(canvas, stroke->attr.style_nseg,
stroke->attr.style,
- !!(stroke->attr.flags & LINE_ATTR_STARTGAP));
+ !!(stroke->attr.flags & SPICE_LINE_ATTR_STARTGAP));
hpen = ExtCreatePen(PS_GEOMETRIC | ps_join | line_cap | PS_USERSTYLE,
(uint32_t)fix_to_double(stroke->attr.width),
&logbrush, stroke->attr.style_nseg, (DWORD *)user_style);
@@ -1653,7 +1653,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
}
prev_hpen = (HPEN)SelectObject(canvas->dc, hpen);
- set_path(canvas, GET_ADDRESS(stroke->path));
+ set_path(canvas, SPICE_GET_ADDRESS(stroke->path));
StrokePath(canvas->dc);
@@ -1661,7 +1661,7 @@ void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *s
DeleteObject(hpen);
#if 0
- if (stroke->brush.type == BRUSH_TYPE_PATTERN) {
+ if (stroke->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
GlobalFree((HGLOBAL)logbrush.lbHatch);
}
#endif
diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h
index 02669c6a..0f518508 100644
--- a/common/gdi_canvas.h
+++ b/common/gdi_canvas.h
@@ -34,21 +34,21 @@ typedef struct {
uint8_t *pixels;
} GdiImage;
-void gdi_canvas_draw_fill(GdiCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void gdi_canvas_draw_copy(GdiCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void gdi_canvas_draw_opaque(GdiCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void gdi_canvas_copy_bits(GdiCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void gdi_canvas_draw_text(GdiCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
-void gdi_canvas_draw_stroke(GdiCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void gdi_canvas_draw_rop3(GdiCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void gdi_canvas_draw_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void gdi_canvas_draw_blackness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void gdi_canvas_draw_whiteness(GdiCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void gdi_canvas_draw_invers(GdiCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void gdi_canvas_draw_transparent(GdiCanvas *canvas, Rect *bbox, Clip *clip,
- Transparent* transparent);
-void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd* alpha_blend);
-void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const Rect *dest, const uint8_t *src_data,
+void gdi_canvas_draw_fill(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void gdi_canvas_draw_copy(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void gdi_canvas_draw_opaque(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void gdi_canvas_copy_bits(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void gdi_canvas_draw_text(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
+void gdi_canvas_draw_stroke(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void gdi_canvas_draw_rop3(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void gdi_canvas_draw_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void gdi_canvas_draw_blackness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void gdi_canvas_draw_whiteness(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void gdi_canvas_draw_invers(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void gdi_canvas_draw_transparent(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip,
+ SpiceTransparent* transparent);
+void gdi_canvas_draw_alpha_blend(GdiCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd* alpha_blend);
+void gdi_canvas_put_image(GdiCanvas *canvas, HDC dc, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
void gdi_canvas_clear(GdiCanvas *canvas);
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index 73c3c517..eaf1e91e 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -116,25 +116,25 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
access_test(&canvas->base, data_size, sizeof(uint32_t));
uint32_t more = *data_size;
- PathSeg* seg = (PathSeg*)(data_size + 1);
+ SpicePathSeg* seg = (SpicePathSeg*)(data_size + 1);
do {
- access_test(&canvas->base, seg, sizeof(PathSeg));
+ access_test(&canvas->base, seg, sizeof(SpicePathSeg));
uint32_t flags = seg->flags;
- PointFix* point = (PointFix*)seg->data;
- PointFix* end_point = point + seg->count;
+ SpicePointFix* point = (SpicePointFix*)seg->data;
+ SpicePointFix* end_point = point + seg->count;
access_test(&canvas->base, point, (unsigned long)end_point - (unsigned long)point);
ASSERT(point < end_point);
more -= ((unsigned long)end_point - (unsigned long)seg);
- seg = (PathSeg*)end_point;
+ seg = (SpicePathSeg*)end_point;
- if (flags & PATH_BEGIN) {
+ if (flags & SPICE_PATH_BEGIN) {
glc_path_move_to(path, fix_to_double(point->x), fix_to_double(point->y));
point++;
}
- if (flags & PATH_BEZIER) {
+ if (flags & SPICE_PATH_BEZIER) {
ASSERT((point - end_point) % 3 == 0);
for (; point + 2 < end_point; point += 3) {
glc_path_curve_to(path,
@@ -147,8 +147,8 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
glc_path_line_to(path, fix_to_double(point->x), fix_to_double(point->y));
}
}
- if (flags & PATH_END) {
- if (flags & PATH_CLOSE) {
+ if (flags & SPICE_PATH_END) {
+ if (flags & SPICE_PATH_CLOSE) {
glc_path_close(path);
}
}
@@ -164,19 +164,19 @@ static GLCPath get_path(GLCanvas *canvas, void *addr)
(dest)->height = (src)->bottom - (src)->top; \
}
-static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
+static void set_clip(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip)
{
GLCRect rect;
glc_clip_reset(canvas->glc);
switch (clip->type) {
- case CLIP_TYPE_NONE:
+ case SPICE_CLIP_TYPE_NONE:
break;
- case CLIP_TYPE_RECTS: {
- uint32_t *n = (uint32_t *)GET_ADDRESS(clip->data);
+ case SPICE_CLIP_TYPE_RECTS: {
+ uint32_t *n = (uint32_t *)SPICE_GET_ADDRESS(clip->data);
access_test(&canvas->base, n, sizeof(uint32_t));
- Rect *now = (Rect *)(n + 1);
- Rect *end = now + *n;
+ SpiceRect *now = (SpiceRect *)(n + 1);
+ SpiceRect *end = now + *n;
access_test(&canvas->base, now, (unsigned long)end - (unsigned long)now);
if (*n == 0) {
@@ -195,8 +195,8 @@ static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
}
break;
}
- case CLIP_TYPE_PATH: {
- GLCPath path = get_path(canvas, GET_ADDRESS(clip->data));
+ case SPICE_CLIP_TYPE_PATH: {
+ GLCPath path = get_path(canvas, SPICE_GET_ADDRESS(clip->data));
glc_clip_path(canvas->glc, path, GLC_CLIP_OP_SET);
glc_path_destroy(path);
break;
@@ -206,7 +206,7 @@ static void set_clip(GLCanvas *canvas, Rect *bbox, Clip *clip)
}
}
-static void set_mask(GLCanvas *canvas, QMask *mask, int x, int y)
+static void set_mask(GLCanvas *canvas, SpiceQMask *mask, int x, int y)
{
cairo_surface_t *surface;
@@ -246,10 +246,10 @@ static inline void surface_to_image(GLCanvas *canvas, cairo_surface_t *surface,
}
}
-static void set_brush(GLCanvas *canvas, Brush *brush)
+static void set_brush(GLCanvas *canvas, SpiceBrush *brush)
{
switch (brush->type) {
- case BRUSH_TYPE_SOLID: {
+ case SPICE_BRUSH_TYPE_SOLID: {
uint32_t color = brush->u.color;
double r, g, b;
@@ -261,7 +261,7 @@ static void set_brush(GLCanvas *canvas, Brush *brush)
glc_set_rgb(canvas->glc, r, g, b);
break;
}
- case BRUSH_TYPE_PATTERN: {
+ case SPICE_BRUSH_TYPE_PATTERN: {
GLCImage image;
GLCPattern pattern;
cairo_surface_t *surface;
@@ -275,7 +275,7 @@ static void set_brush(GLCanvas *canvas, Brush *brush)
glc_set_pattern(canvas->glc, pattern);
glc_pattern_destroy(pattern);
}
- case BRUSH_TYPE_NONE:
+ case SPICE_BRUSH_TYPE_NONE:
return;
default:
CANVAS_ERROR("invalid brush type");
@@ -287,52 +287,52 @@ static void set_op(GLCanvas *canvas, UINT16 rop_decriptor)
GLCOp op;
switch (rop_decriptor) {
- case ROPD_OP_PUT:
+ case SPICE_ROPD_OP_PUT:
op = GLC_OP_COPY;
break;
- case ROPD_OP_XOR:
+ case SPICE_ROPD_OP_XOR:
op = GLC_OP_XOR;
break;
- case ROPD_OP_BLACKNESS:
+ case SPICE_ROPD_OP_BLACKNESS:
op = GLC_OP_CLEAR;
break;
- case ROPD_OP_WHITENESS:
+ case SPICE_ROPD_OP_WHITENESS:
op = GLC_OP_SET;
break;
- case ROPD_OP_PUT | ROPD_INVERS_BRUSH:
- case ROPD_OP_PUT | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_PUT | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_COPY_INVERTED;
break;
- case ROPD_OP_INVERS:
+ case SPICE_ROPD_OP_INVERS:
op = GLC_OP_INVERT;
break;
- case ROPD_OP_AND:
+ case SPICE_ROPD_OP_AND:
op = GLC_OP_AND;
break;
- case ROPD_OP_AND | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_RES:
op = GLC_OP_NAND;
break;
- case ROPD_OP_OR:
+ case SPICE_ROPD_OP_OR:
op = GLC_OP_OR;
break;
- case ROPD_OP_OR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_RES:
op = GLC_OP_NOR;
break;
- case ROPD_OP_XOR | ROPD_INVERS_RES:
+ case SPICE_ROPD_OP_XOR | SPICE_ROPD_INVERS_RES:
op = GLC_OP_EQUIV;
break;
- case ROPD_OP_AND | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_DEST:
op = GLC_OP_AND_REVERSE;
break;
- case ROPD_OP_AND | ROPD_INVERS_BRUSH:
- case ROPD_OP_AND | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_AND | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_AND_INVERTED;
break;
- case ROPD_OP_OR | ROPD_INVERS_DEST:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_DEST:
op = GLC_OP_OR_REVERSE;
break;
- case ROPD_OP_OR | ROPD_INVERS_BRUSH:
- case ROPD_OP_OR | ROPD_INVERS_SRC:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_BRUSH:
+ case SPICE_ROPD_OP_OR | SPICE_ROPD_INVERS_SRC:
op = GLC_OP_OR_INVERTED;
break;
default:
@@ -342,7 +342,7 @@ static void set_op(GLCanvas *canvas, UINT16 rop_decriptor)
glc_set_op(canvas->glc, op);
}
-void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
+void gl_canvas_draw_fill(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill)
{
GLCRect rect;
set_clip(canvas, bbox, clip);
@@ -355,7 +355,7 @@ void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill)
glc_flush(canvas->glc);
}
-void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
+void gl_canvas_draw_copy(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -377,7 +377,7 @@ void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy)
glc_flush(canvas->glc);
}
-void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque)
+void gl_canvas_draw_opaque(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -388,7 +388,7 @@ void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
set_clip(canvas, bbox, clip);
set_mask(canvas, &opaque->mask, bbox->left, bbox->top);
- glc_set_op(canvas->glc, (opaque->rop_decriptor & ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED :
+ glc_set_op(canvas->glc, (opaque->rop_decriptor & SPICE_ROPD_INVERS_SRC) ? GLC_OP_COPY_INVERTED :
GLC_OP_COPY);
surface = canvas_get_image(&canvas->base, opaque->src_bitmap);
surface_to_image(canvas, surface, &image, 0);
@@ -398,14 +398,14 @@ void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opa
cairo_surface_destroy(surface);
set_brush(canvas, &opaque->brush);
- set_op(canvas, opaque->rop_decriptor & ~ROPD_INVERS_SRC);
+ set_op(canvas, opaque->rop_decriptor & ~SPICE_ROPD_INVERS_SRC);
SET_GLC_RECT(&fill_rect, bbox);
glc_fill_rect(canvas->glc, &fill_rect);
glc_flush(canvas->glc);
}
-void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd *alpha_blend)
+void gl_canvas_draw_alpha_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd *alpha_blend)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -426,7 +426,7 @@ void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaB
glc_flush(canvas->glc);
}
-void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend)
+void gl_canvas_draw_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend)
{
cairo_surface_t *surface;
GLCRecti src;
@@ -447,7 +447,7 @@ void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend
glc_flush(canvas->glc);
}
-void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transparent *transparent)
+void gl_canvas_draw_transparent(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent)
{
cairo_surface_t *surface;
cairo_surface_t *trans_surf;
@@ -474,7 +474,7 @@ void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transp
glc_flush(canvas->glc);
}
-static inline void fill_common(GLCanvas *canvas, Rect *bbox, Clip *clip, QMask * mask, GLCOp op)
+static inline void fill_common(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceQMask * mask, GLCOp op)
{
GLCRect rect;
@@ -485,27 +485,27 @@ static inline void fill_common(GLCanvas *canvas, Rect *bbox, Clip *clip, QMask *
glc_fill_rect(canvas->glc, &rect);
}
-void gl_canvas_draw_whiteness(GLCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness)
+void gl_canvas_draw_whiteness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness)
{
fill_common(canvas, bbox, clip, &whiteness->mask, GLC_OP_SET);
}
-void gl_canvas_draw_blackness(GLCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness)
+void gl_canvas_draw_blackness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness)
{
fill_common(canvas, bbox, clip, &blackness->mask, GLC_OP_CLEAR);
}
-void gl_canvas_draw_invers(GLCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers)
+void gl_canvas_draw_invers(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers)
{
fill_common(canvas, bbox, clip, &invers->mask, GLC_OP_INVERT);
}
-void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
+void gl_canvas_draw_rop3(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3)
{
cairo_surface_t *d;
cairo_surface_t *s;
GLCImage image;
- Point src_pos;
+ SpicePoint src_pos;
uint8_t *data_opp;
int src_stride;
@@ -561,9 +561,9 @@ void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
CANVAS_ERROR("bad src bitmap size");
}
- if (rop3->brush.type == BRUSH_TYPE_PATTERN) {
+ if (rop3->brush.type == SPICE_BRUSH_TYPE_PATTERN) {
cairo_surface_t *p = canvas_get_image(&canvas->base, rop3->brush.u.pattern.pat);
- Point pat_pos;
+ SpicePoint pat_pos;
pat_pos.x = (bbox->left - rop3->brush.u.pattern.pos.x) % cairo_image_surface_get_width(p);
@@ -601,7 +601,7 @@ void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3)
cairo_surface_destroy(d);
}
-void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke)
+void gl_canvas_draw_stroke(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke)
{
GLCPath path;
@@ -610,20 +610,20 @@ void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *str
set_op(canvas, stroke->fore_mode);
set_brush(canvas, &stroke->brush);
- if (stroke->attr.flags & LINE_ATTR_STYLED) {
- WARN("LINE_ATTR_STYLED");
+ if (stroke->attr.flags & SPICE_LINE_ATTR_STYLED) {
+ WARN("SPICE_LINE_ATTR_STYLED");
}
glc_set_line_width(canvas->glc, fix_to_double(stroke->attr.width));
- path = get_path(canvas, GET_ADDRESS(stroke->path));
+ path = get_path(canvas, SPICE_GET_ADDRESS(stroke->path));
glc_stroke_path(canvas->glc, path);
glc_path_destroy(path);
}
-void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
+void gl_canvas_draw_text(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text)
{
GLCRect rect;
- String *str;
+ SpiceString *str;
set_clip(canvas, bbox, clip);
glc_clear_mask(canvas->glc, GLC_MASK_A);
@@ -635,11 +635,11 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
glc_fill_rect(canvas->glc, &rect);
}
- str = (String *)GET_ADDRESS(text->str);
+ str = (SpiceString *)SPICE_GET_ADDRESS(text->str);
set_brush(canvas, &text->fore_brush);
set_op(canvas, text->fore_mode);
- if (str->flags & STRING_RASTER_A1) {
- Point pos;
+ if (str->flags & SPICE_STRING_FLAGS_RASTER_A1) {
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 1, &pos);
_glc_fill_mask(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -647,8 +647,8 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_image_surface_get_stride(mask),
cairo_image_surface_get_data(mask));
cairo_surface_destroy(mask);
- } else if (str->flags & STRING_RASTER_A4) {
- Point pos;
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A4) {
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 4, &pos);
glc_fill_alpha(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -657,10 +657,10 @@ void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text)
cairo_image_surface_get_data(mask));
cairo_surface_destroy(mask);
- } else if (str->flags & STRING_RASTER_A8) {
+ } else if (str->flags & SPICE_STRING_FLAGS_RASTER_A8) {
WARN("untested path A8 glyphs, doing nothing");
if (0) {
- Point pos;
+ SpicePoint pos;
cairo_surface_t *mask = canvas_get_str_mask(&canvas->base, str, 8, &pos);
glc_fill_alpha(canvas->glc, pos.x, pos.y,
cairo_image_surface_get_width(mask),
@@ -684,7 +684,7 @@ void gl_canvas_clear(GLCanvas *canvas)
glc_flush(canvas->glc);
}
-void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos)
+void gl_canvas_copy_pixels(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos)
{
set_clip(canvas, bbox, clip);
glc_clear_mask(canvas->glc, GLC_MASK_A);
@@ -693,7 +693,7 @@ void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_
bbox->right - bbox->left, bbox->bottom - bbox->top);
}
-void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area)
+void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area)
{
GLCImage image;
@@ -706,7 +706,7 @@ void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, con
glc_read_pixels(canvas->glc, area->left, area->top, &image);
}
-void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects)
+void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const SpiceRect *rects)
{
GLCRect *glc_rects = (GLCRect *)malloc(num_rect * sizeof(GLCRect));
GLCRect *now = glc_rects;
@@ -720,7 +720,7 @@ void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects)
free(glc_rects);
}
-void gl_canvas_put_image(GLCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void gl_canvas_put_image(GLCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip)
{
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index 2e3dd7c2..177c99d0 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -22,29 +22,29 @@
typedef struct GLCanvas GLCanvas;
-void gl_canvas_draw_fill(GLCanvas *canvas, Rect *bbox, Clip *clip, Fill *fill);
-void gl_canvas_draw_copy(GLCanvas *canvas, Rect *bbox, Clip *clip, Copy *copy);
-void gl_canvas_draw_opaque(GLCanvas *canvas, Rect *bbox, Clip *clip, Opaque *opaque);
-void gl_canvas_draw_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, Blend *blend);
-void gl_canvas_draw_alpha_blend(GLCanvas *canvas, Rect *bbox, Clip *clip, AlphaBlnd *alpha_blend);
-void gl_canvas_draw_transparent(GLCanvas *canvas, Rect *bbox, Clip *clip, Transparent *transparent);
-void gl_canvas_draw_whiteness(GLCanvas *canvas, Rect *bbox, Clip *clip, Whiteness *whiteness);
-void gl_canvas_draw_blackness(GLCanvas *canvas, Rect *bbox, Clip *clip, Blackness *blackness);
-void gl_canvas_draw_invers(GLCanvas *canvas, Rect *bbox, Clip *clip, Invers *invers);
-void gl_canvas_draw_rop3(GLCanvas *canvas, Rect *bbox, Clip *clip, Rop3 *rop3);
-void gl_canvas_draw_stroke(GLCanvas *canvas, Rect *bbox, Clip *clip, Stroke *stroke);
-void gl_canvas_draw_text(GLCanvas *canvas, Rect *bbox, Clip *clip, Text *text);
+void gl_canvas_draw_fill(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceFill *fill);
+void gl_canvas_draw_copy(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceCopy *copy);
+void gl_canvas_draw_opaque(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceOpaque *opaque);
+void gl_canvas_draw_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlend *blend);
+void gl_canvas_draw_alpha_blend(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceAlphaBlnd *alpha_blend);
+void gl_canvas_draw_transparent(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceTransparent *transparent);
+void gl_canvas_draw_whiteness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceWhiteness *whiteness);
+void gl_canvas_draw_blackness(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceBlackness *blackness);
+void gl_canvas_draw_invers(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceInvers *invers);
+void gl_canvas_draw_rop3(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceRop3 *rop3);
+void gl_canvas_draw_stroke(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceStroke *stroke);
+void gl_canvas_draw_text(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text);
-void gl_canvas_copy_pixels(GLCanvas *canvas, Rect *bbox, Clip *clip, Point *src_pos);
-void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const Rect *area);
+void gl_canvas_copy_pixels(GLCanvas *canvas, SpiceRect *bbox, SpiceClip *clip, SpicePoint *src_pos);
+void gl_canvas_read_pixels(GLCanvas *canvas, uint8_t *dest, int dest_stride, const SpiceRect *area);
-void gl_canvas_put_image(GLCanvas *canvas, const Rect *dest, const uint8_t *src_data,
+void gl_canvas_put_image(GLCanvas *canvas, const SpiceRect *dest, const uint8_t *src_data,
uint32_t src_width, uint32_t src_height, int src_stride,
const QRegion *clip);
void gl_canvas_clear(GLCanvas *canvas);
-void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const Rect *rects);
+void gl_canvas_set_top_mask(GLCanvas *canvas, int num_rect, const SpiceRect *rects);
void gl_canvas_clear_top_mask(GLCanvas *canvas);
#ifdef CAIRO_CANVAS_ACCESS_TEST
diff --git a/common/lz.c b/common/lz.c
index eac44af6..e0e112ec 100644
--- a/common/lz.c
+++ b/common/lz.c
@@ -77,7 +77,7 @@ typedef struct Encoder {
LzUsrContext *usr;
LzImageType type;
- const Palette *palette; // for decoding images with palettes to rgb
+ const SpicePalette *palette; // for decoding images with palettes to rgb
int stride; // stride is in bytes. For rgb must be equal to
// width*bytes_per_pix.
// For palettes stride can be bigger than width/pixels_per_byte by 1 only if
@@ -577,7 +577,7 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
*/
void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
LzImageType *out_type, int *out_width, int *out_height,
- int *out_n_pixels, int *out_top_down, const Palette *palette)
+ int *out_n_pixels, int *out_top_down, const SpicePalette *palette)
{
Encoder *encoder = (Encoder *)lz;
uint8_t *io_ptr_end = io_ptr + num_io_bytes;
diff --git a/common/lz.h b/common/lz.h
index 074f633b..3fe1b4c8 100644
--- a/common/lz.h
+++ b/common/lz.h
@@ -52,7 +52,7 @@ int lz_encode(LzContext *lz, LzImageType type, int width, int height, int top_do
*/
void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes,
LzImageType *out_type, int *out_width, int *out_height,
- int *out_n_pixels, int *out_top_down, const Palette *palette);
+ int *out_n_pixels, int *out_top_down, const SpicePalette *palette);
/*
to_type = the image output type.
diff --git a/common/rect.h b/common/rect.h
index 569b530a..d109cc97 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -23,7 +23,7 @@
#define MIN(x, y) (((x) <= (y)) ? (x) : (y))
#define MAX(x, y) (((x) >= (y)) ? (x) : (y))
-static inline void rect_sect(Rect* r, const Rect* bounds)
+static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
{
r->left = MAX(r->left, bounds->left);
r->right = MIN(r->right, bounds->right);
@@ -34,7 +34,7 @@ static inline void rect_sect(Rect* r, const Rect* bounds)
r->bottom = MAX(r->top, r->bottom);
}
-static inline void rect_offset(Rect* r, int dx, int dy)
+static inline void rect_offset(SpiceRect* r, int dx, int dy)
{
r->left += dx;
r->right += dx;
@@ -42,24 +42,24 @@ static inline void rect_offset(Rect* r, int dx, int dy)
r->bottom += dy;
}
-static inline int rect_is_empty(const Rect* r)
+static inline int rect_is_empty(const SpiceRect* r)
{
return r->top == r->bottom || r->left == r->right;
}
-static inline int rect_intersects(const Rect* r1, const Rect* r2)
+static inline int rect_intersects(const SpiceRect* r1, const SpiceRect* r2)
{
return r1->left < r2->right && r1->right > r2->left &&
r1->top < r2->bottom && r1->bottom > r2->top;
}
-static inline int rect_is_equal(const Rect *r1, const Rect *r2)
+static inline int rect_is_equal(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->top == r2->top && r1->left == r2->left &&
r1->bottom == r2->bottom && r1->right == r2->right;
}
-static inline void rect_union(Rect *dest, const Rect *r)
+static inline void rect_union(SpiceRect *dest, const SpiceRect *r)
{
dest->top = MIN(dest->top, r->top);
dest->left = MIN(dest->left, r->left);
@@ -67,7 +67,7 @@ static inline void rect_union(Rect *dest, const Rect *r)
dest->right = MAX(dest->right, r->right);
}
-static inline int rect_is_same_size(const Rect *r1, const Rect *r2)
+static inline int rect_is_same_size(const SpiceRect *r1, const SpiceRect *r2)
{
return r1->right - r1->left == r2->right - r2->left &&
r1->bottom - r1->top == r2->bottom - r2->top;
@@ -75,37 +75,37 @@ static inline int rect_is_same_size(const Rect *r1, const Rect *r2)
#ifdef __cplusplus
-static inline void rect_sect(Rect& r, const Rect& bounds)
+static inline void rect_sect(SpiceRect& r, const SpiceRect& bounds)
{
rect_sect(&r, &bounds);
}
-static inline void rect_offset(Rect& r, int dx, int dy)
+static inline void rect_offset(SpiceRect& r, int dx, int dy)
{
rect_offset(&r, dx, dy);
}
-static inline int rect_is_empty(const Rect& r)
+static inline int rect_is_empty(const SpiceRect& r)
{
return rect_is_empty(&r);
}
-static inline int rect_intersects(const Rect& r1, const Rect& r2)
+static inline int rect_intersects(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_intersects(&r1, &r2);
}
-static inline int rect_is_equal(const Rect& r1, const Rect& r2)
+static inline int rect_is_equal(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_is_equal(&r1, &r2);
}
-static inline void rect_union(Rect& dest, const Rect& r)
+static inline void rect_union(SpiceRect& dest, const SpiceRect& r)
{
rect_union(&dest, &r);
}
-static inline int rect_is_same_size(const Rect& r1, const Rect& r2)
+static inline int rect_is_same_size(const SpiceRect& r1, const SpiceRect& r2)
{
return rect_is_same_size(&r1, &r2);
}
diff --git a/common/region.c b/common/region.c
index d1d7f4a0..f0bb614f 100644
--- a/common/region.c
+++ b/common/region.c
@@ -42,7 +42,7 @@
#define REGION_IS_VALID(region) TRUE
#endif
-static int rect_is_valid(const Rect *r)
+static int rect_is_valid(const SpiceRect *r)
{
if (r->top > r->bottom || r->left > r->right) {
printf("%s: invalid rect\n", __FUNCTION__);
@@ -52,7 +52,7 @@ static int rect_is_valid(const Rect *r)
}
#ifdef REGION_TEST
-static void rect_set(Rect *r, int32_t top, int32_t left, int32_t bottom, int32_t right)
+static void rect_set(SpiceRect *r, int32_t top, int32_t left, int32_t bottom, int32_t right)
{
r->top = top;
r->left = left;
@@ -97,10 +97,10 @@ void region_clone(QRegion *dest, const QRegion *src)
dest->rects = dest->buf;
dest->rects_size = RECTS_BUF_SIZE;
} else {
- dest->rects = (Rect *)malloc(sizeof(Rect) * dest->num_rects);
+ dest->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * dest->num_rects);
dest->rects_size = dest->num_rects;
}
- memcpy(dest->rects, src->rects, dest->num_rects * sizeof(Rect));
+ memcpy(dest->rects, src->rects, dest->num_rects * sizeof(SpiceRect));
ASSERT(REGION_IS_VALID(src));
ASSERT(REGION_IS_VALID(dest));
}
@@ -109,7 +109,7 @@ int region_is_valid(const QRegion *rgn)
{
if (rgn->num_rects) {
uint32_t i;
- Rect bbox;
+ SpiceRect bbox;
if (!rect_is_valid(&rgn->bbox)) {
return FALSE;
@@ -119,14 +119,14 @@ int region_is_valid(const QRegion *rgn)
return FALSE;
}
for (i = 1; i < rgn->num_rects; i++) {
- Rect *r;
+ SpiceRect *r;
r = &rgn->rects[i];
if (!rect_is_valid(r) || rect_is_empty(r)) {
return FALSE;
}
- Rect *priv = r - 1;
+ SpiceRect *priv = r - 1;
if (r->top < priv->top) {
return FALSE;
} else if (r->top == priv->top) {
@@ -249,11 +249,11 @@ int region_is_equal(const QRegion *rgn1, const QRegion *rgn2)
#endif
typedef struct RgnOpCtx {
- Rect *now;
- Rect *end;
- Rect *scan_line;
- Rect r;
- Rect split;
+ SpiceRect *now;
+ SpiceRect *end;
+ SpiceRect *scan_line;
+ SpiceRect r;
+ SpiceRect split;
#ifdef REGION_USE_IMPROVED
int abort;
#endif
@@ -266,8 +266,8 @@ static inline int op_ctx_is_valid(RgnOpCtx *ctx)
static void op_context_next(RgnOpCtx *ctx)
{
- Rect *now;
- Rect *next;
+ SpiceRect *now;
+ SpiceRect *next;
ASSERT(op_ctx_is_valid(ctx));
now = ctx->now;
@@ -298,7 +298,7 @@ static void op_context_next(RgnOpCtx *ctx)
ctx->now = next;
}
-static void op_context_init(RgnOpCtx *ctx, uint32_t num_rects, Rect *rects)
+static void op_context_init(RgnOpCtx *ctx, uint32_t num_rects, SpiceRect *rects)
{
ctx->scan_line = ctx->now = rects;
ctx->end = ctx->now + num_rects;
@@ -334,17 +334,17 @@ static inline void op_ctx_split(RgnOpCtx *ctx, int32_t h_line)
ctx->r.bottom = h_line;
}
-static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, Rect **rects)
+static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, SpiceRect **rects)
{
ASSERT(REGION_IS_VALID(rgn));
if ((*num_rects = rgn->num_rects)) {
if (rgn->rects == rgn->buf) {
- *rects = (Rect *)malloc(sizeof(Rect) * rgn->num_rects);
- memcpy(*rects, rgn->rects, sizeof(Rect) * rgn->num_rects);
+ *rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->num_rects);
+ memcpy(*rects, rgn->rects, sizeof(SpiceRect) * rgn->num_rects);
} else {
*rects = rgn->rects;
#ifdef ALLOC_ON_STEAL
- rgn->rects = (Rect *)malloc(sizeof(Rect) * rgn->num_rects);
+ rgn->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->num_rects);
rgn->rects_size = rgn->num_rects;
rgn->num_rects = 0;
return;
@@ -359,14 +359,14 @@ static void region_steal_rects(QRegion *rgn, uint32_t *num_rects, Rect **rects)
typedef struct JoinContext {
QRegion *rgn;
- Rect *line0;
- Rect *line1;
- Rect *end;
+ SpiceRect *line0;
+ SpiceRect *line1;
+ SpiceRect *end;
} JoinContext;
-static inline Rect *__get_line(QRegion *rgn, Rect *pos)
+static inline SpiceRect *__get_line(QRegion *rgn, SpiceRect *pos)
{
- Rect *end = rgn->rects + rgn->num_rects;
+ SpiceRect *end = rgn->rects + rgn->num_rects;
if (pos < end) {
int32_t line_top = pos->top;
@@ -394,8 +394,8 @@ static inline int region_join_next(JoinContext *context)
static inline void region_join_join(JoinContext *context)
{
- Rect *pos_0 = context->line0;
- Rect *pos_1 = context->line1;
+ SpiceRect *pos_0 = context->line0;
+ SpiceRect *pos_1 = context->line1;
int32_t bottom;
QRegion *rgn;
@@ -441,7 +441,7 @@ static inline void region_join(QRegion *rgn)
ASSERT(REGION_IS_VALID(rgn));
}
-static void region_push_rect(QRegion *rgn, Rect *r)
+static void region_push_rect(QRegion *rgn, SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -450,7 +450,7 @@ static void region_push_rect(QRegion *rgn, Rect *r)
rgn->rects[0] = rgn->bbox = *r;
return;
} else {
- Rect *priv = &rgn->rects[rgn->num_rects - 1];
+ SpiceRect *priv = &rgn->rects[rgn->num_rects - 1];
if (priv->top == r->top && priv->right == r->left) {
ASSERT(priv->bottom == r->bottom);
@@ -459,10 +459,10 @@ static void region_push_rect(QRegion *rgn, Rect *r)
return;
}
if (rgn->rects_size == rgn->num_rects) {
- Rect *old = rgn->rects;
+ SpiceRect *old = rgn->rects;
rgn->rects_size = rgn->rects_size * 2;
- rgn->rects = (Rect *)malloc(sizeof(Rect) * rgn->rects_size);
- memcpy(rgn->rects, old, sizeof(Rect) * rgn->num_rects);
+ rgn->rects = (SpiceRect *)malloc(sizeof(SpiceRect) * rgn->rects_size);
+ memcpy(rgn->rects, old, sizeof(SpiceRect) * rgn->num_rects);
if (old != rgn->buf) {
free(old);
}
@@ -474,10 +474,10 @@ static void region_push_rect(QRegion *rgn, Rect *r)
#ifdef REGION_USE_IMPROVED
-static Rect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
+static SpiceRect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
{
- Rect *start = ctx->now;
- Rect *end = ctx->end;
+ SpiceRect *start = ctx->now;
+ SpiceRect *end = ctx->end;
while (start != end) {
int pos = (end - start) / 2;
@@ -492,7 +492,7 @@ static Rect *op_context_find_area_below(RgnOpCtx *ctx, int32_t val)
static int op_context_skip_v(RgnOpCtx *ctx, int32_t top)
{
- Rect *end = op_context_find_area_below(ctx, top);
+ SpiceRect *end = op_context_find_area_below(ctx, top);
if (end != ctx->now) {
ctx->now = ctx->scan_line = end;
if (ctx->now == ctx->end) {
@@ -505,13 +505,13 @@ static int op_context_skip_v(RgnOpCtx *ctx, int32_t top)
return FALSE;
}
-typedef void (*op_callback_t)(RgnOpCtx *context, Rect *, Rect *);
+typedef void (*op_callback_t)(RgnOpCtx *context, SpiceRect *, SpiceRect *);
static void op_context_skip(RgnOpCtx *self, RgnOpCtx *other, op_callback_t on_self,
op_callback_t on_other)
{
- Rect *save1 = self->now;
- Rect *save2 = other->now;
+ SpiceRect *save1 = self->now;
+ SpiceRect *save2 = other->now;
int more;
do {
op_context_skip_v(self, other->r.top);
@@ -606,7 +606,7 @@ typedef struct SelfOpCtx {
QRegion *rgn;
} SelfOpCtx;
-static void add_rects(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void add_rects(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
SelfOpCtx *self_ctx = (SelfOpCtx *)ctx;
for (; now < end; now++) {
@@ -620,7 +620,7 @@ static void region_op(QRegion *rgn, const QRegion *other_rgn, op_callback_t on_s
SelfOpCtx self;
RgnOpCtx other;
uint32_t num_rects;
- Rect *rects;
+ SpiceRect *rects;
region_steal_rects(rgn, &num_rects, &rects);
op_context_init(&self.ctx, num_rects, rects);
@@ -665,7 +665,7 @@ typedef struct TestOpCtx {
} TestOpCtx;
-static void region_test_on_self(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_self(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_LEFT_EXCLUSIVE;
@@ -675,7 +675,7 @@ static void region_test_on_self(RgnOpCtx *ctx, Rect *now, Rect *end)
}
}
-static void region_test_on_other(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_other(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_RIGHT_EXCLUSIVE;
@@ -685,7 +685,7 @@ static void region_test_on_other(RgnOpCtx *ctx, Rect *now, Rect *end)
}
}
-static void region_test_on_both(RgnOpCtx *ctx, Rect *now, Rect *end)
+static void region_test_on_both(RgnOpCtx *ctx, SpiceRect *now, SpiceRect *end)
{
TestOpCtx *test_ctx = (TestOpCtx *)ctx;
test_ctx->result |= REGION_TEST_SHARED;
@@ -715,7 +715,7 @@ int region_test(const QRegion *rgn, const QRegion *other_rgn, int query)
#define RIGION_OP_ADD_OTHER (1 << 1)
#define RIGION_OP_ADD_COMMON (1 << 2)
-static inline void region_on_self(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_self(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_SELF) {
@@ -723,7 +723,7 @@ static inline void region_on_self(QRegion *rgn, Rect *r, uint32_t op)
}
}
-static inline void region_on_other(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_other(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_OTHER) {
@@ -731,7 +731,7 @@ static inline void region_on_other(QRegion *rgn, Rect *r, uint32_t op)
}
}
-static inline void region_on_both(QRegion *rgn, Rect *r, uint32_t op)
+static inline void region_on_both(QRegion *rgn, SpiceRect *r, uint32_t op)
{
ASSERT(REGION_IS_VALID(rgn));
if (op & RIGION_OP_ADD_COMMON) {
@@ -744,7 +744,7 @@ static void region_op(QRegion *rgn, const QRegion *other_rgn, uint32_t op)
RgnOpCtx self;
RgnOpCtx other;
uint32_t num_rects;
- Rect *rects;
+ SpiceRect *rects;
ASSERT(REGION_IS_VALID(rgn));
ASSERT(REGION_IS_VALID(other_rgn));
@@ -809,8 +809,8 @@ void region_exclude(QRegion *rgn, const QRegion *other_rgn)
void region_offset(QRegion *rgn, int32_t dx, int32_t dy)
{
- Rect *now;
- Rect *end;
+ SpiceRect *now;
+ SpiceRect *end;
ASSERT(REGION_IS_VALID(rgn));
if (region_is_empty(rgn)) {
return;
@@ -823,7 +823,7 @@ void region_offset(QRegion *rgn, int32_t dx, int32_t dy)
}
}
-void region_add(QRegion *rgn, const Rect *r)
+void region_add(QRegion *rgn, const SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -842,7 +842,7 @@ void region_add(QRegion *rgn, const Rect *r)
}
}
-void region_remove(QRegion *rgn, const Rect *r)
+void region_remove(QRegion *rgn, const SpiceRect *r)
{
ASSERT(REGION_IS_VALID(rgn));
ASSERT(rect_is_valid(r));
@@ -934,7 +934,7 @@ int region_contains_point(const QRegion *rgn, int32_t x, int32_t y)
if (region_is_empty(rgn)) {
return FALSE;
}
- Rect point;
+ SpiceRect point;
point.left = x;
point.right = point.left + 1;
point.top = y;
@@ -944,8 +944,8 @@ int region_contains_point(const QRegion *rgn, int32_t x, int32_t y)
return FALSE;
}
- Rect* now = rgn->rects;
- Rect* end = now + rgn->num_rects;
+ SpiceRect* now = rgn->rects;
+ SpiceRect* end = now + rgn->num_rects;
for (; now < end; now++) {
if (rect_intersects(now, &point)) {
@@ -990,8 +990,8 @@ int main(void)
QRegion *r1 = &_r1;
QRegion *r2 = &_r2;
QRegion *r3 = &_r3;
- Rect _r;
- Rect *r = &_r;
+ SpiceRect _r;
+ SpiceRect *r = &_r;
int expected[5];
region_init(r1);
diff --git a/common/region.h b/common/region.h
index 29a58223..73f8ed9d 100644
--- a/common/region.h
+++ b/common/region.h
@@ -27,10 +27,10 @@
typedef struct QRegion {
uint32_t num_rects;
- Rect bbox;
- Rect *rects;
+ SpiceRect bbox;
+ SpiceRect *rects;
uint32_t rects_size;
- Rect buf[RECTS_BUF_SIZE];
+ SpiceRect buf[RECTS_BUF_SIZE];
} QRegion;
#ifdef REGION_USE_IMPROVED
@@ -64,8 +64,8 @@ void region_and(QRegion *rgn, const QRegion *other_rgn);
void region_xor(QRegion *rgn, const QRegion *other_rgn);
void region_exclude(QRegion *rgn, const QRegion *other_rgn);
-void region_add(QRegion *rgn, const Rect *r);
-void region_remove(QRegion *rgn, const Rect *r);
+void region_add(QRegion *rgn, const SpiceRect *r);
+void region_remove(QRegion *rgn, const SpiceRect *r);
void region_offset(QRegion *rgn, int32_t dx, int32_t dy);
diff --git a/common/rop3.c b/common/rop3.c
index 08f9cad3..6d2efa2b 100644
--- a/common/rop3.c
+++ b/common/rop3.c
@@ -24,11 +24,11 @@
#endif
typedef void (*rop3_with_pattern_handler_t)(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, cairo_surface_t *p,
- Point *pat_pos);
+ SpicePoint *src_pos, cairo_surface_t *p,
+ SpicePoint *pat_pos);
typedef void (*rop3_with_color_handler_t)(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, uint32_t rgb);
+ SpicePoint *src_pos, uint32_t rgb);
typedef void (*rop3_test_handler_t)();
@@ -40,13 +40,13 @@ static rop3_test_handler_t rop3_test_handlers[ROP3_NUM_OPS];
static void default_rop3_with_pattern_handler(cairo_surface_t *d, cairo_surface_t *s,
- Point *src_pos, cairo_surface_t *p,
- Point *pat_pos)
+ SpicePoint *src_pos, cairo_surface_t *p,
+ SpicePoint *pat_pos)
{
WARN("not implemented 0x%x");
}
-static void default_rop3_withe_color_handler(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+static void default_rop3_withe_color_handler(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb)
{
WARN("not implemented 0x%x");
@@ -57,8 +57,8 @@ static void default_rop3_test_handler()
}
#define ROP3_HANDLERS(name, formula, index) \
-static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos, \
- cairo_surface_t *p, Point *pat_pos) \
+static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos, \
+ cairo_surface_t *p, SpicePoint *pat_pos) \
{ \
int width = cairo_image_surface_get_width(d); \
int height = cairo_image_surface_get_height(d); \
@@ -94,7 +94,7 @@ static void rop3_handle_p_##name(cairo_surface_t *d, cairo_surface_t *s, Point *
} \
} \
\
-static void rop3_handle_c_##name(cairo_surface_t *d, cairo_surface_t *s, Point *src_pos, \
+static void rop3_handle_c_##name(cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos, \
uint32_t rgb) \
{ \
int width = cairo_image_surface_get_width(d); \
@@ -599,13 +599,13 @@ void rop3_init()
}
}
-void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
- cairo_surface_t *p, Point *pat_pos)
+void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
+ cairo_surface_t *p, SpicePoint *pat_pos)
{
rop3_with_pattern_handlers[rop3](d, s, src_pos, p, pat_pos);
}
-void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb)
{
rop3_with_color_handlers[rop3](d, s, src_pos, rgb);
diff --git a/common/rop3.h b/common/rop3.h
index fcf86423..31cbcdaa 100644
--- a/common/rop3.h
+++ b/common/rop3.h
@@ -23,9 +23,9 @@
#include "draw.h"
#include "cairo.h"
-void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
- cairo_surface_t *p, Point *pat_pos);
-void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, Point *src_pos,
+void do_rop3_with_pattern(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
+ cairo_surface_t *p, SpicePoint *pat_pos);
+void do_rop3_with_color(uint8_t rop3, cairo_surface_t *d, cairo_surface_t *s, SpicePoint *src_pos,
uint32_t rgb);
void rop3_init();