summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2021-08-13 20:53:53 +0700
committerPierre Joye <pierre.php@gmail.com>2021-08-13 20:53:53 +0700
commitdfe1ecb8a999418dcfe2224da0c515e565977940 (patch)
tree5a1f6b86241c09a2da10f523a6e1d0fccbfaa0af /src
parentf9c995b55c8d3794130a98e7be12fb0eba97d7a6 (diff)
downloadlibgd-dfe1ecb8a999418dcfe2224da0c515e565977940.tar.gz
cleanup, clamping is not neeeded at all. Fix signed/unsigned comparison
Diffstat (limited to 'src')
-rw-r--r--src/gd_interpolation.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/gd_interpolation.c b/src/gd_interpolation.c
index ce27220..167607c 100644
--- a/src/gd_interpolation.c
+++ b/src/gd_interpolation.c
@@ -1635,7 +1635,7 @@ BGD_DECLARE(gdImagePtr) gdImageScale(const gdImagePtr src, const unsigned int ne
if (new_width == 0 || new_height == 0) {
return NULL;
}
- if (new_width == gdImageSX(src) && new_height == gdImageSY(src)) {
+ if ((int)new_width == gdImageSX(src) && (int)new_height == gdImageSY(src)) {
return gdImageClone(src);
}
switch (src->interpolation_id) {
@@ -1701,7 +1701,7 @@ gdImageRotateNearestNeighbour(gdImagePtr src, const float degrees,
unsigned int i;
gdImagePtr dst;
gdRect bbox;
- int new_height, new_width;
+ unsigned int new_height, new_width;
gdRotatedImageSize(src, degrees, &bbox);
new_width = bbox.width;
@@ -1753,7 +1753,7 @@ gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor)
unsigned int dst_offset_y = 0;
unsigned int i;
gdImagePtr dst;
- int new_width, new_height;
+ unsigned int new_width, new_height;
gdRect bbox;
if (bgColor < 0) {
@@ -1993,11 +1993,6 @@ static int getPixelRgbInterpolated(gdImagePtr im, const int tcolor)
r = (unsigned char)tcolor >> 16;
a = (unsigned char)tcolor >> 24;
- b = CLAMP(b, 0, 255);
- g = CLAMP(g, 0, 255);
- r = CLAMP(r, 0, 255);
- a = CLAMP(a, 0, 127);
-
for (i = 0; i < im->colorsTotal; i++) {
if (im->red[i] == r && im->green[i] == g && im->blue[i] == b && im->alpha[i] == a) {
return i;