|
|
| version 1.23.2.5.2.3, 2003/03/24 15:08:02 | version 1.25, 2003/11/20 15:35:30 |
|---|---|
| Line 40 class gdGrowingBuf: PA_Object { | Line 40 class gdGrowingBuf: PA_Object { |
| size_t fallocated; | size_t fallocated; |
| size_t fused; | size_t fused; |
| bool is_full() { return fused==fallocated; } | |
| void expand(size_t delta) { | void expand(size_t delta) { |
| size_t new_allocated=fallocated+delta; | size_t new_allocated=fallocated+delta; |
| fptr=(unsigned char*)realloc(fptr, new_allocated); | fptr=(unsigned char*)realloc(fptr, new_allocated); |
| Line 52 public: | Line 51 public: |
| gdGrowingBuf(): fptr(0), fallocated(0), fused(0) {} | gdGrowingBuf(): fptr(0), fallocated(0), fused(0) {} |
| void append(unsigned char *abuf, size_t asize) { | void append(unsigned char *abuf, size_t asize) { |
| if(is_full()) | ssize_t delta=asize-(fallocated-fused); |
| expand(100); | if(delta>0) |
| expand(delta+100); | |
| memcpy(&fptr[fallocated], abuf, asize); | memcpy(&fptr[fused], abuf, asize); |
| fused+=asize; | fused+=asize; |
| } | } |
| }; | }; |
| Line 256 inline int gdImage::BoundsSafe(int x, in | Line 256 inline int gdImage::BoundsSafe(int x, in |
| } | } |
| inline /*paf int*/void gdImage::DoSetPixel(int x, int y, int color){ | inline /*paf int*/void gdImage::DoSetPixel(int x, int y, int color){ |
| if(BoundsSafe(x, y)) pixels[x][y] = color; | if(BoundsSafe(x, y)) pixels[x][y] = (unsigned char)color; |
| } | } |
| DECLARE_OBJECT_PTR(gdGifEncoder); | |
| #endif | #endif |