Changeset 3285 for libcaca/trunk


Ignore:
Timestamp:
Nov 5, 2008, 12:48:31 AM (11 years ago)
Author:
bsittler
Message:

use alpha channel in gd truecolor images -- note that the scale for
this is [0, 127], rather than [0, 255]; always free the temporary
pixels copy allocated in PHP_FUNCTION(caca_dither_bitmap); fix a typo
which caused PHP_FUNCTION(caca_set_display_title) to crash due to a
failed run-time binding to "caca_set_display" (the "_title" was
missing).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca-php/php_caca.c

    r3260 r3285  
    10491049        caca_dither_t *dither;
    10501050        if (img->trueColor)
    1051                 dither = caca_create_dither(sizeof(int) * 8, img->sx, img->sy, img->sx * sizeof(int), 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
     1051                dither = caca_create_dither(sizeof(int) * 8, img->sx, img->sy, img->sx * sizeof(int), 0x00ff0000, 0x0000ff00, 0x000000ff, 0x7f000000);
    10521052        else
    10531053                dither = caca_create_dither(sizeof(char) * 8, img->sx, img->sy, img->sx * sizeof(char), 0, 0, 0, 0);
     
    13271327        //load palette if image is not true color
    13281328        if (load_palette && !img->trueColor && gd_load_palette(img, dither) != 0) {
     1329                free(pixels);
    13291330                RETURN_FALSE;
    13301331        }
     
    14381439                for (j = 0; j < img->sx; j++) {
    14391440                        uint8_t *src = buffer + i * pitch + j * 4;
    1440                         img->tpixels[i][j] = *(src + 3) | (*(src + 2) << 8) | (*(src + 1) << 16) | (*(src + 0) << 24);
     1441                        img->tpixels[i][j] = *(src + 3) | (*(src + 2) << 8) | (*(src + 1) << 16) | ((*(src + 0) & 0xfe) << 23);
    14411442                }
    14421443        }
     
    17771778        caca_display_t *display;
    17781779        ZEND_FETCH_RESOURCE(display, caca_display_t*, &_zval, -1, PHP_CACA_DISPLAY_RES_NAME, le_caca_display);
    1779         RETURN_SUCCESS(caca_set_display(display, str));
     1780        RETURN_SUCCESS(caca_set_display_title(display, str));
    17801781}
    17811782
Note: See TracChangeset for help on using the changeset viewer.