diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-03-02 15:41:08 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-03-08 19:45:27 +0100 |
commit | c0fdcd1a10d0eae92fec9e00382b445d669c7428 (patch) | |
tree | 590429cdba9b115c90e5beaec90f1981ed513121 /client | |
parent | 04b35fe7ff6b09885a2af9ef8627b45b892e3fb0 (diff) | |
download | spice-c0fdcd1a10d0eae92fec9e00382b445d669c7428.tar.gz spice-c0fdcd1a10d0eae92fec9e00382b445d669c7428.tar.xz spice-c0fdcd1a10d0eae92fec9e00382b445d669c7428.zip |
Make canvas Glz decoder integration nicer
We use a dynamic interface similar to e.g. SpiceImageCache instead
of passing both function and opaque
Diffstat (limited to 'client')
-rw-r--r-- | client/canvas.cpp | 7 | ||||
-rw-r--r-- | client/canvas.h | 1 | ||||
-rw-r--r-- | client/glz_decoder.cpp | 14 | ||||
-rw-r--r-- | client/glz_decoder.h | 6 | ||||
-rw-r--r-- | client/red_cairo_canvas.cpp | 3 | ||||
-rw-r--r-- | client/red_gdi_canvas.cpp | 3 | ||||
-rw-r--r-- | client/red_gl_canvas.cpp | 3 |
7 files changed, 21 insertions, 16 deletions
diff --git a/client/canvas.cpp b/client/canvas.cpp index 24ebd01b..516a874c 100644 --- a/client/canvas.cpp +++ b/client/canvas.cpp @@ -212,10 +212,3 @@ void Canvas::draw_stroke(SpiceMsgDisplayDrawStroke& stroke, int size) localalize_attr(stroke.data.attr); draw_stroke(&stroke.base.box, &stroke.base.clip, &stroke.data); } - -void Canvas::glz_decode(void *opaque, uint8_t *data, SpicePalette *plt, void *usr_data) -{ - GlzDecoder* decoder = static_cast<GlzDecoder*>(opaque); - decoder->decode(data, plt, usr_data); -} - diff --git a/client/canvas.h b/client/canvas.h index 79400cc3..2f122638 100644 --- a/client/canvas.h +++ b/client/canvas.h @@ -295,7 +295,6 @@ protected: PaletteCache& palette_cache() { return _palette_cache;} GlzDecoder& glz_decoder() {return _glz_decoder;} - static void glz_decode(void *opaque, uint8_t *data, SpicePalette *plt, void *usr_data); private: void access_test(void* ptr, size_t size); diff --git a/client/glz_decoder.cpp b/client/glz_decoder.cpp index 0453aaae..30eecc14 100644 --- a/client/glz_decoder.cpp +++ b/client/glz_decoder.cpp @@ -1,3 +1,4 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* Copyright (C) 2009 Red Hat, Inc. @@ -19,12 +20,25 @@ #include "glz_decoder_config.h" #include "glz_decoder.h" +static void op_decode (SpiceGlzDecoder *decoder, + uint8_t *data, + SpicePalette *plt, + void *usr_data) +{ + GlzDecoder* _decoder = static_cast<GlzDecoder*>(decoder); + _decoder->decode(data, plt, usr_data); +} + GlzDecoder::GlzDecoder(GlzDecoderWindow &images_window, GlzDecodeHandler &usr_handler, GlzDecoderDebug &debug_calls) : _images_window (images_window) , _usr_handler (usr_handler) , _debug_calls (debug_calls) { + static SpiceGlzDecoderOps decoder_ops = { + op_decode, + }; + ops = &decoder_ops; } GlzDecoder::~GlzDecoder() diff --git a/client/glz_decoder.h b/client/glz_decoder.h index c2afa54e..2b797d8c 100644 --- a/client/glz_decoder.h +++ b/client/glz_decoder.h @@ -1,3 +1,4 @@ +/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* Copyright (C) 2009 Red Hat, Inc. @@ -21,6 +22,7 @@ #include "lz_common.h" #include "glz_decoder_config.h" #include "glz_decoder_window.h" +#include "canvas_base.h" #include <spice/draw.h> @@ -47,9 +49,9 @@ public: This class implements the lz decoding algorithm */ -class GlzDecoder { +class GlzDecoder : public SpiceGlzDecoder +{ public: - GlzDecoder(GlzDecoderWindow &images_window, GlzDecodeHandler &usr_handler, GlzDecoderDebug &debug_calls); virtual ~GlzDecoder(); diff --git a/client/red_cairo_canvas.cpp b/client/red_cairo_canvas.cpp index 87023e17..97277fb3 100644 --- a/client/red_cairo_canvas.cpp +++ b/client/red_cairo_canvas.cpp @@ -102,8 +102,7 @@ void CCanvas::set_mode(int width, int height, int depth, RedWindow *win) if (!(_canvas = canvas_create(surface, depth, &pixmap_cache().base, &palette_cache().base, - &glz_decoder(), - glz_decode))) { + &glz_decoder()))) { THROW("create canvas failed"); } pixman_image_unref (surface); diff --git a/client/red_gdi_canvas.cpp b/client/red_gdi_canvas.cpp index 671fe82f..efdf5d4d 100644 --- a/client/red_gdi_canvas.cpp +++ b/client/red_gdi_canvas.cpp @@ -92,8 +92,7 @@ void GDICanvas::set_mode(int width, int height, int depth) &_pixmap->get_mutex(), depth, &pixmap_cache().base, &palette_cache().base, - &glz_decoder(), - glz_decode))) { + &glz_decoder()))) { THROW("create canvas failed"); } } diff --git a/client/red_gl_canvas.cpp b/client/red_gl_canvas.cpp index 65984257..76dabc71 100644 --- a/client/red_gl_canvas.cpp +++ b/client/red_gl_canvas.cpp @@ -99,8 +99,7 @@ void GCanvas::set_mode(int width, int height, int depth, RedWindow *win, if (!(_canvas = gl_canvas_create(NULL, width, height, depth, &pixmap_cache().base, &palette_cache().base, - &glz_decoder(), - glz_decode))) { + &glz_decoder()))) { THROW("create canvas failed"); } } |