--- parser3/src/lib/gd/gif.C 2003/11/21 12:35:50 1.1 +++ parser3/src/lib/gd/gif.C 2017/02/07 22:00:38 1.10 @@ -1,7 +1,7 @@ /** @file Parser: image manipulations impl1. - Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001-2017 Art. Lebedev Studio (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) based on: gd @@ -14,12 +14,10 @@ can incorporate them into new versions. */ -static const char * const IDENT_GIF_C="$Date: 2003/11/21 12:35:50 $"; - #include "gif.h" - #include "mtables.h" -//#include "pa_common.h" + +volatile const char * IDENT_GIF_C="$Id: gif.C,v 1.10 2017/02/07 22:00:38 moko Exp $" IDENT_GIF_H; //static void BrushApply(int x, int y); //static void TileApply(int x, int y); @@ -29,12 +27,12 @@ void gdImage::Create(int asx, int asy) { sy = asy; int i; - pixels = (unsigned char **) malloc(sizeof(unsigned char *) * sx); + pixels = (unsigned char **) pa_malloc(sizeof(unsigned char *) * sx); polyInts = 0; polyAllocated = 0; lineWidth = 1; for (i=0; (i>8, r=g>>8; return ColorRGB(r & 0xFF,g & 0xFF,b & 0xFF); } +unsigned int gdImage::DecodeColor(int color) { + if(color<0) + return color; + return (((red[color]<<8) + green[color])<<8)+blue[color]; +} void gdImage::ColorDeallocate(int color) { @@ -154,7 +157,7 @@ void gdImage::SetPixel(int x, int y, int int gdImage::GetPixel(int x, int y) { - return BoundsSafe(x, y) ? pixels[x][y]:0; + return BoundsSafe(x, y) ? pixels[x][y]:-1; } /* Bresenham as presented in Foley & Van Dam */ @@ -517,7 +520,7 @@ void gdImage::Fill(int x, int y, int col if (GetPixel(i, y) != old) { break; } - SetPixel(i, y, color); + DoSetPixel(i, y, color); // PAF, was SetPixel leftLimit = i; } if (leftLimit == (-1)) { @@ -529,7 +532,7 @@ void gdImage::Fill(int x, int y, int col if (GetPixel(i, y) != old) { break; } - SetPixel(i, y, color); + DoSetPixel(i, y, color); // PAF, was SetPixel rightLimit = i; } /* Look at lines above and below and start paints */ @@ -815,14 +818,14 @@ void gdImage::FilledPolygon(Point *p, in return; } if (!polyAllocated) { - polyInts = (int *) malloc(sizeof(int) * n); + polyInts = (int *) pa_malloc(sizeof(int) * n); polyAllocated = n; } if (polyAllocated < n) { while (polyAllocated < n) { polyAllocated *= 2; } - polyInts = (int *) realloc(polyInts, + polyInts = (int *) pa_realloc(polyInts, sizeof(int) * polyAllocated); } y1 = p[0].y; @@ -941,14 +944,14 @@ void gdImage::FilledPolygonReplaceColor( return; } if (!polyAllocated) { - polyInts = (int *) malloc(sizeof(int) * n); + polyInts = (int *) pa_malloc(sizeof(int) * n); polyAllocated = n; } if (polyAllocated < n) { while (polyAllocated < n) { polyAllocated *= 2; } - polyInts = (int *) realloc(polyInts, + polyInts = (int *) pa_realloc(polyInts, sizeof(int) * polyAllocated); } y1 = p[0].y;