rename local pointer vars 'pixel' to 'pixels'

Reference issue: https://github.com/libsdl-org/SDL/issues/12749.
This commit is contained in:
Ozkan Sezer
2025-04-08 18:20:03 +03:00
committed by Ozkan Sezer
parent 46c314cc3d
commit 0fdfa925f2
4 changed files with 115 additions and 114 deletions
+4 -4
View File
@@ -1477,7 +1477,7 @@ SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h,
SDL_Surface *surface;
SDL_Cursor *cursor;
int x, y;
Uint32 *pixel;
Uint32 *pixels;
Uint8 datab = 0, maskb = 0;
const Uint32 black = 0xFF000000;
const Uint32 white = 0xFFFFFFFF;
@@ -1498,16 +1498,16 @@ SDL_Cursor *SDL_CreateCursor(const Uint8 *data, const Uint8 *mask, int w, int h,
return NULL;
}
for (y = 0; y < h; ++y) {
pixel = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
pixels = (Uint32 *)((Uint8 *)surface->pixels + y * surface->pitch);
for (x = 0; x < w; ++x) {
if ((x % 8) == 0) {
datab = *data++;
maskb = *mask++;
}
if (maskb & 0x80) {
*pixel++ = (datab & 0x80) ? black : white;
*pixels++ = (datab & 0x80) ? black : white;
} else {
*pixel++ = (datab & 0x80) ? inverted : transparent;
*pixels++ = (datab & 0x80) ? inverted : transparent;
}
datab <<= 1;
maskb <<= 1;
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -32,18 +32,18 @@ static void SDL_DrawLine1(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
if (y1 == y2) {
int length;
int pitch = (dst->pitch / dst->fmt->bytes_per_pixel);
Uint8 *pixel;
Uint8 *pixels;
if (x1 <= x2) {
pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
pixels = (Uint8 *)dst->pixels + y1 * pitch + x1;
length = draw_end ? (x2 - x1 + 1) : (x2 - x1);
} else {
pixel = (Uint8 *)dst->pixels + y1 * pitch + x2;
pixels = (Uint8 *)dst->pixels + y1 * pitch + x2;
if (!draw_end) {
++pixel;
++pixels;
}
length = draw_end ? (x1 - x2 + 1) : (x1 - x2);
}
SDL_memset(pixel, color, length);
SDL_memset(pixels, color, length);
} else if (x1 == x2) {
VLINE(Uint8, DRAW_FASTSETPIXEL1, draw_end);
} else if (ABS(x1 - x2) == ABS(y1 - y2)) {
+12 -12
View File
@@ -6543,26 +6543,26 @@ static void *stbi__psd_load(stbi__context *s, int *x, int *y, int *comp, int req
if (channelCount >= 4) {
if (ri->bits_per_channel == 16) {
for (i=0; i < w*h; ++i) {
stbi__uint16 *pixel = (stbi__uint16 *) out + 4*i;
if (pixel[3] != 0 && pixel[3] != 65535) {
float a = pixel[3] / 65535.0f;
stbi__uint16 *pixels = (stbi__uint16 *) out + 4*i;
if (pixels[3] != 0 && pixels[3] != 65535) {
float a = pixels[3] / 65535.0f;
float ra = 1.0f / a;
float inv_a = 65535.0f * (1 - ra);
pixel[0] = (stbi__uint16) (pixel[0]*ra + inv_a);
pixel[1] = (stbi__uint16) (pixel[1]*ra + inv_a);
pixel[2] = (stbi__uint16) (pixel[2]*ra + inv_a);
pixels[0] = (stbi__uint16) (pixels[0]*ra + inv_a);
pixels[1] = (stbi__uint16) (pixels[1]*ra + inv_a);
pixels[2] = (stbi__uint16) (pixels[2]*ra + inv_a);
}
}
} else {
for (i=0; i < w*h; ++i) {
unsigned char *pixel = out + 4*i;
if (pixel[3] != 0 && pixel[3] != 255) {
float a = pixel[3] / 255.0f;
unsigned char *pixels = out + 4*i;
if (pixels[3] != 0 && pixels[3] != 255) {
float a = pixels[3] / 255.0f;
float ra = 1.0f / a;
float inv_a = 255.0f * (1 - ra);
pixel[0] = (unsigned char) (pixel[0]*ra + inv_a);
pixel[1] = (unsigned char) (pixel[1]*ra + inv_a);
pixel[2] = (unsigned char) (pixel[2]*ra + inv_a);
pixels[0] = (unsigned char) (pixels[0]*ra + inv_a);
pixels[1] = (unsigned char) (pixels[1]*ra + inv_a);
pixels[2] = (unsigned char) (pixels[2]*ra + inv_a);
}
}
}