summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2016-09-18 03:08:50 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-09-30 13:10:27 +0100
commit3e51627991f6315a795a50e7df845904c70514a2 (patch)
tree29adb9b1f19ee938d519b694d65d59d7553826e8
parent696efb98ac615132c00417af11027ac7f1bd7796 (diff)
Cache field to make code easier
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--server/display-channel.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/server/display-channel.c b/server/display-channel.c
index d7ea7d58..32f8e671 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -1976,22 +1976,23 @@ void display_channel_process_surface_cmd(DisplayChannel *display,
switch (surface_cmd->type) {
case QXL_SURFACE_CMD_CREATE: {
- uint32_t height = surface_cmd->u.surface_create.height;
- int32_t stride = surface_cmd->u.surface_create.stride;
+ const RedSurfaceCreate *create = &surface_cmd->u.surface_create;
+ uint32_t height = create->height;
+ int32_t stride = create->stride;
int reloaded_surface = loadvm || (surface_cmd->flags & QXL_SURF_FLAG_KEEP_DATA);
if (surface->refs) {
spice_warning("avoiding creating a surface twice");
break;
}
- data = surface_cmd->u.surface_create.data;
+ data = create->data;
if (stride < 0) {
/* No need to worry about overflow here, command should already be validated
* when it is read, specifically red_get_surface_cmd */
data -= (int32_t)(stride * (height - 1));
}
- display_channel_create_surface(display, surface_id, surface_cmd->u.surface_create.width,
- height, stride, surface_cmd->u.surface_create.format, data,
+ display_channel_create_surface(display, surface_id, create->width,
+ height, stride, create->format, data,
reloaded_surface,
// reloaded surfaces will be sent on demand
!reloaded_surface);