[Spice-devel,02/10] worker: move delta computation

Submitted by Frediano Ziglio on Nov. 5, 2015, 1:23 p.m.

Details

Message ID 1446729793-4876-3-git-send-email-fziglio@redhat.com
State New
Headers show
Series "Backported some patches from refactory branches (5th Nov) second" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 5, 2015, 1:23 p.m.
From: Marc-André Lureau <marcandre.lureau@gmail.com>

Move delta computation from red_add_drawable to red_current_add_with_shadow.
---
 server/red_worker.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/red_worker.c b/server/red_worker.c
index 09f1a08..cb63fc0 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -2949,15 +2949,20 @@  static inline Shadow *__new_shadow(RedWorker *worker, Drawable *item, SpicePoint
     return shadow;
 }
 
-static inline int red_current_add_with_shadow(RedWorker *worker, Ring *ring, Drawable *item,
-                                              SpicePoint *delta)
+static inline int red_current_add_with_shadow(RedWorker *worker, Ring *ring, Drawable *item)
 {
 #ifdef RED_WORKER_STAT
     stat_time_t start_time = stat_now(worker);
     ++worker->add_with_shadow_count;
 #endif
 
-    Shadow *shadow = __new_shadow(worker, item, delta);
+    RedDrawable *red_drawable = item->red_drawable;
+    SpicePoint delta = {
+        .x = red_drawable->u.copy_bits.src_pos.x - red_drawable->bbox.left,
+        .y = red_drawable->u.copy_bits.src_pos.y - red_drawable->bbox.top
+    };
+
+    Shadow *shadow = __new_shadow(worker, item, &delta);
     if (!shadow) {
         stat_add(&worker->add_stat, start_time);
         return FALSE;
@@ -3065,11 +3070,7 @@  static int red_add_drawable(RedWorker *worker, Drawable *drawable)
     Ring *ring = &worker->surfaces[surface_id].current;
 
     if (has_shadow(red_drawable)) {
-        SpicePoint delta = {
-            .x = red_drawable->u.copy_bits.src_pos.x - red_drawable->bbox.left,
-            .y = red_drawable->u.copy_bits.src_pos.y - red_drawable->bbox.top
-        };
-        ret = red_current_add_with_shadow(worker, ring, drawable, &delta);
+        ret = red_current_add_with_shadow(worker, ring, drawable);
     } else {
         red_update_streamable(worker, drawable, red_drawable);
         ret = red_current_add(worker, ring, drawable);