[PATCH spice-server 03/15] Move stream agent manipulation to dcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rather than having the DisplayChannel responsible for retrieving the
stream agent from the channel client and then maniuplating it, move that
into the channel client for improved encapsulation.
---
 server/dcc.c             | 12 ++++++++++++
 server/dcc.h             |  3 +++
 server/display-channel.c | 11 +++--------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/server/dcc.c b/server/dcc.c
index c2fdd8c21..a5f19f163 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -1383,6 +1383,18 @@ bool dcc_handle_migrate_data(DisplayChannelClient *dcc, uint32_t size, void *mes
     return TRUE;
 }
 
+void dcc_update_stream_visible_region(DisplayChannelClient *dcc, int stream_id,
+                                      QRegion *region)
+{
+    StreamAgent *agent = dcc_get_stream_agent(dcc, stream_id);
+
+    if (region_intersects(&agent->vis_region, region)) {
+        region_exclude(&agent->vis_region, region);
+        region_exclude(&agent->clip, region);
+        dcc_stream_agent_clip(dcc, agent);
+    }
+}
+
 StreamAgent* dcc_get_stream_agent(DisplayChannelClient *dcc, int stream_id)
 {
     return &dcc->priv->stream_agents[stream_id];
diff --git a/server/dcc.h b/server/dcc.h
index 4de494571..cc2526090 100644
--- a/server/dcc.h
+++ b/server/dcc.h
@@ -189,6 +189,9 @@ int                        dcc_compress_image                        (DisplayCha
                                                                       int can_lossy,
                                                                       compress_send_data_t* o_comp_data);
 
+void                       dcc_update_stream_visible_region          (DisplayChannelClient *dcc,
+                                                                      int stream_id,
+                                                                      QRegion *region);
 StreamAgent *              dcc_get_stream_agent                      (DisplayChannelClient *dcc, int stream_id);
 ImageEncoders *dcc_get_encoders(DisplayChannelClient *dcc);
 spice_wan_compression_t    dcc_get_jpeg_state                        (DisplayChannelClient *dcc);
diff --git a/server/display-channel.c b/server/display-channel.c
index e91265de5..7fa55f6ab 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -341,7 +341,6 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
 
     while (item) {
         Stream *stream = SPICE_CONTAINEROF(item, Stream, link);
-        StreamAgent *agent;
 
         item = ring_next(ring, item);
 
@@ -350,13 +349,9 @@ static void streams_update_visible_region(DisplayChannel *display, Drawable *dra
         }
 
         FOREACH_DCC(display, dcc) {
-            agent = dcc_get_stream_agent(dcc, display_channel_get_stream_id(display, stream));
-
-            if (region_intersects(&agent->vis_region, &drawable->tree_item.base.rgn)) {
-                region_exclude(&agent->vis_region, &drawable->tree_item.base.rgn);
-                region_exclude(&agent->clip, &drawable->tree_item.base.rgn);
-                dcc_stream_agent_clip(dcc, agent);
-            }
+            dcc_update_stream_visible_region(dcc,
+                                             display_channel_get_stream_id(display, stream),
+                                             &drawable->tree_item.base.rgn);
         }
     }
 }
-- 
2.13.6

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]