summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2015-11-23 19:45:13 +0100
committerFrediano Ziglio <fziglio@redhat.com>2015-11-25 11:51:18 +0000
commit30e0aabace4dde3caaffa26a52d0309c9b2351d3 (patch)
treeb2d05f17ebc26ae810e57e951287af1d5a333f91
parent9e5363d483f5b1e58ee80fbac8522075d0f8f8f2 (diff)
downloadspice-30e0aabace4dde3caaffa26a52d0309c9b2351d3.zip
spice-30e0aabace4dde3caaffa26a52d0309c9b2351d3.tar.gz
spice-30e0aabace4dde3caaffa26a52d0309c9b2351d3.tar.xz
worker: simplify surface_update_dest()
Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--server/red_worker.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/server/red_worker.c b/server/red_worker.c
index 6dac29d..235b6ee 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -938,21 +938,22 @@ static void image_surface_init(DisplayChannel *display)
static void surface_update_dest(RedSurface *surface, const SpiceRect *area)
{
- if (!surface->context.canvas_draws_on_surface) {
- SpiceCanvas *canvas = surface->context.canvas;
- int h;
- int stride = surface->context.stride;
- uint8_t *line_0 = surface->context.line_0;
+ SpiceCanvas *canvas = surface->context.canvas;
+ int stride = surface->context.stride;
+ uint8_t *line_0 = surface->context.line_0;
- if (!(h = area->bottom - area->top)) {
- return;
- }
+ if (surface->context.canvas_draws_on_surface)
+ return;
- spice_assert(stride < 0);
- uint8_t *dest = line_0 + (area->top * stride) + area->left * sizeof(uint32_t);
- dest += (h - 1) * stride;
- canvas->ops->read_bits(canvas, dest, -stride, area);
- }
+ int h = area->bottom - area->top;
+ if (h == 0)
+ return;
+
+ spice_return_if_fail(stride < 0);
+
+ uint8_t *dest = line_0 + (area->top * stride) + area->left * sizeof(uint32_t);
+ dest += (h - 1) * stride;
+ canvas->ops->read_bits(canvas, dest, -stride, area);
}
/*