[Spice-devel] [spice-common 2/3] Get rid of SW_CANVAS_IMAGE_CACHE

Christophe Fergeau cfergeau at redhat.com
Mon Jan 26 04:18:25 PST 2015


Every time it's used, it's in constructs similar to:

 #ifdef SW_CANVAS_CACHE
                             , SpiceImageCache *bits_cache
                             , SpicePaletteCache *palette_cache
 #elif defined(SW_CANVAS_IMAGE_CACHE)
                             , SpiceImageCache *bits_cache
 #endif

This can be rewritten as:

                             , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
                             , SpicePaletteCache *palette_cache
 #endif

allowing to get rid of SW_CANVAS_IMAGE_CACHE.
---
 common/canvas_base.c |  4 +---
 common/gdi_canvas.c  |  8 ++------
 common/gl_canvas.c   |  8 ++------
 common/gl_canvas.h   |  4 +---
 common/sw_canvas.c   | 24 ++++++------------------
 common/sw_canvas.h   |  8 ++------
 6 files changed, 14 insertions(+), 42 deletions(-)

diff --git a/common/canvas_base.c b/common/canvas_base.c
index 417741e..0472a80 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -3543,11 +3543,9 @@ 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 SW_CANVAS_CACHE
                             , SpiceImageCache *bits_cache
+#ifdef SW_CANVAS_CACHE
                             , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                            , SpiceImageCache *bits_cache
 #endif
                             , SpiceImageSurfaces *surfaces
                             , SpiceGlzDecoder *glz_decoder
diff --git a/common/gdi_canvas.c b/common/gdi_canvas.c
index 3042031..3c434d6 100644
--- a/common/gdi_canvas.c
+++ b/common/gdi_canvas.c
@@ -1802,11 +1802,9 @@ static SpiceCanvasOps gdi_canvas_ops;
 
 SpiceCanvas *gdi_canvas_create(int width, int height,
                                HDC dc, RecurciveMutex* lock, uint32_t format
-#ifdef SW_CANVAS_CACHE
                              , SpiceImageCache *bits_cache
+#ifdef SW_CANVAS_CACHE
                              , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                             , SpiceImageCache *bits_cache
 #endif
                             , SpiceImageSurfaces *surfaces
                             , SpiceGlzDecoder *glz_decoder
@@ -1822,11 +1820,9 @@ SpiceCanvas *gdi_canvas_create(int width, int height,
     canvas = spice_new0(GdiCanvas, 1);
     canvas_base_init(&canvas->base, &gdi_canvas_ops,
                      width, height, format,
-#ifdef SW_CANVAS_CACHE
                      bits_cache,
+#ifdef SW_CANVAS_CACHE
                      palette_cache,
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                     bits_cache,
 #endif
                      surfaces,
                      glz_decoder,
diff --git a/common/gl_canvas.c b/common/gl_canvas.c
index fe152ef..9c5b98c 100644
--- a/common/gl_canvas.c
+++ b/common/gl_canvas.c
@@ -813,11 +813,9 @@ static int need_init = 1;
 static SpiceCanvasOps gl_canvas_ops;
 
 SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format
-#ifdef SW_CANVAS_CACHE
                               , SpiceImageCache *bits_cache
+#ifdef SW_CANVAS_CACHE
                               , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                              , SpiceImageCache *bits_cache
 #endif
                               , SpiceImageSurfaces *surfaces
                               , SpiceGlzDecoder *glz_decoder
@@ -839,11 +837,9 @@ 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 SW_CANVAS_CACHE
                                , bits_cache
+#ifdef SW_CANVAS_CACHE
                                , palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                               , bits_cache
 #endif
                                , surfaces
                                , glz_decoder
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index 33b9fad..42c9e5a 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -28,11 +28,9 @@
 SPICE_BEGIN_DECLS
 
 SpiceCanvas *gl_canvas_create(int width, int height, uint32_t format
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
diff --git a/common/sw_canvas.c b/common/sw_canvas.c
index f947dde..7d67ca5 100644
--- a/common/sw_canvas.c
+++ b/common/sw_canvas.c
@@ -1193,11 +1193,9 @@ static SpiceCanvasOps sw_canvas_ops;
 
 static SpiceCanvas *canvas_create_common(pixman_image_t *image,
                                          uint32_t format
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
@@ -1218,11 +1216,9 @@ static SpiceCanvas *canvas_create_common(pixman_image_t *image,
                                pixman_image_get_width (image),
                                pixman_image_get_height (image),
                                format
-#ifdef SW_CANVAS_CACHE
                                , bits_cache
+#ifdef SW_CANVAS_CACHE
                                , palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                               , bits_cache
 #endif
                                , surfaces
                                , glz_decoder
@@ -1238,11 +1234,9 @@ static SpiceCanvas *canvas_create_common(pixman_image_t *image,
 }
 
 SpiceCanvas *canvas_create(int width, int height, uint32_t format
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
@@ -1256,11 +1250,9 @@ SpiceCanvas *canvas_create(int width, int height, uint32_t format
                                      width, height, NULL, 0);
 
     return canvas_create_common(image, format
+                                , bits_cache
 #ifdef SW_CANVAS_CACHE
-                                , bits_cache
                                 , palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                                , bits_cache
 #endif
                                 , surfaces
                                 , glz_decoder
@@ -1271,11 +1263,9 @@ 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, int stride
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
@@ -1289,11 +1279,9 @@ SpiceCanvas *canvas_create_for_data(int width, int height, uint32_t format,
                                      width, height, (uint32_t *)data, stride);
 
     return canvas_create_common(image, format
+                                , bits_cache
 #ifdef SW_CANVAS_CACHE
-                                , bits_cache
                                 , palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                                , bits_cache
 #endif
                                 , surfaces
                                 , glz_decoder
diff --git a/common/sw_canvas.h b/common/sw_canvas.h
index eb6c1f8..564d416 100644
--- a/common/sw_canvas.h
+++ b/common/sw_canvas.h
@@ -30,11 +30,9 @@
 SPICE_BEGIN_DECLS
 
 SpiceCanvas *canvas_create(int width, int height, uint32_t format
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
@@ -43,11 +41,9 @@ 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, int stride
+                           , SpiceImageCache *bits_cache
 #ifdef SW_CANVAS_CACHE
-                           , SpiceImageCache *bits_cache
                            , SpicePaletteCache *palette_cache
-#elif defined(SW_CANVAS_IMAGE_CACHE)
-                           , SpiceImageCache *bits_cache
 #endif
                            , SpiceImageSurfaces *surfaces
                            , SpiceGlzDecoder *glz_decoder
-- 
2.1.0



More information about the Spice-devel mailing list