[Spice-devel] [PATCH 3/3] worker: simplify surface_update_dest()
Fabiano FidĂȘncio
fidencio at redhat.com
Mon Nov 23 10:36:50 PST 2015
From: Marc-André Lureau <marcandre.lureau at gmail.com>
---
server/red_worker.c | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
diff --git a/server/red_worker.c b/server/red_worker.c
index 308e84f..a82a871 100644
--- a/server/red_worker.c
+++ b/server/red_worker.c
@@ -938,24 +938,21 @@ static void image_surface_init(DisplayChannel *display)
static void surface_update_dest(RedSurface *surface, const SpiceRect *area)
{
- RedSurface *surface;
+ SpiceCanvas *canvas = surface->context.canvas;
+ int h = area->bottom - area->top;
+ int stride = surface->context.stride;
+ uint8_t *line_0 = surface->context.line_0;
- surface = &display->surfaces[surface_id];
- 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;
+ if (surface->context.canvas_draws_on_surface)
+ return;
+ if (h == 0)
+ return;
- if (!(h = area->bottom - area->top)) {
- return;
- }
+ spice_return_if_fail(stride < 0);
- 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);
- }
+ 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);
}
/*
--
2.5.0
More information about the Spice-devel
mailing list