diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-05-03 12:08:00 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-05-03 12:38:02 +0200 |
commit | ae40f270cfbe4629c041074e2b0c28dfd3f554b8 (patch) | |
tree | 5bfcd3f0e129f3c098eb26334b71af54762356d2 /common | |
parent | 295c8ed8bc508d69c88ec83b82afc4573500ff12 (diff) |
Remove all mentions of "cairo" from the code
The command line option is renamed from "cairo" to "sw", and
similarly all filenames and types from Cairo to Sw (and similar).
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile.am | 4 | ||||
-rw-r--r-- | common/canvas_base.c | 50 | ||||
-rw-r--r-- | common/gdi_canvas.c | 10 | ||||
-rw-r--r-- | common/gl_canvas.c | 14 | ||||
-rw-r--r-- | common/gl_canvas.h | 6 | ||||
-rw-r--r-- | common/lz.h | 5 | ||||
-rw-r--r-- | common/sw_canvas.c (renamed from common/cairo_canvas.c) | 214 | ||||
-rw-r--r-- | common/sw_canvas.h (renamed from common/cairo_canvas.h) | 14 |
8 files changed, 158 insertions, 159 deletions
diff --git a/common/Makefile.am b/common/Makefile.am index f17f304..222965e 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -1,8 +1,8 @@ NULL = COMMON_SRCS = \ - cairo_canvas.h \ - cairo_canvas.c \ + sw_canvas.h \ + sw_canvas.c \ pixman_utils.h \ pixman_utils.c \ canvas_base.h \ diff --git a/common/canvas_base.c b/common/canvas_base.c index 3600a2f..9fd2ae2 100644 --- a/common/canvas_base.c +++ b/common/canvas_base.c @@ -43,7 +43,7 @@ } #endif -#ifdef CAIRO_CANVAS_ACCESS_TEST +#ifdef SW_CANVAS_ACCESS_TEST #define access_test(cancas, ptr, size) \ if ((unsigned long)(ptr) < (cancas)->base || \ (unsigned long)(ptr) + (size) > (cancas)->max) { \ @@ -163,7 +163,7 @@ typedef struct QuicData { QuicUsrContext usr; QuicContext *quic; jmp_buf jmp_env; -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS SPICE_ADDRESS next; SpiceVirtMapping *virt_mapping; #endif @@ -175,7 +175,7 @@ typedef struct CanvasBase { uint32_t color_shift; uint32_t color_mask; QuicData quic_data; -#ifdef CAIRO_CANVAS_ACCESS_TEST +#ifdef SW_CANVAS_ACCESS_TEST unsigned long base; unsigned long max; #endif @@ -185,10 +185,10 @@ typedef struct CanvasBase { int height; pixman_region32_t canvas_region; -#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE) +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) SpiceImageCache *bits_cache; #endif -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE SpicePaletteCache *palette_cache; #endif #ifdef WIN32 @@ -205,7 +205,7 @@ typedef struct CanvasBase { } CanvasBase; -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS #ifdef __GNUC__ #define ATTR_PACKED __attribute__ ((__packed__)) @@ -453,7 +453,7 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceQUICImage *image int stride; int width; int height; -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS DataChunk **tmp; DataChunk *chunk; #endif @@ -463,7 +463,7 @@ static pixman_image_t *canvas_get_quic(CanvasBase *canvas, SpiceQUICImage *image CANVAS_ERROR("quic error, %s", quic_data->message_buf); } -#ifdef CAIRO_CANVAS_NO_CHUNKS +#ifdef SW_CANVAS_NO_CHUNKS if (quic_decode_begin(quic_data->quic, (uint32_t *)image->quic.data, image->quic.data_size >> 2, &type, &width, &height) == QUIC_ERROR) { CANVAS_ERROR("quic decode begin failed"); @@ -586,7 +586,7 @@ static pixman_image_t *canvas_bitmap_to_surface(CanvasBase *canvas, SpiceBitmap* } -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE static inline SpicePalette *canvas_get_palette(CanvasBase *canvas, SPICE_ADDRESS base_palette, uint8_t flags) { @@ -942,7 +942,7 @@ static SpiceCanvas *canvas_get_surface_mask_internal(CanvasBase *canvas, SPICE_A return NULL; } -#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE) +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) //#define DEBUG_LZ @@ -987,7 +987,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SPICE_ADDRE surface = canvas_get_quic(canvas, image, 0, want_original); break; } -#ifdef CAIRO_CANVAS_NO_CHUNKS +#ifdef SW_CANVAS_NO_CHUNKS case SPICE_IMAGE_TYPE_LZ_PLT: { access_test(canvas, descriptor, sizeof(SpiceLZPLTImage)); LZImage *image = (LZImage *)descriptor; @@ -1002,7 +1002,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SPICE_ADDRE } #endif -#if defined(CAIRO_CANVAS_CACHE) +#if defined(SW_CANVAS_CACHE) case SPICE_IMAGE_TYPE_GLZ_RGB: { access_test(canvas, descriptor, sizeof(SpiceLZRGBImage)); LZImage *image = (LZImage *)descriptor; @@ -1340,7 +1340,7 @@ static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int access_test(canvas, descriptor, sizeof(SpiceImageDescriptor)); need_invers = mask->flags & SPICE_MASK_FLAGS_INVERS; -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE cache_me = descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_ME; #else cache_me = 0; @@ -1354,7 +1354,7 @@ static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int surface = canvas_get_bitmap_mask(canvas, &bitmap->bitmap, is_invers); break; } -#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE) +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) case SPICE_IMAGE_TYPE_FROM_CACHE: surface = canvas->bits_cache->ops->get(canvas->bits_cache, descriptor->id); is_invers = 0; @@ -1364,7 +1364,7 @@ static pixman_image_t *canvas_get_mask(CanvasBase *canvas, SpiceQMask *mask, int CANVAS_ERROR("invalid image type"); } -#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE) +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) if (cache_me) { canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface); } @@ -1658,7 +1658,7 @@ static void quic_usr_free(QuicUsrContext *usr, void *ptr) free(ptr); } -#ifdef CAIRO_CANVAS_NO_CHUNKS +#ifdef SW_CANVAS_NO_CHUNKS static int quic_usr_more_space(QuicUsrContext *usr, uint32_t **io_ptr, int rows_completed) { @@ -1736,7 +1736,7 @@ static int quic_usr_more_lines(QuicUsrContext *usr, uint8_t **lines) return 0; } -#ifdef CAIRO_CANVAS_ACCESS_TEST +#ifdef SW_CANVAS_ACCESS_TEST static void __canvas_set_access_params(CanvasBase *canvas, unsigned long base, unsigned long max) { canvas->base = base; @@ -1747,7 +1747,7 @@ static void __canvas_set_access_params(CanvasBase *canvas, unsigned long base, u static void canvas_base_destroy(CanvasBase *canvas) { quic_destroy(canvas->quic_data.quic); -#ifdef CAIRO_CANVAS_NO_CHUNKS +#ifdef SW_CANVAS_NO_CHUNKS lz_destroy(canvas->lz_data.lz); #endif #ifdef GDI_CANVAS @@ -3226,15 +3226,15 @@ inline static void canvas_base_init_ops(SpiceCanvasOps *ops) static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops, int width, int height, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ) @@ -3247,13 +3247,13 @@ static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops, canvas->quic_data.usr.free = quic_usr_free; canvas->quic_data.usr.more_space = quic_usr_more_space; canvas->quic_data.usr.more_lines = quic_usr_more_lines; -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS canvas->quic_data.virt_mapping = virt_mapping; #endif if (!(canvas->quic_data.quic = quic_create(&canvas->quic_data.usr))) { return 0; } -#ifdef CAIRO_CANVAS_NO_CHUNKS +#ifdef SW_CANVAS_NO_CHUNKS canvas->lz_data.usr.error = lz_usr_error; canvas->lz_data.usr.warn = lz_usr_warn; canvas->lz_data.usr.info = lz_usr_warn; @@ -3286,10 +3286,10 @@ static int canvas_base_init(CanvasBase *canvas, SpiceCanvasOps *ops, canvas->width, canvas->height); -#if defined(CAIRO_CANVAS_CACHE) || defined(CAIRO_CANVAS_IMAGE_CACHE) +#if defined(SW_CANVAS_CACHE) || defined(SW_CANVAS_IMAGE_CACHE) canvas->bits_cache = bits_cache; #endif -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE canvas->palette_cache = palette_cache; #endif diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c index 56b7643..af1de95 100644 --- a/common/gdi_canvas.c +++ b/common/gdi_canvas.c @@ -1837,7 +1837,7 @@ static void gdi_canvas_clear(SpiceCanvas *spice_canvas) static void gdi_canvas_set_access_params(SpiceCanvas *spice_canvas, unsigned long base, unsigned long max) { -#ifdef CAIRO_CANVAS_ACCESS_TEST +#ifdef SW_CANVAS_ACCESS_TEST GdiCanvas *canvas = (GdiCanvas *)spice_canvas; __canvas_set_access_params(&canvas->base, base, max); #endif @@ -1858,10 +1858,10 @@ static SpiceCanvasOps gdi_canvas_ops; SpiceCanvas *gdi_canvas_create(int width, int height, HDC dc, RecurciveMutex* lock, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces @@ -1877,10 +1877,10 @@ SpiceCanvas *gdi_canvas_create(int width, int height, canvas = spice_new0(GdiCanvas, 1); init_ok = canvas_base_init(&canvas->base, &gdi_canvas_ops, width, height, format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE ,bits_cache ,palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , bits_cache #endif , surfaces diff --git a/common/gl_canvas.c b/common/gl_canvas.c index 63d6977..82c846e 100644 --- a/common/gl_canvas.c +++ b/common/gl_canvas.c @@ -812,7 +812,7 @@ static void gl_canvas_group_end(SpiceCanvas *spice_canvas) static void gl_canvas_set_access_params(SpiceCanvas *spice_canvas, unsigned long base, unsigned long max) { -#ifdef CAIRO_CANVAS_ACCESS_TEST +#ifdef SW_CANVAS_ACCESS_TEST GLCanvas *canvas = (GLCanvas *)spice_canvas; __canvas_set_access_params(&canvas->base, base, max); #endif @@ -822,15 +822,15 @@ static int need_init = 1; static SpiceCanvasOps gl_canvas_ops; SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ) @@ -849,15 +849,15 @@ SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format canvas->private_data = NULL; init_ok = canvas_base_init(&canvas->base, &gl_canvas_ops, width, height, format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , bits_cache , palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , bits_cache #endif , surfaces , glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , virt_mapping #endif ); diff --git a/common/gl_canvas.h b/common/gl_canvas.h index 615ca89..6dd25e9 100644 --- a/common/gl_canvas.h +++ b/common/gl_canvas.h @@ -22,15 +22,15 @@ #include "region.h" SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ); diff --git a/common/lz.h b/common/lz.h index 3ad6caa..1c80df7 100644 --- a/common/lz.h +++ b/common/lz.h @@ -62,9 +62,8 @@ void lz_decode_begin(LzContext *lz, uint8_t *io_ptr, unsigned int num_io_bytes, Improtant: if the image is plt1/4 and to_type is rgb32, the image will decompressed including the last bits in each line. This means buffer should be larger than width*height if neede and you shoud use stride to fix it. - Note: If the image is down to top, set the stride in the cairo surface to negative. - use cairo_image_surface_create_for_data to create the surface and - cairo_surface_set_user_data in order to free the data in the destroy callback. + Note: If the image is down to top, set the stride in the sw surface to negative. + use alloc_lz_image_surface create the surface. */ void lz_decode(LzContext *lz, LzImageType to_type, uint8_t *buf); diff --git a/common/cairo_canvas.c b/common/sw_canvas.c index 48f14a9..a541c7d 100644 --- a/common/cairo_canvas.c +++ b/common/sw_canvas.c @@ -17,7 +17,7 @@ */ #include <math.h> -#include "cairo_canvas.h" +#include "sw_canvas.h" #define CANVAS_USE_PIXMAN #define CANVAS_SINGLE_INSTANCE #include "canvas_base.c" @@ -25,16 +25,16 @@ #include "region.h" #include "pixman_utils.h" -typedef struct CairoCanvas CairoCanvas; +typedef struct SwCanvas SwCanvas; -struct CairoCanvas { +struct SwCanvas { CanvasBase base; uint32_t *private_data; int private_data_size; pixman_image_t *image; }; -static pixman_image_t *canvas_get_pixman_brush(CairoCanvas *canvas, +static pixman_image_t *canvas_get_pixman_brush(SwCanvas *canvas, SpiceBrush *brush) { switch (brush->type) { @@ -52,11 +52,11 @@ static pixman_image_t *canvas_get_pixman_brush(CairoCanvas *canvas, return pixman_image_create_solid_fill(&c); } case SPICE_BRUSH_TYPE_PATTERN: { - CairoCanvas *surface_canvas; + SwCanvas *surface_canvas; pixman_image_t* surface; pixman_transform_t t; - surface_canvas = (CairoCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); + surface_canvas = (SwCanvas *)canvas_get_surface(&canvas->base, brush->u.pattern.pat); if (surface_canvas) { surface = surface_canvas->image; surface = pixman_image_ref(surface); @@ -79,18 +79,18 @@ static pixman_image_t *canvas_get_pixman_brush(CairoCanvas *canvas, static pixman_image_t *get_image(SpiceCanvas *canvas) { - CairoCanvas *cairo_canvas = (CairoCanvas *)canvas; + SwCanvas *sw_canvas = (SwCanvas *)canvas; - pixman_image_ref(cairo_canvas->image); + pixman_image_ref(sw_canvas->image); - return cairo_canvas->image; + return sw_canvas->image; } static void copy_region(SpiceCanvas *spice_canvas, pixman_region32_t *dest_region, int dx, int dy) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_box32_t *dest_rects; int n_rects; int i, j, end_line; @@ -166,7 +166,7 @@ static void fill_solid_spans(SpiceCanvas *spice_canvas, int n_spans, uint32_t color) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; int i; for (i = 0; i < n_spans; i++) { @@ -183,7 +183,7 @@ static void fill_solid_rects(SpiceCanvas *spice_canvas, int n_rects, uint32_t color) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; int i; for (i = 0; i < n_rects; i++) { @@ -201,7 +201,7 @@ static void fill_solid_rects_rop(SpiceCanvas *spice_canvas, uint32_t color, SpiceROP rop) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; int i; for (i = 0; i < n_rects; i++) { @@ -219,7 +219,7 @@ static void __fill_tiled_rects(SpiceCanvas *spice_canvas, pixman_image_t *tile, int offset_x, int offset_y) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; int i; for (i = 0; i < n_rects; i++) { @@ -246,8 +246,8 @@ static void fill_tiled_rects_from_surface(SpiceCanvas *spice_canvas, SpiceCanvas *surface_canvas, int offset_x, int offset_y) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __fill_tiled_rects(spice_canvas, rects, n_rects, cairo_surface_canvas->image, offset_x, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __fill_tiled_rects(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, offset_y); } @@ -258,7 +258,7 @@ static void __fill_tiled_rects_rop(SpiceCanvas *spice_canvas, int offset_x, int offset_y, SpiceROP rop) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; int i; for (i = 0; i < n_rects; i++) { @@ -287,8 +287,8 @@ static void fill_tiled_rects_rop_from_surface(SpiceCanvas *spice_canvas, int offset_x, int offset_y, SpiceROP rop) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __fill_tiled_rects_rop(spice_canvas, rects, n_rects, cairo_surface_canvas->image, offset_x, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __fill_tiled_rects_rop(spice_canvas, rects, n_rects, sw_surface_canvas->image, offset_x, offset_y, rop); } @@ -348,7 +348,7 @@ static void __blit_image(SpiceCanvas *spice_canvas, pixman_image_t *src_image, int offset_x, int offset_y) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_box32_t *rects; int n_rects, i; @@ -386,8 +386,8 @@ static void blit_image_from_surface(SpiceCanvas *spice_canvas, SpiceCanvas *surface_canvas, int offset_x, int offset_y) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __blit_image(spice_canvas, region, cairo_surface_canvas->image, offset_x, offset_y); + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __blit_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y); } static void __blit_image_rop(SpiceCanvas *spice_canvas, @@ -396,7 +396,7 @@ static void __blit_image_rop(SpiceCanvas *spice_canvas, int offset_x, int offset_y, SpiceROP rop) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_box32_t *rects; int n_rects, i; @@ -436,8 +436,8 @@ static void blit_image_rop_from_surface(SpiceCanvas *spice_canvas, int offset_x, int offset_y, SpiceROP rop) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __blit_image_rop(spice_canvas, region, cairo_surface_canvas->image, offset_x, offset_y, rop); + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __blit_image_rop(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, rop); } @@ -451,7 +451,7 @@ static void __scale_image(SpiceCanvas *spice_canvas, int dest_width, int dest_height, int scale_mode) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_transform_t transform; double sx, sy; @@ -508,8 +508,8 @@ static void scale_image_from_surface(SpiceCanvas *spice_canvas, int dest_width, int dest_height, int scale_mode) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __scale_image(spice_canvas, region, cairo_surface_canvas->image, src_x, src_y, src_width, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width,dest_height,scale_mode); } @@ -522,7 +522,7 @@ static void __scale_image_rop(SpiceCanvas *spice_canvas, int dest_width, int dest_height, int scale_mode, SpiceROP rop) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_transform_t transform; pixman_image_t *scaled; pixman_box32_t *rects; @@ -605,12 +605,12 @@ static void scale_image_rop_from_surface(SpiceCanvas *spice_canvas, int dest_width, int dest_height, int scale_mode, SpiceROP rop) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __scale_image_rop(spice_canvas, region, cairo_surface_canvas->image, src_x, src_y, src_width, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __scale_image_rop(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, rop); } -static pixman_image_t *canvas_get_as_surface(CairoCanvas *canvas, +static pixman_image_t *canvas_get_as_surface(SwCanvas *canvas, int with_alpha) { pixman_image_t *target; @@ -638,7 +638,7 @@ static void __blend_image(SpiceCanvas *spice_canvas, int width, int height, int overall_alpha) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_image_t *mask, *dest; dest = canvas_get_as_surface(canvas, dest_has_alpha); @@ -699,10 +699,10 @@ static void blend_image_from_surface(SpiceCanvas *spice_canvas, int width, int height, int overall_alpha) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; pixman_image_t *src; - src = canvas_get_as_surface(cairo_surface_canvas, src_has_alpha); + src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); __blend_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, dest_x, dest_y, @@ -721,7 +721,7 @@ static void __blend_scale_image(SpiceCanvas *spice_canvas, int scale_mode, int overall_alpha) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_transform_t transform; pixman_image_t *mask, *dest; double sx, sy; @@ -805,10 +805,10 @@ static void blend_scale_image_from_surface(SpiceCanvas *spice_canvas, int scale_mode, int overall_alpha) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; pixman_image_t *src; - src = canvas_get_as_surface(cairo_surface_canvas, src_has_alpha); + src = canvas_get_as_surface(sw_surface_canvas, src_has_alpha); __blend_scale_image(spice_canvas, region, dest_has_alpha, src, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, scale_mode, overall_alpha); @@ -821,7 +821,7 @@ static void __colorkey_image(SpiceCanvas *spice_canvas, int offset_x, int offset_y, uint32_t transparent_color) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_box32_t *rects; int n_rects, i; @@ -862,8 +862,8 @@ static void colorkey_image_from_surface(SpiceCanvas *spice_canvas, int offset_x, int offset_y, uint32_t transparent_color) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __colorkey_image(spice_canvas, region, cairo_surface_canvas->image, offset_x, offset_y, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __colorkey_image(spice_canvas, region, sw_surface_canvas->image, offset_x, offset_y, transparent_color); } @@ -876,7 +876,7 @@ static void __colorkey_scale_image(SpiceCanvas *spice_canvas, int dest_width, int dest_height, uint32_t transparent_color) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_transform_t transform; pixman_image_t *scaled; pixman_box32_t *rects; @@ -956,8 +956,8 @@ static void colorkey_scale_image_from_surface(SpiceCanvas *spice_canvas, int dest_width, int dest_height, uint32_t transparent_color) { - CairoCanvas *cairo_surface_canvas = (CairoCanvas *)surface_canvas; - __colorkey_scale_image(spice_canvas, region, cairo_surface_canvas->image, src_x, src_y, + SwCanvas *sw_surface_canvas = (SwCanvas *)surface_canvas; + __colorkey_scale_image(spice_canvas, region, sw_surface_canvas->image, src_x, src_y, src_width, src_height, dest_x, dest_y, dest_width, dest_height, transparent_color); } @@ -970,7 +970,7 @@ static void canvas_put_image(SpiceCanvas *spice_canvas, uint32_t src_width, uint32_t src_height, int src_stride, const QRegion *clip) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_image_t *src; int dest_width; int dest_height; @@ -1024,7 +1024,7 @@ static void canvas_put_image(SpiceCanvas *spice_canvas, static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, SpiceClip *clip, SpiceText *text) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_region32_t dest_region; pixman_image_t *str_mask, *brush; SpiceString *str; @@ -1112,7 +1112,7 @@ static void canvas_draw_text(SpiceCanvas *spice_canvas, SpiceRect *bbox, static void canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, int dest_stride, const SpiceRect *area) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; pixman_image_t* surface; uint8_t *src; int src_stride; @@ -1136,7 +1136,7 @@ static void canvas_read_bits(SpiceCanvas *spice_canvas, uint8_t *dest, static void canvas_clear(SpiceCanvas *spice_canvas) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; spice_pixman_fill_rect(canvas->image, 0, 0, pixman_image_get_width(canvas->image), @@ -1147,15 +1147,15 @@ static void canvas_clear(SpiceCanvas *spice_canvas) static void canvas_set_access_params(SpiceCanvas *spice_canvas, unsigned long base, unsigned long max) { -#ifdef CAIRO_CANVAS_ACCESS_TEST - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; +#ifdef SW_CANVAS_ACCESS_TEST + SwCanvas *canvas = (SwCanvas *)spice_canvas; __canvas_set_access_params(&canvas->base, base, max); #endif } static void canvas_destroy(SpiceCanvas *spice_canvas) { - CairoCanvas *canvas = (CairoCanvas *)spice_canvas; + SwCanvas *canvas = (SwCanvas *)spice_canvas; if (!canvas) { return; } @@ -1168,24 +1168,24 @@ static void canvas_destroy(SpiceCanvas *spice_canvas) } static int need_init = 1; -static SpiceCanvasOps cairo_canvas_ops; +static SpiceCanvasOps sw_canvas_ops; static SpiceCanvas *canvas_create_common(pixman_image_t *image, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ) { - CairoCanvas *canvas; + SwCanvas *canvas; int init_ok; if (need_init) { @@ -1194,20 +1194,20 @@ static SpiceCanvas *canvas_create_common(pixman_image_t *image, spice_pixman_image_set_format(image, spice_surface_format_to_pixman (format)); - canvas = spice_new0(CairoCanvas, 1); - init_ok = canvas_base_init(&canvas->base, &cairo_canvas_ops, + canvas = spice_new0(SwCanvas, 1); + init_ok = canvas_base_init(&canvas->base, &sw_canvas_ops, pixman_image_get_width (image), pixman_image_get_height (image), format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , bits_cache , palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , bits_cache #endif , surfaces , glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , virt_mapping #endif ); @@ -1220,15 +1220,15 @@ static SpiceCanvas *canvas_create_common(pixman_image_t *image, } SpiceCanvas *canvas_create(int width, int height, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ) @@ -1239,15 +1239,15 @@ SpiceCanvas *canvas_create(int width, int height, uint32_t format width, height, NULL, 0); return canvas_create_common(image, format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , bits_cache , palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , bits_cache #endif , surfaces , glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , virt_mapping #endif ); @@ -1255,15 +1255,15 @@ SpiceCanvas *canvas_create(int width, int height, uint32_t format SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint8_t *data, size_t stride -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ) @@ -1274,59 +1274,59 @@ SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, width, height, (uint32_t *)data, stride); return canvas_create_common(image, format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , bits_cache , palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , bits_cache #endif , surfaces , glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , virt_mapping #endif ); } -void cairo_canvas_init() //unsafe global function +void sw_canvas_init() //unsafe global function { if (!need_init) { return; } need_init = 0; - canvas_base_init_ops(&cairo_canvas_ops); - cairo_canvas_ops.draw_text = canvas_draw_text; - cairo_canvas_ops.put_image = canvas_put_image; - cairo_canvas_ops.clear = canvas_clear; - cairo_canvas_ops.read_bits = canvas_read_bits; - cairo_canvas_ops.set_access_params = canvas_set_access_params; - cairo_canvas_ops.destroy = canvas_destroy; - - cairo_canvas_ops.fill_solid_spans = fill_solid_spans; - cairo_canvas_ops.fill_solid_rects = fill_solid_rects; - cairo_canvas_ops.fill_solid_rects_rop = fill_solid_rects_rop; - cairo_canvas_ops.fill_tiled_rects = fill_tiled_rects; - cairo_canvas_ops.fill_tiled_rects_from_surface = fill_tiled_rects_from_surface; - cairo_canvas_ops.fill_tiled_rects_rop = fill_tiled_rects_rop; - cairo_canvas_ops.fill_tiled_rects_rop_from_surface = fill_tiled_rects_rop_from_surface; - cairo_canvas_ops.blit_image = blit_image; - cairo_canvas_ops.blit_image_from_surface = blit_image_from_surface; - cairo_canvas_ops.blit_image_rop = blit_image_rop; - cairo_canvas_ops.blit_image_rop_from_surface = blit_image_rop_from_surface; - cairo_canvas_ops.scale_image = scale_image; - cairo_canvas_ops.scale_image_from_surface = scale_image_from_surface; - cairo_canvas_ops.scale_image_rop = scale_image_rop; - cairo_canvas_ops.scale_image_rop_from_surface = scale_image_rop_from_surface; - cairo_canvas_ops.blend_image = blend_image; - cairo_canvas_ops.blend_image_from_surface = blend_image_from_surface; - cairo_canvas_ops.blend_scale_image = blend_scale_image; - cairo_canvas_ops.blend_scale_image_from_surface = blend_scale_image_from_surface; - cairo_canvas_ops.colorkey_image = colorkey_image; - cairo_canvas_ops.colorkey_image_from_surface = colorkey_image_from_surface; - cairo_canvas_ops.colorkey_scale_image = colorkey_scale_image; - cairo_canvas_ops.colorkey_scale_image_from_surface = colorkey_scale_image_from_surface; - cairo_canvas_ops.copy_region = copy_region; - cairo_canvas_ops.get_image = get_image; + canvas_base_init_ops(&sw_canvas_ops); + sw_canvas_ops.draw_text = canvas_draw_text; + sw_canvas_ops.put_image = canvas_put_image; + sw_canvas_ops.clear = canvas_clear; + sw_canvas_ops.read_bits = canvas_read_bits; + sw_canvas_ops.set_access_params = canvas_set_access_params; + sw_canvas_ops.destroy = canvas_destroy; + + sw_canvas_ops.fill_solid_spans = fill_solid_spans; + sw_canvas_ops.fill_solid_rects = fill_solid_rects; + sw_canvas_ops.fill_solid_rects_rop = fill_solid_rects_rop; + sw_canvas_ops.fill_tiled_rects = fill_tiled_rects; + sw_canvas_ops.fill_tiled_rects_from_surface = fill_tiled_rects_from_surface; + sw_canvas_ops.fill_tiled_rects_rop = fill_tiled_rects_rop; + sw_canvas_ops.fill_tiled_rects_rop_from_surface = fill_tiled_rects_rop_from_surface; + sw_canvas_ops.blit_image = blit_image; + sw_canvas_ops.blit_image_from_surface = blit_image_from_surface; + sw_canvas_ops.blit_image_rop = blit_image_rop; + sw_canvas_ops.blit_image_rop_from_surface = blit_image_rop_from_surface; + sw_canvas_ops.scale_image = scale_image; + sw_canvas_ops.scale_image_from_surface = scale_image_from_surface; + sw_canvas_ops.scale_image_rop = scale_image_rop; + sw_canvas_ops.scale_image_rop_from_surface = scale_image_rop_from_surface; + sw_canvas_ops.blend_image = blend_image; + sw_canvas_ops.blend_image_from_surface = blend_image_from_surface; + sw_canvas_ops.blend_scale_image = blend_scale_image; + sw_canvas_ops.blend_scale_image_from_surface = blend_scale_image_from_surface; + sw_canvas_ops.colorkey_image = colorkey_image; + sw_canvas_ops.colorkey_image_from_surface = colorkey_image_from_surface; + sw_canvas_ops.colorkey_scale_image = colorkey_scale_image; + sw_canvas_ops.colorkey_scale_image_from_surface = colorkey_scale_image_from_surface; + sw_canvas_ops.copy_region = copy_region; + sw_canvas_ops.get_image = get_image; rop3_init(); } diff --git a/common/cairo_canvas.h b/common/sw_canvas.h index c97380e..c3aef24 100644 --- a/common/cairo_canvas.h +++ b/common/sw_canvas.h @@ -27,34 +27,34 @@ #include "region.h" SpiceCanvas *canvas_create(int width, int height, uint32_t format -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ); SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format, uint8_t *data, size_t stride -#ifdef CAIRO_CANVAS_CACHE +#ifdef SW_CANVAS_CACHE , SpiceImageCache *bits_cache , SpicePaletteCache *palette_cache -#elif defined(CAIRO_CANVAS_IMAGE_CACHE) +#elif defined(SW_CANVAS_IMAGE_CACHE) , SpiceImageCache *bits_cache #endif , SpiceImageSurfaces *surfaces , SpiceGlzDecoder *glz_decoder -#ifndef CAIRO_CANVAS_NO_CHUNKS +#ifndef SW_CANVAS_NO_CHUNKS , SpiceVirtMapping *virt_mapping #endif ); -void cairo_canvas_init(); +void sw_canvas_init(); #endif |