[Spice-commits] common/canvas_base.c common/draw.h

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Jan 20 07:56:14 PST 2016


 common/canvas_base.c |    8 ++------
 common/draw.h        |    6 ++++++
 2 files changed, 8 insertions(+), 6 deletions(-)

New commits:
commit 93cd2f683650f1bce46d22fd368f5d81614a117f
Author: Pavel Grunt <pgrunt at redhat.com>
Date:   Wed Jan 20 15:10:40 2016 +0100

    draw: Add spice_image_descriptor_is_lossy
    
    It will be used in the server code
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/canvas_base.c b/common/canvas_base.c
index d918441..fa4d373 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -47,10 +47,6 @@
 
 #define ROUND(_x) ((int)floor((_x) + 0.5))
 
-#define IS_IMAGE_LOSSY(descriptor)                         \
-    (((descriptor)->type == SPICE_IMAGE_TYPE_JPEG) ||      \
-    ((descriptor)->type == SPICE_IMAGE_TYPE_JPEG_ALPHA))
-
  static inline int fix_to_int(SPICE_FIXED28_4 fixed)
 {
     int val, rem;
@@ -1219,7 +1215,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
 #endif
         descriptor->type != SPICE_IMAGE_TYPE_FROM_CACHE ) {
 #ifdef SW_CANVAS_CACHE
-        if (!IS_IMAGE_LOSSY(descriptor)) {
+        if (!spice_image_descriptor_is_lossy(descriptor)) {
             canvas->bits_cache->ops->put(canvas->bits_cache, descriptor->id, surface);
         } else {
             canvas->bits_cache->ops->put_lossy(canvas->bits_cache, descriptor->id, surface);
@@ -1232,7 +1228,7 @@ static pixman_image_t *canvas_get_image_internal(CanvasBase *canvas, SpiceImage
 #endif
 #ifdef SW_CANVAS_CACHE
     } else if (descriptor->flags & SPICE_IMAGE_FLAGS_CACHE_REPLACE_ME) {
-        if (IS_IMAGE_LOSSY(descriptor)) {
+        if (spice_image_descriptor_is_lossy(descriptor)) {
             spice_warning("invalid cache replace request: the image is lossy");
             return NULL;
         }
diff --git a/common/draw.h b/common/draw.h
index 1155dc5..5ce56e7 100644
--- a/common/draw.h
+++ b/common/draw.h
@@ -294,6 +294,12 @@ typedef struct SpiceCursorHeader {
     uint16_t hot_spot_y;
 } SpiceCursorHeader;
 
+static inline int spice_image_descriptor_is_lossy(const SpiceImageDescriptor *descriptor)
+{
+    return descriptor->type == SPICE_IMAGE_TYPE_JPEG ||
+           descriptor->type == SPICE_IMAGE_TYPE_JPEG_ALPHA;
+}
+
 SPICE_END_DECLS
 
 #endif /* _H_SPICE_DRAW */


More information about the Spice-commits mailing list