From 0b0342ee7ece8ea5a811cfb05c70f03ca4e3bde3 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Mon, 8 Feb 2010 15:38:24 +0100 Subject: Turn image and palette cache into c style dynamic interface Instead of passing a bunch of function pointer and an opaque pointer we make a real type and add a vtable pointer to it. This means we can simplify all the canvas constructors, etc. --- client/canvas.cpp | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'client/canvas.cpp') diff --git a/client/canvas.cpp b/client/canvas.cpp index 04b0ce6..24ebd01 100644 --- a/client/canvas.cpp +++ b/client/canvas.cpp @@ -213,36 +213,6 @@ void Canvas::draw_stroke(SpiceMsgDisplayDrawStroke& stroke, int size) draw_stroke(&stroke.base.box, &stroke.base.clip, &stroke.data); } -void Canvas::bits_cache_put(void *opaque, uint64_t id, cairo_surface_t *surface) -{ - PixmapCache* cache = static_cast(opaque); - cache->add(id, surface); -} - -cairo_surface_t* Canvas::bits_cache_get(void *opaque, uint64_t id) -{ - PixmapCache* cache = static_cast(opaque); - return cache->get(id); -} - -void Canvas::palette_cache_put(void *opaque, SpicePalette *palette) -{ - PaletteCache* cache = static_cast(opaque); - AutoRef cached_palette(new CachedPalette(palette)); - cache->add(palette->unique, *cached_palette); -} - -SpicePalette* Canvas::palette_cache_get(void *opaque, uint64_t id) -{ - PaletteCache* cache = static_cast(opaque); - return cache->get(id)->palette(); -} - -void Canvas::palette_cache_release(SpicePalette* palette) -{ - CachedPalette::unref(palette); -} - void Canvas::glz_decode(void *opaque, uint8_t *data, SpicePalette *plt, void *usr_data) { GlzDecoder* decoder = static_cast(opaque); -- cgit v1.2.3