Changeset 5586724 in libguac


Ignore:
Timestamp:
04/02/12 02:10:52 (14 months ago)
Author:
zhangmaike
Branches:
master, debian, rpm, unstable
Children:
c4e09fb
Parents:
8b18933
git-author:
Michael Jumper <zhangmaike@…> (04/02/12 02:10:52)
git-committer:
Michael Jumper <zhangmaike@…> (04/02/12 02:10:52)
Message:

Use appropriate BPP and packing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/protocol.c

    rf6c5e2b r5586724  
    165165    png_infop png_info; 
    166166    png_byte** png_rows; 
     167    int bpp; 
    167168 
    168169    int x, y; 
     
    192193        return __guac_socket_write_length_png_cairo(socket, surface); 
    193194 
     195    /* Calculate BPP from palette size */ 
     196    if      (palette->size <= 2)  bpp = 1; 
     197    else if (palette->size <= 4)  bpp = 2; 
     198    else if (palette->size <= 16) bpp = 4; 
     199    else                          bpp = 8; 
     200 
    194201    /* Set up PNG writer */ 
    195202    png = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); 
     
    253260        width, 
    254261        height, 
    255         8, 
     262        bpp, 
    256263        PNG_COLOR_TYPE_PALETTE, 
    257264        PNG_INTERLACE_NONE, 
     
    265272    /* Write image */ 
    266273    png_set_rows(png, png_info, png_rows); 
    267     png_write_png(png, png_info, PNG_TRANSFORM_IDENTITY, NULL); 
     274    png_write_png(png, png_info, PNG_TRANSFORM_PACKING, NULL); 
    268275 
    269276    /* Finish write */ 
Note: See TracChangeset for help on using the changeset viewer.