diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2002-12-03 19:25:55 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2002-12-03 19:25:55 +0000 |
| commit | 4c1ca7517740f23ea0738c658067a3a7ef88c32a (patch) | |
| tree | d75d987f99d7f038969a45ba5e144a1e4e1c7356 | |
| parent | d58428d3bd19b1b99a66c4afc654fbb3e4226130 (diff) | |
| download | php-git-4c1ca7517740f23ea0738c658067a3a7ef88c32a.tar.gz | |
MFH
| -rw-r--r-- | ext/pdf/pdf.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/ext/pdf/pdf.c b/ext/pdf/pdf.c index 682daea17f..73a6885699 100644 --- a/ext/pdf/pdf.c +++ b/ext/pdf/pdf.c @@ -276,7 +276,7 @@ static void custom_errorhandler(PDF *p, int type, const char *shortmsg) case PDF_SystemError: case PDF_UnknownError: default: - php_error(E_WARNING,"PDFlib error: %s", shortmsg); + php_error(E_ERROR,"PDFlib error: %s", shortmsg); } } /* }}} */ @@ -1963,17 +1963,30 @@ PHP_FUNCTION(pdf_open_memory_image) ZEND_FETCH_RESOURCE(im, gdImagePtr, arg2, -1, "Image", le_gd); count = 3 * im->sx * im->sy; - if(NULL == (buffer = (unsigned char *) emalloc(count))) { - RETURN_FALSE; - } + buffer = (unsigned char *) emalloc(count); ptr = buffer; for(i=0; i<im->sy; i++) { for(j=0; j<im->sx; j++) { - color = im->pixels[i][j]; - *ptr++ = im->red[color]; - *ptr++ = im->green[color]; - *ptr++ = im->blue[color]; +#if HAVE_LIBGD20 + if(gdImageTrueColor(im)) { + if (im->tpixels && gdImageBoundsSafe(im, j, i)) { + color = gdImageTrueColorPixel(im, j, i); + *ptr++ = (color >> 16) & 0xFF; + *ptr++ = (color >> 8) & 0xFF; + *ptr++ = color & 0xFF; + } + } else { +#endif + if (im->pixels && gdImageBoundsSafe(im, j, i)) { + color = im->pixels[im->sy][im->sx]; + *ptr++ = im->red[color]; + *ptr++ = im->green[color]; + *ptr++ = im->blue[color]; + } +#if HAVE_LIBGD20 + } +#endif } } |
