Changeset 3186ce2 in libguac-client-rdp


Ignore:
Timestamp:
04/06/12 01:55:46 (14 months ago)
Author:
zhangmaike
Branches:
master, debian, rpm, unstable
Children:
81b81c3
Parents:
572810e
git-author:
Michael Jumper <zhangmaike@…> (04/06/12 01:55:46)
git-committer:
Michael Jumper <zhangmaike@…> (04/06/12 01:55:46)
Message:

Fix transparent glyphs

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/client.h

    r572810e r3186ce2  
    5656 
    5757    /** 
    58      * Cairo surface which will receive all drawn glyphs. 
     58     * Cairo surface which will receive all TRANSPARENT glyphs. 
     59     */ 
     60    cairo_surface_t* trans_glyph_surface; 
     61 
     62    /** 
     63     * Cairo surface which will receive all OPAQUE glyphs. 
     64     */ 
     65    cairo_surface_t* opaque_glyph_surface; 
     66 
     67    /** 
     68     * The current Cairo surface which will receive all drawn glyphs, 
     69     * depending on whether we are currently drawing transparent or 
     70     * opaque glyphs. 
    5971     */ 
    6072    cairo_surface_t* glyph_surface; 
    6173 
    6274    /** 
    63      * Cairo instance for drawing to glyph surface. 
     75     * Cairo instance for drawing to the current glyph surface. 
    6476     */ 
    6577    cairo_t* glyph_cairo; 
  • src/client.c

    r572810e r3186ce2  
    394394            settings->width, settings->height); 
    395395 
    396     /* Create glyph surface and cairo instance */ 
    397     guac_client_data->glyph_surface = cairo_image_surface_create( 
     396    /* Create glyph surfaces */ 
     397    guac_client_data->opaque_glyph_surface = cairo_image_surface_create( 
    398398            CAIRO_FORMAT_RGB24, settings->width, settings->height); 
    399399 
    400     guac_client_data->glyph_cairo = cairo_create( 
    401         guac_client_data->glyph_surface); 
     400    guac_client_data->trans_glyph_surface = cairo_image_surface_create( 
     401            CAIRO_FORMAT_ARGB32, settings->width, settings->height); 
    402402 
    403403    /* Success */ 
  • src/rdp_glyph.c

    r572810e r3186ce2  
    140140    if (width != 0 && height != 0) { 
    141141 
     142        /* Prepare for opaque glyphs */ 
     143        guac_client_data->glyph_surface =  
     144            guac_client_data->opaque_glyph_surface; 
     145 
     146        /* Create cairo instance */ 
     147        guac_client_data->glyph_cairo = cairo_create( 
     148            guac_client_data->glyph_surface); 
     149 
    142150        /* Convert background color */ 
    143151        bgcolor = freerdp_color_convert_var(bgcolor, 
     
    155163 
    156164        cairo_fill(guac_client_data->glyph_cairo); 
     165 
     166    } 
     167 
     168    /* Otherwise, prepare for transparent glyphs  */ 
     169    else { 
     170 
     171        /* Select transparent glyph surface */ 
     172        guac_client_data->glyph_surface =  
     173            guac_client_data->trans_glyph_surface; 
     174 
     175        guac_client_data->glyph_cairo = cairo_create( 
     176            guac_client_data->glyph_surface); 
     177 
     178        /* Clear surface */ 
     179        cairo_set_operator(guac_client_data->glyph_cairo, 
     180            CAIRO_OPERATOR_SOURCE); 
     181 
     182        cairo_set_source_rgba(guac_client_data->glyph_cairo, 0, 0, 0, 0); 
     183        cairo_paint(guac_client_data->glyph_cairo); 
     184 
     185        /* Restore operator */ 
     186        cairo_set_operator(guac_client_data->glyph_cairo, 
     187            CAIRO_OPERATOR_OVER); 
    157188 
    158189    } 
     
    194225    cairo_surface_destroy(surface); 
    195226 
    196 } 
    197  
     227    /* Destroy cairo instance */ 
     228    cairo_destroy(guac_client_data->glyph_cairo); 
     229 
     230} 
     231 
Note: See TracChangeset for help on using the changeset viewer.