Changeset e8a54cd in libguac-client-rdp


Ignore:
Timestamp:
04/03/12 17:03:52 (14 months ago)
Author:
zhangmaike
Branches:
master, debian, rpm, unstable
Children:
9ebadf7
Parents:
69f2919
git-author:
Michael Jumper <zhangmaike@…> (04/03/12 17:03:52)
git-committer:
Michael Jumper <zhangmaike@…> (04/03/12 17:03:52)
Message:

Only cache bitmap on client if not ephemeral.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/rdp_bitmap.c

    rd15ba2b re8a54cd  
    7474                32, ((rdp_freerdp_context*) context)->clrconv); 
    7575 
    76         /* Create surface from image data */ 
    77         cairo_surface_t* surface = cairo_image_surface_create_for_data( 
    78             image_buffer, CAIRO_FORMAT_RGB24, 
    79             bitmap->width, bitmap->height, 4*bitmap->width); 
     76        /* If not ephemeral, store cached image, and free image data */ 
     77        if (!bitmap->ephemeral) { 
    8078 
    81         /* Send surface to buffer */ 
    82         guac_protocol_send_png(socket, GUAC_COMP_SRC, buffer, 0, 0, surface); 
     79            /* Create surface from image data */ 
     80            cairo_surface_t* surface = cairo_image_surface_create_for_data( 
     81                image_buffer, CAIRO_FORMAT_RGB24, 
     82                bitmap->width, bitmap->height, 4*bitmap->width); 
    8383 
    84         /* Free surface */ 
    85         cairo_surface_destroy(surface); 
     84            /* Send surface to buffer */ 
     85            guac_protocol_send_png(socket, 
     86                    GUAC_COMP_SRC, buffer, 0, 0, surface); 
    8687 
    87         /* If ephemeral, just free image data */ 
    88         if (!bitmap->ephemeral) { 
     88            /* Free surface */ 
     89            cairo_surface_destroy(surface); 
    8990 
    9091            /* Free image data if actually alloated */ 
     
    118119    int height = bitmap->bottom - bitmap->top + 1; 
    119120 
    120     guac_protocol_send_copy(socket, 
    121             ((guac_rdp_bitmap*) bitmap)->layer, 
    122             0, 0, width, height, 
    123             GUAC_COMP_OVER, 
    124             GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top); 
     121    /* If not ephemeral, retrieve from cache */ 
     122    if (!bitmap->ephemeral) 
     123        guac_protocol_send_copy(socket, 
     124                ((guac_rdp_bitmap*) bitmap)->layer, 
     125                0, 0, width, height, 
     126                GUAC_COMP_OVER, 
     127                GUAC_DEFAULT_LAYER, bitmap->left, bitmap->top); 
     128 
     129    /* Otherwise, draw with stored image data */ 
     130    else if (bitmap->data != NULL) { 
     131 
     132        /* Create surface from image data */ 
     133        cairo_surface_t* surface = cairo_image_surface_create_for_data( 
     134            bitmap->data, CAIRO_FORMAT_RGB24, 
     135            width, height, 4*bitmap->width); 
     136 
     137        /* Send surface to buffer */ 
     138        guac_protocol_send_png(socket, 
     139                GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, 
     140                bitmap->left, bitmap->top, surface); 
     141 
     142        /* Free surface */ 
     143        cairo_surface_destroy(surface); 
     144 
     145    } 
    125146 
    126147} 
Note: See TracChangeset for help on using the changeset viewer.