Feature #890 ยป 0042-sdl2-Rename-getpixel-as-get_pixel.patch
client/gui-sdl2/graphics.c | ||
---|---|---|
Return the pixel value at (x, y)
|
||
NOTE: The surface must be locked before calling this!
|
||
**************************************************************************/
|
||
Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y)
|
||
Uint32 get_pixel(SDL_Surface *surf, Sint16 x, Sint16 y)
|
||
{
|
||
if (!surf) {
|
||
return 0x0;
|
||
... | ... | |
return *((Uint32 *)surf->pixels + y * surf->pitch / sizeof(Uint32) + x);
|
||
default:
|
||
return 0; /* shouldn't happen, but avoids warnings */
|
||
return 0; /* Shouldn't happen, but avoids warnings */
|
||
}
|
||
}
|
||
client/gui-sdl2/graphics.h | ||
---|---|---|
int blit_entire_src(SDL_Surface *psrc,
|
||
SDL_Surface *pdest, Sint16 dest_x, Sint16 dest_y);
|
||
Uint32 getpixel(SDL_Surface *surf, Sint16 x, Sint16 y);
|
||
Uint32 get_pixel(SDL_Surface *surf, Sint16 x, Sint16 y);
|
||
Uint32 get_first_pixel(SDL_Surface *surf);
|
||
void create_frame(SDL_Surface *dest, Sint16 left, Sint16 top,
|
client/gui-sdl2/gui_mouse.c | ||
---|---|---|
d = data + y * w;
|
||
m = mask + y * w;
|
||
for (x = 0; x < image->w; x++) {
|
||
color = getpixel(image, x, y);
|
||
color = get_pixel(image, x, y);
|
||
SDL_GetRGBA(color, image->format, &r, &g, &b, &a);
|
||
if (a != 0) {
|
||
color = (r + g + b) / 3;
|
client/gui-sdl2/widget_label.c | ||
---|---|---|
area = label->size;
|
||
label->dst = gui_layer_new(0, 0, ptheme);
|
||
/* normal */
|
||
/* Normal */
|
||
redraw_iconlabel(label);
|
||
/* selected */
|
||
/* Selected */
|
||
area.x = 0;
|
||
area.y = label->size.h;
|
||
if (flags & WF_RESTORE_BACKGROUND) {
|
||
SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
|
||
store = pstr->bgcol;
|
||
SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
|
||
SDL_GetRGBA(get_pixel(ptheme, area.x , area.y), ptheme->format,
|
||
&pstr->bgcol.r, &pstr->bgcol.g,
|
||
&pstr->bgcol.b, &pstr->bgcol.a);
|
||
} else {
|
||
... | ... | |
pdest = icon_label->dst->surface;
|
||
icon_label->dst->surface = ptheme;
|
||
/* normal */
|
||
/* Normal */
|
||
redraw_iconlabel(icon_label);
|
||
/* selected */
|
||
/* Selected */
|
||
area.x = 0;
|
||
area.y = icon_label->size.h;
|
||
if (flags & WF_RESTORE_BACKGROUND) {
|
||
SDL_FillRect(ptheme, &area, map_rgba(ptheme->format, bg_color));
|
||
store = icon_label->string_utf8->bgcol;
|
||
SDL_GetRGBA(getpixel(ptheme, area.x , area.y), ptheme->format,
|
||
SDL_GetRGBA(get_pixel(ptheme, area.x , area.y), ptheme->format,
|
||
&icon_label->string_utf8->bgcol.r,
|
||
&icon_label->string_utf8->bgcol.g,
|
||
&icon_label->string_utf8->bgcol.b,
|