mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2026-01-04 13:45:09 +00:00
Make canvas Glz decoder integration nicer
We use a dynamic interface similar to e.g. SpiceImageCache instead of passing both function and opaque
This commit is contained in:
parent
acd6262480
commit
ccbd520e4a
@ -2156,7 +2156,7 @@ CairoCanvas *canvas_create(pixman_image_t *image, int bits,
|
||||
CairoCanvas *canvas_create(pixman_image_t *image, int bits
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
, void *get_virt_opaque, get_virt_fn_t get_virt,
|
||||
@ -2183,8 +2183,7 @@ CairoCanvas *canvas_create(pixman_image_t *image, int bits
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
,
|
||||
glz_decoder_opaque,
|
||||
glz_decode
|
||||
glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
,
|
||||
|
||||
@ -70,7 +70,7 @@ CairoCanvas *canvas_create(pixman_image_t *image, int bits,
|
||||
CairoCanvas *canvas_create(pixman_image_t *image, int bits
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
, void *get_virt_opaque, get_virt_fn_t get_virt,
|
||||
|
||||
@ -154,8 +154,7 @@ typedef struct LzData {
|
||||
} LzData;
|
||||
|
||||
typedef struct GlzData {
|
||||
void *decoder_opaque;
|
||||
glz_decode_fn_t decode;
|
||||
SpiceGlzDecoder *decoder;
|
||||
LzDecodeUsrData decode_data;
|
||||
} GlzData;
|
||||
|
||||
@ -623,8 +622,9 @@ static pixman_image_t *canvas_get_glz(CanvasBase *canvas, LZImage *image)
|
||||
#ifdef WIN32
|
||||
canvas->glz_data.decode_data.dc = canvas->dc;
|
||||
#endif
|
||||
canvas->glz_data.decode(canvas->glz_data.decoder_opaque, image->lz_rgb.data, NULL,
|
||||
&canvas->glz_data.decode_data);
|
||||
canvas->glz_data.decoder->ops->decode(canvas->glz_data.decoder,
|
||||
image->lz_rgb.data, NULL,
|
||||
&canvas->glz_data.decode_data);
|
||||
/* global_decode calls alloc_lz_image, which sets canvas->glz_data.surface */
|
||||
return (canvas->glz_data.decode_data.out_surface);
|
||||
}
|
||||
@ -1547,7 +1547,7 @@ static int canvas_base_init(CanvasBase *canvas, int depth,
|
||||
static int canvas_base_init(CanvasBase *canvas, int depth
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
, void *get_virt_opaque, get_virt_fn_t get_virt,
|
||||
@ -1584,8 +1584,7 @@ static int canvas_base_init(CanvasBase *canvas, int depth
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
canvas->glz_data.decoder_opaque = glz_decoder_opaque;
|
||||
canvas->glz_data.decode = glz_decode;
|
||||
canvas->glz_data.decoder = glz_decoder;
|
||||
#endif
|
||||
|
||||
if (depth == 16) {
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
|
||||
typedef struct _SpiceImageCache SpiceImageCache;
|
||||
typedef struct _SpicePaletteCache SpicePaletteCache;
|
||||
typedef struct _SpiceGlzDecoder SpiceGlzDecoder;
|
||||
|
||||
typedef struct {
|
||||
void (*put)(SpiceImageCache *cache,
|
||||
@ -52,8 +53,17 @@ struct _SpicePaletteCache {
|
||||
SpicePaletteCacheOps *ops;
|
||||
};
|
||||
|
||||
typedef void (*glz_decode_fn_t)(void *glz_decoder_opaque, uint8_t *data,
|
||||
SpicePalette *plt, void *usr_data);
|
||||
typedef struct {
|
||||
void (*decode)(SpiceGlzDecoder *decoder,
|
||||
uint8_t *data,
|
||||
SpicePalette *plt,
|
||||
void *usr_data);
|
||||
} SpiceGlzDecoderOps;
|
||||
|
||||
struct _SpiceGlzDecoder {
|
||||
SpiceGlzDecoderOps *ops;
|
||||
};
|
||||
|
||||
#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,
|
||||
|
||||
@ -1708,7 +1708,7 @@ GdiCanvas *gdi_canvas_create(HDC dc, int bits,
|
||||
GdiCanvas *gdi_canvas_create(HDC dc, int bits
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
)
|
||||
{
|
||||
@ -1731,8 +1731,7 @@ GdiCanvas *gdi_canvas_create(HDC dc, int bits
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
,
|
||||
glz_decoder_opaque,
|
||||
glz_decode
|
||||
glz_decoder
|
||||
#endif
|
||||
);
|
||||
canvas->dc = dc;
|
||||
|
||||
@ -62,8 +62,7 @@ void gdi_canvas_set_access_params(GdiCanvas *canvas, unsigned long base, unsigne
|
||||
GdiCanvas *gdi_canvas_create(HDC dc, class Mutex *lock, int bits,
|
||||
SpiceImageCache *bits_cache,
|
||||
SpicePaletteCache *palette_cache,
|
||||
void *glz_decoder_opaque,
|
||||
glz_decode_fn_t glz_decode);
|
||||
SpiceGlzDecoder *glz_decoder);
|
||||
|
||||
void gdi_canvas_destroy(GdiCanvas *canvas);
|
||||
|
||||
|
||||
@ -812,7 +812,7 @@ GLCanvas *gl_canvas_create(void *usr_data, int width, int height, int depth,
|
||||
GLCanvas *gl_canvas_create(void *usr_data, int width, int height, int depth
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
, void *get_virt_opaque, get_virt_fn_t get_virt,
|
||||
@ -845,8 +845,7 @@ GLCanvas *gl_canvas_create(void *usr_data, int width, int height, int depth
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
,
|
||||
glz_decoder_opaque,
|
||||
glz_decode
|
||||
glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
,
|
||||
|
||||
@ -65,7 +65,7 @@ GLCanvas *gl_canvas_create(void *usr_data, int width, int height, int depth,
|
||||
GLCanvas *gl_canvas_create(void *usr_data, int width, int height, int depth
|
||||
#endif
|
||||
#ifdef USE_GLZ
|
||||
, void *glz_decoder_opaque, glz_decode_fn_t glz_decode
|
||||
, SpiceGlzDecoder *glz_decoder
|
||||
#endif
|
||||
#ifndef CAIRO_CANVAS_NO_CHUNKS
|
||||
, void *get_virt_opaque, get_virt_fn_t get_virt,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user