cvs: pecl /gdchart gdchart.c /gdchart/gdchart-src gdc.h gdc_pie.c gdchart.c

From: Date: Wed, 27 Aug 2003 09:51:57 +0000
Subject: cvs: pecl /gdchart gdchart.c /gdchart/gdchart-src gdc.h gdc_pie.c gdchart.c
Groups: php.pecl.cvs 
Request: Send a blank email to pecl-cvs+get-427@lists.php.net to get a copy of this message
rasmus Wed Aug 27 05:51:57 2003 EDT Modified files: /pecl/gdchart gdchart.c /pecl/gdchart/gdchart-src gdc.h gdc_pie.c gdchart.c Log: - Fix annotation overflow - Switch to using TrueColor images - Swap out the colour allocation macros to be able to support colours with alpha channels now that we are using truecolor images Index: pecl/gdchart/gdchart.c diff -u pecl/gdchart/gdchart.c:1.2 pecl/gdchart/gdchart.c:1.3 --- pecl/gdchart/gdchart.c:1.2 Fri Aug 22 15:39:00 2003 +++ pecl/gdchart/gdchart.c Wed Aug 27 05:51:56 2003 @@ -14,7 +14,7 @@ +----------------------------------------------------------------------+ | Author: Rasmus Lerdorf | +----------------------------------------------------------------------+ - $Id: gdchart.c,v 1.2 2003/08/22 19:39:00 rasmus Exp $ + $Id: gdchart.c,v 1.3 2003/08/27 09:51:56 rasmus Exp $ */ /* @@ -234,17 +234,6 @@ }; /* }}} */ -/* {{{ php_gdchart_init_globals - */ -/* Uncomment this function if you have INI entries -static void php_gdchart_init_globals(zend_gdchart_globals *gdchart_globals) -{ - gdchart_globals->global_value = 0; - gdchart_globals->global_string = NULL; -} -*/ -/* }}} */ - /* {{{ _gdchart_set_defaults */ static void _gdchart_set_defaults(void) { int i, j; @@ -874,7 +863,7 @@ pval **type, **tmp, **val = NULL, **val2 = NULL; char **labels = NULL, *fname = NULL; float *values = NULL, *combo = NULL; - int fname_len, num_points = 0, num_combo_points = 0, + int fname_len = 0, num_points = 0, num_combo_points = 0, num_sets = 0, num_combo_sets = 0, i = 0, cnt = 0, ret = 0; FILE *fp = NULL; GDC_ANNOTATION_T anno; @@ -1041,7 +1030,10 @@ if(zend_hash_find(Z_OBJPROP_P(this_ptr), "anno_note", sizeof("anno_note"), (void **)&tmp)!=FAILURE) { convert_to_string_ex(tmp); - strncpy(anno.note, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); + if(Z_STRLEN_PP(tmp)>=MAX_NOTE_LEN) { + Z_STRVAL_PP(tmp)[MAX_NOTE_LEN-1]='\0'; + } + strncpy(anno.note, Z_STRVAL_PP(tmp), MAX_NOTE_LEN); if(zend_hash_find(Z_OBJPROP_P(this_ptr), "anno_point", sizeof("anno_point"), (void **)&tmp)!=FAILURE) { convert_to_double_ex(tmp); anno.point = (float) Z_DVAL_PP(tmp); Index: pecl/gdchart/gdchart-src/gdc.h diff -u pecl/gdchart/gdchart-src/gdc.h:1.1 pecl/gdchart/gdchart-src/gdc.h:1.2 --- pecl/gdchart/gdchart-src/gdc.h:1.1 Fri Aug 22 14:02:25 2003 +++ pecl/gdchart/gdchart-src/gdc.h Wed Aug 27 05:51:56 2003 @@ -23,9 +23,11 @@ #include <limits.h> #include <float.h> +/* Uh, why the hell do I need to suddenly define __USE_MISC now to build this on Linux?? */ +#define __USE_MISC 1 +#include "php_config.h" #include "php.h" #include "php_gd.h" -#include "php_config.h" #include "gd.h" #include "gdfonts.h" @@ -66,11 +68,16 @@ #define PVBLU 0x000000FF #define l2gdcal( c ) ((c)&PVRED)>>16 , ((c)&PVGRN)>>8 , ((c)&0x000000FF) #define l2gdshd( c ) (((c)&PVRED)>>16)/2 , (((c)&PVGRN)>>8)/2 , (((c)&0x000000FF))/2 +#define l2shl( c ) (((c)&0xff000000) + (((((c)&0x00ff0000)>>16)/2)<<16) + (((((c)&0x0000ff00)>>8)/2)<<8) + (((c)&0x000000ff))/2) static int _gdccfoo1; static unsigned long _gdccfoo2; #define _gdcntrst(bg) ( ((bg)&0x800000?0x000000:0xFF0000)| \ ((bg)&0x008000?0x000000:0x00FF00)| \ ((bg)&0x000080?0x000000:0x0000FF) ) +#if HAVE_LIBGD204 +#define _clrallocate( im, rawclr, bgc ) ( rawclr ) +#define _clrshdallocate( im, rawclr, bgc ) l2shl( rawclr ) +#else #define _clrallocate( im, rawclr, bgc ) \ ( (_gdccfoo2=rawclr==GDC_DFLTCOLOR? _gdcntrst(bgc): rawclr), \ (_gdccfoo1=gdImageColorExact(im,l2gdcal(_gdccfoo2))) != -1? \ @@ -85,7 +92,7 @@ gdImageColorsTotal(im) == gdMaxColors? \ gdImageColorClosest(im,l2gdshd(_gdccfoo2)): \ gdImageColorAllocate(im,l2gdshd(_gdccfoo2)) ) - +#endif typedef enum { GDC_GIF = 0, GDC_JPEG = 1, Index: pecl/gdchart/gdchart-src/gdc_pie.c diff -u pecl/gdchart/gdchart-src/gdc_pie.c:1.1 pecl/gdchart/gdchart-src/gdc_pie.c:1.2 --- pecl/gdchart/gdchart-src/gdc_pie.c:1.1 Fri Aug 22 14:02:25 2003 +++ pecl/gdchart/gdchart-src/gdc_pie.c Wed Aug 27 05:51:56 2003 @@ -383,7 +383,12 @@ } /* ----- go ahead and start the image ----- */ +#if HAVE_LIBGD204 + im = gdImageCreateTrueColor( IMGWIDTH, IMGHEIGHT ); + gdImageFilledRectangle(im,0,0, IMGWIDTH-1,IMGHEIGHT-1, GDCPIE_BGColor); +#else im = gdImageCreate( IMGWIDTH, IMGHEIGHT ); +#endif /* --- allocate the requested colors --- */ BGColor = clrallocate( im, GDCPIE_BGColor ); Index: pecl/gdchart/gdchart-src/gdchart.c diff -u pecl/gdchart/gdchart-src/gdchart.c:1.2 pecl/gdchart/gdchart-src/gdchart.c:1.3 --- pecl/gdchart/gdchart-src/gdchart.c:1.2 Fri Aug 22 16:42:46 2003 +++ pecl/gdchart/gdchart-src/gdchart.c Wed Aug 27 05:51:56 2003 @@ -952,10 +952,19 @@ GDC_image != (void*)NULL ) im = GDC_image; else +#if HAVE_LIBGD204 + im = gdImageCreateTrueColor( IMGWIDTH, IMGHEIGHT ); +#else im = gdImageCreate( IMGWIDTH, IMGHEIGHT ); +#endif +#if HAVE_LIBGD204 + BGColor = GDC_BGColor; + gdImageFilledRectangle(im,0,0, IMGWIDTH-1,IMGHEIGHT-1, BGColor); +#else BGColor = gdImageColorAllocate( im, l2gdcal(GDC_BGColor) ); +#endif LineColor = clrallocate( im, GDC_LineColor ); PlotColor = clrallocate( im, GDC_PlotColor ); GridColor = clrallocate( im, GDC_GridColor ); @@ -2019,7 +2028,11 @@ { s = 90; e = 90+180; fo = -1; } if( uniq_clr != -1L ) /* the safe way */ { +#if HAVE_LIBGD204 + int uc = uniq_clr; +#else int uc = gdImageColorAllocate( im, l2gdcal(uniq_clr) ); +#endif gdImageArc( im, scat_x, scat_y, hlf_scatterwdth*2, hlf_scatterwdth*2, s, e,

« previous php.pecl.cvs (#427) next »