Updated structure and field names for consistency
Type names are camel case and field names are snake case except for fields ending in id, which are capitalized. Fixes https://github.com/libsdl-org/SDL/issues/6955
This commit is contained in:
@@ -297,7 +297,7 @@
|
||||
#define CHOOSE_BLIT(blitter, alpha, fmt) \
|
||||
do { \
|
||||
if (alpha == 255) { \
|
||||
switch (fmt->BytesPerPixel) { \
|
||||
switch (fmt->bytes_per_pixel) { \
|
||||
case 1: \
|
||||
blitter(1, Uint8, OPAQUE_BLIT); \
|
||||
break; \
|
||||
@@ -312,7 +312,7 @@
|
||||
break; \
|
||||
} \
|
||||
} else { \
|
||||
switch (fmt->BytesPerPixel) { \
|
||||
switch (fmt->bytes_per_pixel) { \
|
||||
case 1: \
|
||||
/* No 8bpp alpha blitting */ \
|
||||
break; \
|
||||
@@ -461,7 +461,7 @@ static int SDLCALL SDL_RLEBlit(SDL_Surface *surf_src, const SDL_Rect *srcrect,
|
||||
/* Set up the source and destination pointers */
|
||||
x = dstrect->x;
|
||||
y = dstrect->y;
|
||||
dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * surf_src->format->BytesPerPixel;
|
||||
dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * surf_src->format->bytes_per_pixel;
|
||||
srcbuf = (Uint8 *)surf_src->map->data;
|
||||
|
||||
{
|
||||
@@ -488,7 +488,7 @@ static int SDLCALL SDL_RLEBlit(SDL_Surface *surf_src, const SDL_Rect *srcrect,
|
||||
} \
|
||||
}
|
||||
|
||||
switch (surf_src->format->BytesPerPixel) {
|
||||
switch (surf_src->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
RLESKIP(1, Uint8);
|
||||
break;
|
||||
@@ -608,7 +608,7 @@ done:
|
||||
macro-compatible with SDL_PixelFormat but without the unneeded fields */
|
||||
typedef struct
|
||||
{
|
||||
Uint8 BytesPerPixel;
|
||||
Uint8 bytes_per_pixel;
|
||||
Uint8 padding[3];
|
||||
Uint32 Rmask;
|
||||
Uint32 Gmask;
|
||||
@@ -702,7 +702,7 @@ static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst,
|
||||
} while (--linecount); \
|
||||
} while (0)
|
||||
|
||||
switch (df->BytesPerPixel) {
|
||||
switch (df->bytes_per_pixel) {
|
||||
case 2:
|
||||
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
||||
RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_565);
|
||||
@@ -734,7 +734,7 @@ static int SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcre
|
||||
|
||||
x = dstrect->x;
|
||||
y = dstrect->y;
|
||||
dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * df->BytesPerPixel;
|
||||
dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * df->bytes_per_pixel;
|
||||
srcbuf = (Uint8 *)surf_src->map->data + sizeof(RLEDestFormat);
|
||||
|
||||
{
|
||||
@@ -742,7 +742,7 @@ static int SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcre
|
||||
int vskip = srcrect->y;
|
||||
if (vskip) {
|
||||
int ofs;
|
||||
if (df->BytesPerPixel == 2) {
|
||||
if (df->bytes_per_pixel == 2) {
|
||||
/* the 16/32 interleaved format */
|
||||
do {
|
||||
/* skip opaque line */
|
||||
@@ -850,7 +850,7 @@ static int SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcre
|
||||
} while (--linecount); \
|
||||
} while (0)
|
||||
|
||||
switch (df->BytesPerPixel) {
|
||||
switch (df->bytes_per_pixel) {
|
||||
case 2:
|
||||
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
||||
RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_565);
|
||||
@@ -1027,14 +1027,14 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||
return -1;
|
||||
}
|
||||
df = dest->format;
|
||||
if (surface->format->BitsPerPixel != 32) {
|
||||
if (surface->format->bits_per_pixel != 32) {
|
||||
return -1; /* only 32bpp source supported */
|
||||
}
|
||||
|
||||
/* find out whether the destination is one we support,
|
||||
and determine the max size of the encoded result */
|
||||
masksum = df->Rmask | df->Gmask | df->Bmask;
|
||||
switch (df->BytesPerPixel) {
|
||||
switch (df->bytes_per_pixel) {
|
||||
case 2:
|
||||
/* 16bpp: only support 565 and 555 formats */
|
||||
switch (masksum) {
|
||||
@@ -1086,7 +1086,7 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||
{
|
||||
/* save the destination format so we can undo the encoding later */
|
||||
RLEDestFormat *r = (RLEDestFormat *)rlebuf;
|
||||
r->BytesPerPixel = df->BytesPerPixel;
|
||||
r->bytes_per_pixel = df->bytes_per_pixel;
|
||||
r->Rmask = df->Rmask;
|
||||
r->Gmask = df->Gmask;
|
||||
r->Bmask = df->Bmask;
|
||||
@@ -1112,7 +1112,7 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||
|
||||
/* opaque counts are 8 or 16 bits, depending on target depth */
|
||||
#define ADD_OPAQUE_COUNTS(n, m) \
|
||||
if (df->BytesPerPixel == 4) { \
|
||||
if (df->bytes_per_pixel == 4) { \
|
||||
((Uint16 *)dst)[0] = (Uint16)n; \
|
||||
((Uint16 *)dst)[1] = (Uint16)m; \
|
||||
dst += 4; \
|
||||
@@ -1272,7 +1272,7 @@ static int RLEColorkeySurface(SDL_Surface *surface)
|
||||
int y;
|
||||
Uint8 *srcbuf, *lastline;
|
||||
int maxsize = 0;
|
||||
const int bpp = surface->format->BytesPerPixel;
|
||||
const int bpp = surface->format->bytes_per_pixel;
|
||||
getpix_func getpix;
|
||||
Uint32 ckey, rgbmask;
|
||||
int w, h;
|
||||
@@ -1413,7 +1413,7 @@ int SDL_RLESurface(SDL_Surface *surface)
|
||||
}
|
||||
|
||||
/* We don't support RLE encoding of bitmaps */
|
||||
if (surface->format->BitsPerPixel < 8) {
|
||||
if (surface->format->bits_per_pixel < 8) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1481,7 +1481,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface)
|
||||
int (*uncopy_transl)(Uint32 *, void *, int,
|
||||
RLEDestFormat *, SDL_PixelFormat *);
|
||||
int w = surface->w;
|
||||
int bpp = df->BytesPerPixel;
|
||||
int bpp = df->bytes_per_pixel;
|
||||
size_t size;
|
||||
|
||||
if (bpp == 2) {
|
||||
|
||||
@@ -66,20 +66,20 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
/* Set up the blit information */
|
||||
info->src = (Uint8 *)src->pixels +
|
||||
(Uint16)srcrect->y * src->pitch +
|
||||
(Uint16)srcrect->x * info->src_fmt->BytesPerPixel;
|
||||
(Uint16)srcrect->x * info->src_fmt->bytes_per_pixel;
|
||||
info->src_w = srcrect->w;
|
||||
info->src_h = srcrect->h;
|
||||
info->src_pitch = src->pitch;
|
||||
info->src_skip =
|
||||
info->src_pitch - info->src_w * info->src_fmt->BytesPerPixel;
|
||||
info->src_pitch - info->src_w * info->src_fmt->bytes_per_pixel;
|
||||
info->dst =
|
||||
(Uint8 *)dst->pixels + (Uint16)dstrect->y * dst->pitch +
|
||||
(Uint16)dstrect->x * info->dst_fmt->BytesPerPixel;
|
||||
(Uint16)dstrect->x * info->dst_fmt->bytes_per_pixel;
|
||||
info->dst_w = dstrect->w;
|
||||
info->dst_h = dstrect->h;
|
||||
info->dst_pitch = dst->pitch;
|
||||
info->dst_skip =
|
||||
info->dst_pitch - info->dst_w * info->dst_fmt->BytesPerPixel;
|
||||
info->dst_pitch - info->dst_w * info->dst_fmt->bytes_per_pixel;
|
||||
RunBlit = (SDL_BlitFunc)src->map->data;
|
||||
|
||||
/* Run the actual software blit */
|
||||
@@ -200,7 +200,7 @@ int SDL_CalculateBlit(SDL_Surface *surface)
|
||||
}
|
||||
|
||||
/* We don't currently support blitting to < 8 bpp surfaces */
|
||||
if (dst->format->BitsPerPixel < 8) {
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
SDL_InvalidateMap(map);
|
||||
return SDL_SetError("Blit combination not supported");
|
||||
}
|
||||
@@ -232,8 +232,8 @@ int SDL_CalculateBlit(SDL_Surface *surface)
|
||||
/* Choose a standard blit function */
|
||||
if (!blit) {
|
||||
if (src_colorspace != dst_colorspace ||
|
||||
surface->format->BytesPerPixel > 4 ||
|
||||
dst->format->BytesPerPixel > 4) {
|
||||
surface->format->bytes_per_pixel > 4 ||
|
||||
dst->format->bytes_per_pixel > 4) {
|
||||
blit = SDL_Blit_Slow_Float;
|
||||
}
|
||||
}
|
||||
@@ -244,13 +244,13 @@ int SDL_CalculateBlit(SDL_Surface *surface)
|
||||
blit = SDL_Blit_Slow;
|
||||
}
|
||||
#if SDL_HAVE_BLIT_0
|
||||
else if (surface->format->BitsPerPixel < 8 &&
|
||||
else if (surface->format->bits_per_pixel < 8 &&
|
||||
SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||
blit = SDL_CalculateBlit0(surface);
|
||||
}
|
||||
#endif
|
||||
#if SDL_HAVE_BLIT_1
|
||||
else if (surface->format->BytesPerPixel == 1 &&
|
||||
else if (surface->format->bytes_per_pixel == 1 &&
|
||||
SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||
blit = SDL_CalculateBlit1(surface);
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ SDL_FORCE_INLINE void BlitBtoNAlpha(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
const unsigned A = info->a;
|
||||
|
||||
/* Set up some basic variables */
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -703,7 +703,7 @@ SDL_FORCE_INLINE void BlitBtoNAlphaKey(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||
Uint32 ckey = info->colorkey;
|
||||
|
||||
/* Set up some basic variables */
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
if (srcbpp == 4)
|
||||
srcskip += width - (width + 1) / 2;
|
||||
else if (srcbpp == 2)
|
||||
@@ -920,10 +920,10 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface)
|
||||
{
|
||||
int which;
|
||||
|
||||
if (surface->map->dst->format->BitsPerPixel < 8) {
|
||||
if (surface->map->dst->format->bits_per_pixel < 8) {
|
||||
which = 0;
|
||||
} else {
|
||||
which = surface->map->dst->format->BytesPerPixel;
|
||||
which = surface->map->dst->format->bytes_per_pixel;
|
||||
}
|
||||
|
||||
if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX1) {
|
||||
|
||||
@@ -440,7 +440,7 @@ static void Blit1toNAlpha(SDL_BlitInfo *info)
|
||||
const unsigned A = info->a;
|
||||
|
||||
/* Set up some basic variables */
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
@@ -481,7 +481,7 @@ static void Blit1toNAlphaKey(SDL_BlitInfo *info)
|
||||
const unsigned A = info->a;
|
||||
|
||||
/* Set up some basic variables */
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
@@ -520,10 +520,10 @@ SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface *surface)
|
||||
SDL_PixelFormat *dstfmt;
|
||||
|
||||
dstfmt = surface->map->dst->format;
|
||||
if (dstfmt->BitsPerPixel < 8) {
|
||||
if (dstfmt->bits_per_pixel < 8) {
|
||||
which = 0;
|
||||
} else {
|
||||
which = dstfmt->BytesPerPixel;
|
||||
which = dstfmt->bytes_per_pixel;
|
||||
}
|
||||
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||
case 0:
|
||||
|
||||
@@ -38,7 +38,7 @@ static void BlitNto1SurfaceAlpha(SDL_BlitInfo *info)
|
||||
Uint8 *palmap = info->table;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB;
|
||||
unsigned dR, dG, dB;
|
||||
@@ -84,7 +84,7 @@ static void BlitNto1PixelAlpha(SDL_BlitInfo *info)
|
||||
Uint8 *palmap = info->table;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB, sA;
|
||||
unsigned dR, dG, dB;
|
||||
@@ -129,7 +129,7 @@ static void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info)
|
||||
Uint8 *palmap = info->table;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
Uint32 ckey = info->colorkey;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB;
|
||||
@@ -1208,8 +1208,8 @@ static void BlitNtoNSurfaceAlpha(SDL_BlitInfo *info)
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB;
|
||||
unsigned dR, dG, dB, dA;
|
||||
@@ -1247,8 +1247,8 @@ static void BlitNtoNSurfaceAlphaKey(SDL_BlitInfo *info)
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
Uint32 ckey = info->colorkey;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB;
|
||||
unsigned dR, dG, dB, dA;
|
||||
@@ -1293,8 +1293,8 @@ static void BlitNtoNPixelAlpha(SDL_BlitInfo *info)
|
||||
unsigned dR, dG, dB, dA;
|
||||
|
||||
/* Set up some basic variables */
|
||||
srcbpp = srcfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */ /* clang-format off */
|
||||
@@ -1324,7 +1324,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||
case SDL_COPY_BLEND:
|
||||
/* Per-pixel alpha blits */
|
||||
switch (df->BytesPerPixel) {
|
||||
switch (df->bytes_per_pixel) {
|
||||
case 1:
|
||||
if (df->palette) {
|
||||
return BlitNto1PixelAlpha;
|
||||
@@ -1335,7 +1335,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
|
||||
case 2:
|
||||
#if defined(SDL_ARM_NEON_BLITTERS) || defined(SDL_ARM_SIMD_BLITTERS)
|
||||
if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && df->Gmask == 0x7e0 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
|
||||
if (sf->bytes_per_pixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && df->Gmask == 0x7e0 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
|
||||
#ifdef SDL_ARM_NEON_BLITTERS
|
||||
if (SDL_HasNEON()) {
|
||||
return BlitARGBto565PixelAlphaARMNEON;
|
||||
@@ -1348,7 +1348,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
if (sf->BytesPerPixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
|
||||
if (sf->bytes_per_pixel == 4 && sf->Amask == 0xff000000 && sf->Gmask == 0xff00 && ((sf->Rmask == 0xff && df->Rmask == 0x1f) || (sf->Bmask == 0xff && df->Bmask == 0x1f))) {
|
||||
if (df->Gmask == 0x7e0) {
|
||||
return BlitARGBto565PixelAlpha;
|
||||
} else if (df->Gmask == 0x3e0) {
|
||||
@@ -1358,7 +1358,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
return BlitNtoNPixelAlpha;
|
||||
|
||||
case 4:
|
||||
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
||||
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->bytes_per_pixel == 4) {
|
||||
#ifdef SDL_MMX_INTRINSICS
|
||||
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
|
||||
if (SDL_HasMMX()) {
|
||||
@@ -1379,7 +1379,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
#endif
|
||||
return BlitRGBtoRGBPixelAlpha;
|
||||
}
|
||||
} else if (sf->Rmask == df->Bmask && sf->Gmask == df->Gmask && sf->Bmask == df->Rmask && sf->BytesPerPixel == 4) {
|
||||
} else if (sf->Rmask == df->Bmask && sf->Gmask == df->Gmask && sf->Bmask == df->Rmask && sf->bytes_per_pixel == 4) {
|
||||
if (sf->Amask == 0xff000000) {
|
||||
return BlitRGBtoBGRPixelAlpha;
|
||||
}
|
||||
@@ -1395,7 +1395,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||
if (sf->Amask == 0) {
|
||||
/* Per-surface alpha blits */
|
||||
switch (df->BytesPerPixel) {
|
||||
switch (df->bytes_per_pixel) {
|
||||
case 1:
|
||||
if (df->palette) {
|
||||
return BlitNto1SurfaceAlpha;
|
||||
@@ -1429,7 +1429,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
return BlitNtoNSurfaceAlpha;
|
||||
|
||||
case 4:
|
||||
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->BytesPerPixel == 4) {
|
||||
if (sf->Rmask == df->Rmask && sf->Gmask == df->Gmask && sf->Bmask == df->Bmask && sf->bytes_per_pixel == 4) {
|
||||
#ifdef SDL_MMX_INTRINSICS
|
||||
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) {
|
||||
return BlitRGBtoRGBSurfaceAlphaMMX;
|
||||
@@ -1450,7 +1450,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||
|
||||
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||
if (sf->Amask == 0) {
|
||||
if (df->BytesPerPixel == 1) {
|
||||
if (df->bytes_per_pixel == 1) {
|
||||
|
||||
if (df->palette) {
|
||||
return BlitNto1SurfaceAlphaKey;
|
||||
|
||||
@@ -345,8 +345,8 @@ static void Blit_RGB565_32Altivec(SDL_BlitInfo *info)
|
||||
vector unsigned char vgreen2 =
|
||||
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
||||
|
||||
SDL_assert(srcfmt->BytesPerPixel == 2);
|
||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
||||
SDL_assert(srcfmt->bytes_per_pixel == 2);
|
||||
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||
|
||||
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
||||
@@ -483,8 +483,8 @@ static void Blit_RGB555_32Altivec(SDL_BlitInfo *info)
|
||||
vector unsigned char vgreen2 =
|
||||
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
||||
|
||||
SDL_assert(srcfmt->BytesPerPixel == 2);
|
||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
||||
SDL_assert(srcfmt->bytes_per_pixel == 2);
|
||||
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||
|
||||
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
||||
@@ -581,9 +581,9 @@ static void Blit32to32KeyAltivec(SDL_BlitInfo *info)
|
||||
Uint32 *dstp = (Uint32 *)info->dst;
|
||||
int dstskip = info->dst_skip / 4;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
|
||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
||||
@@ -714,8 +714,8 @@ static void ConvertAltivec32to32_noprefetch(SDL_BlitInfo *info)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert(srcfmt->BytesPerPixel == 4);
|
||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
||||
SDL_assert(srcfmt->bytes_per_pixel == 4);
|
||||
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
/* reorder bytes for PowerPC little endian */
|
||||
@@ -800,8 +800,8 @@ static void ConvertAltivec32to32_prefetch(SDL_BlitInfo *info)
|
||||
}
|
||||
}
|
||||
|
||||
SDL_assert(srcfmt->BytesPerPixel == 4);
|
||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
||||
SDL_assert(srcfmt->bytes_per_pixel == 4);
|
||||
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
/* reorder bytes for PowerPC little endian */
|
||||
@@ -2107,7 +2107,7 @@ static void BlitNto1(SDL_BlitInfo *info)
|
||||
dstskip = info->dst_skip;
|
||||
map = info->table;
|
||||
srcfmt = info->src_fmt;
|
||||
srcbpp = srcfmt->BytesPerPixel;
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
|
||||
if (!map) {
|
||||
while (height--) {
|
||||
@@ -2232,8 +2232,8 @@ static void get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt,
|
||||
int Pixel = 0x04030201; /* identity permutation */
|
||||
#else
|
||||
int Pixel = 0x01020304; /* identity permutation */
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
#endif
|
||||
|
||||
if (srcfmt->Amask) {
|
||||
@@ -2319,9 +2319,9 @@ static void BlitNtoN(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||
|
||||
#if HAVE_FAST_WRITE_INT8
|
||||
@@ -2437,9 +2437,9 @@ static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
int c;
|
||||
|
||||
#if HAVE_FAST_WRITE_INT8
|
||||
@@ -2502,7 +2502,7 @@ static void BlitNto1Key(SDL_BlitInfo *info)
|
||||
unsigned sR, sG, sB;
|
||||
|
||||
/* Set up some basic variables */
|
||||
srcbpp = srcfmt->BytesPerPixel;
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
ckey &= rgbmask;
|
||||
|
||||
if (!palmap) {
|
||||
@@ -2594,8 +2594,8 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
|
||||
Uint32 ckey = info->colorkey;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||
Uint32 rgbmask = ~srcfmt->Amask;
|
||||
int sfmt = srcfmt->format;
|
||||
@@ -2873,8 +2873,8 @@ static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
|
||||
unsigned sR, sG, sB, sA;
|
||||
|
||||
/* Set up some basic variables */
|
||||
srcbpp = srcfmt->BytesPerPixel;
|
||||
dstbpp = dstfmt->BytesPerPixel;
|
||||
srcbpp = srcfmt->bytes_per_pixel;
|
||||
dstbpp = dstfmt->bytes_per_pixel;
|
||||
ckey &= rgbmask;
|
||||
|
||||
/* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
|
||||
@@ -2966,7 +2966,7 @@ static void Blit2101010toN(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB, sA;
|
||||
|
||||
@@ -2997,7 +2997,7 @@ static void BlitNto2101010(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
Uint32 Pixel;
|
||||
unsigned sR, sG, sB, sA;
|
||||
|
||||
@@ -3028,9 +3028,9 @@ static void Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
|
||||
if (dstfmt->Amask) {
|
||||
/* SET_ALPHA */
|
||||
@@ -3101,9 +3101,9 @@ static void Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo *info)
|
||||
Uint8 *dst = info->dst;
|
||||
int dstskip = info->dst_skip;
|
||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||
int srcbpp = srcfmt->BytesPerPixel;
|
||||
int srcbpp = srcfmt->bytes_per_pixel;
|
||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||
int dstbpp = dstfmt->BytesPerPixel;
|
||||
int dstbpp = dstfmt->bytes_per_pixel;
|
||||
|
||||
if (dstfmt->Amask) {
|
||||
if (srcfmt->Amask) {
|
||||
@@ -3347,20 +3347,20 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
dstfmt = surface->map->dst->format;
|
||||
|
||||
/* We don't support destinations less than 8-bits */
|
||||
if (dstfmt->BitsPerPixel < 8) {
|
||||
if (dstfmt->bits_per_pixel < 8) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||
case 0:
|
||||
blitfun = NULL;
|
||||
if (dstfmt->BitsPerPixel == 8) {
|
||||
if ((srcfmt->BytesPerPixel == 4) &&
|
||||
if (dstfmt->bits_per_pixel == 8) {
|
||||
if ((srcfmt->bytes_per_pixel == 4) &&
|
||||
(srcfmt->Rmask == 0x00FF0000) &&
|
||||
(srcfmt->Gmask == 0x0000FF00) &&
|
||||
(srcfmt->Bmask == 0x000000FF)) {
|
||||
blitfun = Blit_XRGB8888_index8;
|
||||
} else if ((srcfmt->BytesPerPixel == 4) &&
|
||||
} else if ((srcfmt->bytes_per_pixel == 4) &&
|
||||
(srcfmt->Rmask == 0x3FF00000) &&
|
||||
(srcfmt->Gmask == 0x000FFC00) &&
|
||||
(srcfmt->Bmask == 0x000003FF)) {
|
||||
@@ -3374,9 +3374,9 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
if (dstfmt->Amask) {
|
||||
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
|
||||
}
|
||||
if (srcfmt->BytesPerPixel > 0 &&
|
||||
srcfmt->BytesPerPixel <= SDL_arraysize(normal_blit)) {
|
||||
table = normal_blit[srcfmt->BytesPerPixel - 1];
|
||||
if (srcfmt->bytes_per_pixel > 0 &&
|
||||
srcfmt->bytes_per_pixel <= SDL_arraysize(normal_blit)) {
|
||||
table = normal_blit[srcfmt->bytes_per_pixel - 1];
|
||||
for (which = 0; table[which].dstbpp; ++which) {
|
||||
if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
|
||||
MASKOK(srcfmt->Gmask, table[which].srcG) &&
|
||||
@@ -3384,7 +3384,7 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
MASKOK(dstfmt->Rmask, table[which].dstR) &&
|
||||
MASKOK(dstfmt->Gmask, table[which].dstG) &&
|
||||
MASKOK(dstfmt->Bmask, table[which].dstB) &&
|
||||
dstfmt->BytesPerPixel == table[which].dstbpp &&
|
||||
dstfmt->bytes_per_pixel == table[which].dstbpp &&
|
||||
(a_need & table[which].alpha) == a_need &&
|
||||
((table[which].blit_features & GetBlitFeatures()) ==
|
||||
table[which].blit_features)) {
|
||||
@@ -3399,8 +3399,8 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
blitfun = Blit2101010toN;
|
||||
} else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
blitfun = BlitNto2101010;
|
||||
} else if (srcfmt->BytesPerPixel == 4 &&
|
||||
dstfmt->BytesPerPixel == 4 &&
|
||||
} else if (srcfmt->bytes_per_pixel == 4 &&
|
||||
dstfmt->bytes_per_pixel == 4 &&
|
||||
srcfmt->Rmask == dstfmt->Rmask &&
|
||||
srcfmt->Gmask == dstfmt->Gmask &&
|
||||
srcfmt->Bmask == dstfmt->Bmask) {
|
||||
@@ -3427,13 +3427,13 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||
because RLE is the preferred fast way to deal with this.
|
||||
If a particular case turns out to be useful we'll add it. */
|
||||
|
||||
if (srcfmt->BytesPerPixel == 2 && surface->map->identity != 0) {
|
||||
if (srcfmt->bytes_per_pixel == 2 && surface->map->identity != 0) {
|
||||
return Blit2to2Key;
|
||||
} else if (dstfmt->BytesPerPixel == 1) {
|
||||
} else if (dstfmt->bytes_per_pixel == 1) {
|
||||
return BlitNto1Key;
|
||||
} else {
|
||||
#ifdef SDL_ALTIVEC_BLITTERS
|
||||
if ((srcfmt->BytesPerPixel == 4) && (dstfmt->BytesPerPixel == 4) && SDL_HasAltiVec()) {
|
||||
if ((srcfmt->bytes_per_pixel == 4) && (dstfmt->bytes_per_pixel == 4) && SDL_HasAltiVec()) {
|
||||
return Blit32to32KeyAltivec;
|
||||
} else
|
||||
#endif
|
||||
|
||||
@@ -104,7 +104,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info)
|
||||
int w, h;
|
||||
int srcskip, dstskip;
|
||||
|
||||
w = info->dst_w * info->dst_fmt->BytesPerPixel;
|
||||
w = info->dst_w * info->dst_fmt->bytes_per_pixel;
|
||||
h = info->dst_h;
|
||||
src = info->src;
|
||||
dst = info->dst;
|
||||
|
||||
@@ -34,7 +34,7 @@ typedef enum
|
||||
|
||||
static SlowBlitPixelAccess GetPixelAccessMethod(SDL_PixelFormat *pf)
|
||||
{
|
||||
if (pf->BytesPerPixel > 4) {
|
||||
if (pf->bytes_per_pixel > 4) {
|
||||
return SlowBlitPixelAccess_Large;
|
||||
} else if (SDL_ISPIXELFORMAT_10BIT(pf->format)) {
|
||||
return SlowBlitPixelAccess_10Bit;
|
||||
@@ -64,8 +64,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||
Uint64 incy, incx;
|
||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||
int srcbpp = src_fmt->BytesPerPixel;
|
||||
int dstbpp = dst_fmt->BytesPerPixel;
|
||||
int srcbpp = src_fmt->bytes_per_pixel;
|
||||
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||
SlowBlitPixelAccess src_access;
|
||||
SlowBlitPixelAccess dst_access;
|
||||
Uint32 rgbmask = ~src_fmt->Amask;
|
||||
@@ -380,14 +380,14 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||
|
||||
switch (access) {
|
||||
case SlowBlitPixelAccess_RGB:
|
||||
DISEMBLE_RGB(pixels, fmt->BytesPerPixel, fmt, pixel, R, G, B);
|
||||
DISEMBLE_RGB(pixels, fmt->bytes_per_pixel, fmt, pixel, R, G, B);
|
||||
fR = (float)R / 255.0f;
|
||||
fG = (float)G / 255.0f;
|
||||
fB = (float)B / 255.0f;
|
||||
fA = 1.0f;
|
||||
break;
|
||||
case SlowBlitPixelAccess_RGBA:
|
||||
DISEMBLE_RGBA(pixels, fmt->BytesPerPixel, fmt, pixel, R, G, B, A);
|
||||
DISEMBLE_RGBA(pixels, fmt->bytes_per_pixel, fmt, pixel, R, G, B, A);
|
||||
fR = (float)R / 255.0f;
|
||||
fG = (float)G / 255.0f;
|
||||
fB = (float)B / 255.0f;
|
||||
@@ -421,7 +421,7 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||
v[0] = (float)(((Uint16 *)pixels)[0]) / SDL_MAX_UINT16;
|
||||
v[1] = (float)(((Uint16 *)pixels)[1]) / SDL_MAX_UINT16;
|
||||
v[2] = (float)(((Uint16 *)pixels)[2]) / SDL_MAX_UINT16;
|
||||
if (fmt->BytesPerPixel == 8) {
|
||||
if (fmt->bytes_per_pixel == 8) {
|
||||
v[3] = (float)(((Uint16 *)pixels)[3]) / SDL_MAX_UINT16;
|
||||
} else {
|
||||
v[3] = 1.0f;
|
||||
@@ -431,7 +431,7 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||
v[0] = half_to_float(((Uint16 *)pixels)[0]);
|
||||
v[1] = half_to_float(((Uint16 *)pixels)[1]);
|
||||
v[2] = half_to_float(((Uint16 *)pixels)[2]);
|
||||
if (fmt->BytesPerPixel == 8) {
|
||||
if (fmt->bytes_per_pixel == 8) {
|
||||
v[3] = half_to_float(((Uint16 *)pixels)[3]);
|
||||
} else {
|
||||
v[3] = 1.0f;
|
||||
@@ -441,7 +441,7 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||
v[0] = ((float *)pixels)[0];
|
||||
v[1] = ((float *)pixels)[1];
|
||||
v[2] = ((float *)pixels)[2];
|
||||
if (fmt->BytesPerPixel == 16) {
|
||||
if (fmt->bytes_per_pixel == 16) {
|
||||
v[3] = ((float *)pixels)[3];
|
||||
} else {
|
||||
v[3] = 1.0f;
|
||||
@@ -560,14 +560,14 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||
R = (Uint8)SDL_roundf(SDL_clamp(fR, 0.0f, 1.0f) * 255.0f);
|
||||
G = (Uint8)SDL_roundf(SDL_clamp(fG, 0.0f, 1.0f) * 255.0f);
|
||||
B = (Uint8)SDL_roundf(SDL_clamp(fB, 0.0f, 1.0f) * 255.0f);
|
||||
ASSEMBLE_RGB(pixels, fmt->BytesPerPixel, fmt, R, G, B);
|
||||
ASSEMBLE_RGB(pixels, fmt->bytes_per_pixel, fmt, R, G, B);
|
||||
break;
|
||||
case SlowBlitPixelAccess_RGBA:
|
||||
R = (Uint8)SDL_roundf(SDL_clamp(fR, 0.0f, 1.0f) * 255.0f);
|
||||
G = (Uint8)SDL_roundf(SDL_clamp(fG, 0.0f, 1.0f) * 255.0f);
|
||||
B = (Uint8)SDL_roundf(SDL_clamp(fB, 0.0f, 1.0f) * 255.0f);
|
||||
A = (Uint8)SDL_roundf(SDL_clamp(fA, 0.0f, 1.0f) * 255.0f);
|
||||
ASSEMBLE_RGBA(pixels, fmt->BytesPerPixel, fmt, R, G, B, A);
|
||||
ASSEMBLE_RGBA(pixels, fmt->bytes_per_pixel, fmt, R, G, B, A);
|
||||
break;
|
||||
case SlowBlitPixelAccess_10Bit:
|
||||
{
|
||||
@@ -640,7 +640,7 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||
((Uint16 *)pixels)[0] = (Uint16)SDL_roundf(SDL_clamp(v[0], 0.0f, 1.0f) * SDL_MAX_UINT16);
|
||||
((Uint16 *)pixels)[1] = (Uint16)SDL_roundf(SDL_clamp(v[1], 0.0f, 1.0f) * SDL_MAX_UINT16);
|
||||
((Uint16 *)pixels)[2] = (Uint16)SDL_roundf(SDL_clamp(v[2], 0.0f, 1.0f) * SDL_MAX_UINT16);
|
||||
if (fmt->BytesPerPixel == 8) {
|
||||
if (fmt->bytes_per_pixel == 8) {
|
||||
((Uint16 *)pixels)[3] = (Uint16)SDL_roundf(SDL_clamp(v[3], 0.0f, 1.0f) * SDL_MAX_UINT16);
|
||||
}
|
||||
break;
|
||||
@@ -648,7 +648,7 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||
((Uint16 *)pixels)[0] = float_to_half(v[0]);
|
||||
((Uint16 *)pixels)[1] = float_to_half(v[1]);
|
||||
((Uint16 *)pixels)[2] = float_to_half(v[2]);
|
||||
if (fmt->BytesPerPixel == 8) {
|
||||
if (fmt->bytes_per_pixel == 8) {
|
||||
((Uint16 *)pixels)[3] = float_to_half(v[3]);
|
||||
}
|
||||
break;
|
||||
@@ -656,7 +656,7 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||
((float *)pixels)[0] = v[0];
|
||||
((float *)pixels)[1] = v[1];
|
||||
((float *)pixels)[2] = v[2];
|
||||
if (fmt->BytesPerPixel == 16) {
|
||||
if (fmt->bytes_per_pixel == 16) {
|
||||
((float *)pixels)[3] = v[3];
|
||||
}
|
||||
break;
|
||||
@@ -725,8 +725,8 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
|
||||
Uint64 incy, incx;
|
||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||
int srcbpp = src_fmt->BytesPerPixel;
|
||||
int dstbpp = dst_fmt->BytesPerPixel;
|
||||
int srcbpp = src_fmt->bytes_per_pixel;
|
||||
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||
SlowBlitPixelAccess src_access;
|
||||
SlowBlitPixelAccess dst_access;
|
||||
SDL_Colorspace src_colorspace;
|
||||
|
||||
@@ -639,7 +639,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
|
||||
#ifdef SAVE_32BIT_BMP
|
||||
/* We can save alpha information in a 32-bit BMP */
|
||||
if (surface->format->BitsPerPixel >= 8 &&
|
||||
if (surface->format->bits_per_pixel >= 8 &&
|
||||
(surface->format->Amask != 0 ||
|
||||
surface->map->info.flags & SDL_COPY_COLORKEY)) {
|
||||
save32bit = SDL_TRUE;
|
||||
@@ -647,14 +647,14 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
#endif /* SAVE_32BIT_BMP */
|
||||
|
||||
if (surface->format->palette && !save32bit) {
|
||||
if (surface->format->BitsPerPixel == 8) {
|
||||
if (surface->format->bits_per_pixel == 8) {
|
||||
intermediate_surface = surface;
|
||||
} else {
|
||||
SDL_SetError("%u bpp BMP files not supported",
|
||||
surface->format->BitsPerPixel);
|
||||
surface->format->bits_per_pixel);
|
||||
goto done;
|
||||
}
|
||||
} else if ((surface->format->BitsPerPixel == 24) && !save32bit &&
|
||||
} else if ((surface->format->bits_per_pixel == 24) && !save32bit &&
|
||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||
(surface->format->Rmask == 0x00FF0000) &&
|
||||
(surface->format->Gmask == 0x0000FF00) &&
|
||||
@@ -694,7 +694,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
}
|
||||
|
||||
if (SDL_LockSurface(intermediate_surface) == 0) {
|
||||
const size_t bw = intermediate_surface->w * intermediate_surface->format->BytesPerPixel;
|
||||
const size_t bw = intermediate_surface->w * intermediate_surface->format->bytes_per_pixel;
|
||||
|
||||
/* Set the BMP file header values */
|
||||
bfSize = 0; /* We'll write this when we're done */
|
||||
@@ -720,7 +720,7 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||
biWidth = intermediate_surface->w;
|
||||
biHeight = intermediate_surface->h;
|
||||
biPlanes = 1;
|
||||
biBitCount = intermediate_surface->format->BitsPerPixel;
|
||||
biBitCount = intermediate_surface->format->bits_per_pixel;
|
||||
biCompression = BI_RGB;
|
||||
biSizeImage = intermediate_surface->h * intermediate_surface->pitch;
|
||||
biXPelsPerMeter = 0;
|
||||
|
||||
@@ -325,11 +325,11 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
/* This function doesn't usually work on surfaces < 8 bpp
|
||||
* Except: support for 4bits, when filling full size.
|
||||
*/
|
||||
if (dst->format->BitsPerPixel < 8) {
|
||||
if (dst->format->bits_per_pixel < 8) {
|
||||
if (count == 1) {
|
||||
const SDL_Rect *r = &rects[0];
|
||||
if (r->x == 0 && r->y == 0 && r->w == dst->w && r->h == dst->h) {
|
||||
if (dst->format->BitsPerPixel == 4) {
|
||||
if (dst->format->bits_per_pixel == 4) {
|
||||
Uint8 b = (((Uint8)color << 4) | (Uint8)color);
|
||||
SDL_memset(dst->pixels, b, (size_t)dst->h * dst->pitch);
|
||||
return 1;
|
||||
@@ -340,8 +340,8 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
}
|
||||
|
||||
#ifdef SDL_ARM_NEON_BLITTERS
|
||||
if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && !fill_function) {
|
||||
switch (dst->format->BytesPerPixel) {
|
||||
if (SDL_HasNEON() && dst->format->bytes_per_pixel != 3 && !fill_function) {
|
||||
switch (dst->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
fill_function = fill_8_neon;
|
||||
break;
|
||||
@@ -355,8 +355,8 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
}
|
||||
#endif
|
||||
#ifdef SDL_ARM_SIMD_BLITTERS
|
||||
if (SDL_HasARMSIMD() && dst->format->BytesPerPixel != 3 && !fill_function) {
|
||||
switch (dst->format->BytesPerPixel) {
|
||||
if (SDL_HasARMSIMD() && dst->format->bytes_per_pixel != 3 && !fill_function) {
|
||||
switch (dst->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
fill_function = fill_8_simd;
|
||||
break;
|
||||
@@ -371,7 +371,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
#endif
|
||||
|
||||
if (!fill_function) {
|
||||
switch (dst->format->BytesPerPixel) {
|
||||
switch (dst->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
{
|
||||
color |= (color << 8);
|
||||
@@ -432,7 +432,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||
rect = &clipped;
|
||||
|
||||
pixels = (Uint8 *)dst->pixels + rect->y * dst->pitch +
|
||||
rect->x * dst->format->BytesPerPixel;
|
||||
rect->x * dst->format->bytes_per_pixel;
|
||||
|
||||
fill_function(pixels, dst->pitch, color, rect->w, rect->h);
|
||||
}
|
||||
|
||||
@@ -598,8 +598,8 @@ int SDL_InitFormat(SDL_PixelFormat *format, Uint32 pixel_format)
|
||||
/* Set up the format */
|
||||
SDL_zerop(format);
|
||||
format->format = pixel_format;
|
||||
format->BitsPerPixel = (Uint8)bpp;
|
||||
format->BytesPerPixel = (Uint8)((bpp + 7) / 8);
|
||||
format->bits_per_pixel = (Uint8)bpp;
|
||||
format->bytes_per_pixel = (Uint8)((bpp + 7) / 8);
|
||||
|
||||
format->Rmask = Rmask;
|
||||
format->Rshift = 0;
|
||||
@@ -1047,7 +1047,7 @@ int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette)
|
||||
return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format");
|
||||
}
|
||||
|
||||
if (palette && palette->ncolors > (1 << format->BitsPerPixel)) {
|
||||
if (palette && palette->ncolors > (1 << format->bits_per_pixel)) {
|
||||
return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format");
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ static Uint8 *Map1toN(SDL_PixelFormat *src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod,
|
||||
int bpp;
|
||||
SDL_Palette *pal = src->palette;
|
||||
|
||||
bpp = ((dst->BytesPerPixel == 3) ? 4 : dst->BytesPerPixel);
|
||||
bpp = ((dst->bytes_per_pixel == 3) ? 4 : dst->bytes_per_pixel);
|
||||
map = (Uint8 *)SDL_calloc(256, bpp);
|
||||
if (!map) {
|
||||
return NULL;
|
||||
@@ -1337,7 +1337,8 @@ static Uint8 *Map1toN(SDL_PixelFormat *src, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod,
|
||||
Uint8 G = (Uint8)((pal->colors[i].g * Gmod) / 255);
|
||||
Uint8 B = (Uint8)((pal->colors[i].b * Bmod) / 255);
|
||||
Uint8 A = (Uint8)((pal->colors[i].a * Amod) / 255);
|
||||
ASSEMBLE_RGBA(&map[i * bpp], dst->BytesPerPixel, dst, (Uint32)R, (Uint32)G, (Uint32)B, (Uint32)A);
|
||||
ASSEMBLE_RGBA(&map[i * bpp], dst->bytes_per_pixel, dst, (Uint32)R,
|
||||
(Uint32)G, (Uint32)B, (Uint32)A);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
@@ -1433,7 +1434,7 @@ int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (srcfmt->BitsPerPixel != dstfmt->BitsPerPixel) {
|
||||
if (srcfmt->bits_per_pixel != dstfmt->bits_per_pixel) {
|
||||
map->identity = 0;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
}
|
||||
|
||||
if (scaleMode == SDL_SCALEMODE_LINEAR) {
|
||||
if (src->format->BytesPerPixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
if (src->format->bytes_per_pixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
return SDL_SetError("Wrong format");
|
||||
}
|
||||
}
|
||||
@@ -929,7 +929,7 @@ int SDL_LowerSoftStretchNearest(SDL_Surface *s, const SDL_Rect *srcrect,
|
||||
int src_pitch = s->pitch;
|
||||
int dst_pitch = d->pitch;
|
||||
|
||||
const int bpp = d->format->BytesPerPixel;
|
||||
const int bpp = d->format->bytes_per_pixel;
|
||||
|
||||
Uint32 *src = (Uint32 *)((Uint8 *)s->pixels + srcrect->x * bpp + srcrect->y * src_pitch);
|
||||
Uint32 *dst = (Uint32 *)((Uint8 *)d->pixels + dstrect->x * bpp + dstrect->y * dst_pitch);
|
||||
|
||||
@@ -151,7 +151,7 @@ SDL_Surface *SDL_CreateSurface(int width, int height, Uint32 format)
|
||||
|
||||
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||
SDL_Palette *palette =
|
||||
SDL_CreatePalette((1 << surface->format->BitsPerPixel));
|
||||
SDL_CreatePalette((1 << surface->format->bits_per_pixel));
|
||||
if (!palette) {
|
||||
SDL_DestroySurface(surface);
|
||||
return NULL;
|
||||
@@ -423,7 +423,7 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, SDL_bool ignore_alp
|
||||
return;
|
||||
}
|
||||
|
||||
bpp = surface->format->BytesPerPixel;
|
||||
bpp = surface->format->bytes_per_pixel;
|
||||
|
||||
SDL_LockSurface(surface);
|
||||
|
||||
@@ -996,7 +996,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
if (!(src->map->info.flags & complex_copy_flags) &&
|
||||
src->format->format == dst->format->format &&
|
||||
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) &&
|
||||
src->format->BytesPerPixel == 4 &&
|
||||
src->format->bytes_per_pixel == 4 &&
|
||||
src->format->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||
/* fast path */
|
||||
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
|
||||
@@ -1021,14 +1021,14 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||
srcrect2.h = srcrect->h;
|
||||
|
||||
/* Change source format if not appropriate for scaling */
|
||||
if (src->format->BytesPerPixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
if (src->format->bytes_per_pixel != 4 || src->format->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||
SDL_Rect tmprect;
|
||||
int fmt;
|
||||
tmprect.x = 0;
|
||||
tmprect.y = 0;
|
||||
tmprect.w = src->w;
|
||||
tmprect.h = src->h;
|
||||
if (dst->format->BytesPerPixel == 4 && dst->format->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||
if (dst->format->bytes_per_pixel == 4 && dst->format->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||
fmt = dst->format->format;
|
||||
} else {
|
||||
fmt = SDL_PIXELFORMAT_ARGB8888;
|
||||
@@ -1118,7 +1118,7 @@ static int SDL_FlipSurfaceHorizontal(SDL_Surface *surface)
|
||||
Uint8 *row, *a, *b, *tmp;
|
||||
int i, j, bpp;
|
||||
|
||||
if (surface->format->BitsPerPixel < 8) {
|
||||
if (surface->format->bits_per_pixel < 8) {
|
||||
/* We could implement this if needed, but we'd have to flip sets of bits within a byte */
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ static int SDL_FlipSurfaceHorizontal(SDL_Surface *surface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bpp = surface->format->BytesPerPixel;
|
||||
bpp = surface->format->bytes_per_pixel;
|
||||
row = (Uint8 *)surface->pixels;
|
||||
tmp = SDL_small_alloc(Uint8, surface->pitch, &isstack);
|
||||
for (i = surface->h; i--; ) {
|
||||
@@ -1419,7 +1419,7 @@ static SDL_Surface *SDL_ConvertSurfaceWithPixelFormatAndColorspace(SDL_Surface *
|
||||
}
|
||||
|
||||
/* Get the converted colorkey */
|
||||
SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel);
|
||||
SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->bytes_per_pixel);
|
||||
|
||||
SDL_DestroySurface(tmp);
|
||||
SDL_DestroySurface(tmp2);
|
||||
@@ -1763,7 +1763,7 @@ int SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g,
|
||||
a = &unused;
|
||||
}
|
||||
|
||||
bytes_per_pixel = surface->format->BytesPerPixel;
|
||||
bytes_per_pixel = surface->format->bytes_per_pixel;
|
||||
|
||||
if (SDL_MUSTLOCK(surface)) {
|
||||
SDL_LockSurface(surface);
|
||||
|
||||
@@ -330,7 +330,7 @@ struct SDL_VideoDevice
|
||||
SDL_bool (*HasPrimarySelectionText)(SDL_VideoDevice *_this);
|
||||
|
||||
/* MessageBox */
|
||||
int (*ShowMessageBox)(SDL_VideoDevice *_this, const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
int (*ShowMessageBox)(SDL_VideoDevice *_this, const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
/* Hit-testing */
|
||||
int (*SetWindowHitTest)(SDL_Window *window, SDL_bool enabled);
|
||||
@@ -455,7 +455,7 @@ typedef struct VideoBootStrap
|
||||
const char *name;
|
||||
const char *desc;
|
||||
SDL_VideoDevice *(*create)(void);
|
||||
int (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonid); /* can be done without initializing backend! */
|
||||
int (*ShowMessageBox)(const SDL_MessageBoxData *messageboxdata, int *buttonID); /* can be done without initializing backend! */
|
||||
} VideoBootStrap;
|
||||
|
||||
/* Not all of these are available in a given build. Use #ifdefs, etc. */
|
||||
|
||||
@@ -4678,7 +4678,7 @@ static void CreateMaskFromColorKeyOrAlpha(SDL_Surface *icon, Uint8 *mask, int fl
|
||||
mask[(y * ((icon->w + 7) / 8)) + (x / 8)] &= ~(0x01 << (7 - (x % 8)))
|
||||
|
||||
colorkey = icon->format->colorkey;
|
||||
switch (icon->format->BytesPerPixel) {
|
||||
switch (icon->format->bytes_per_pixel) {
|
||||
case 1:
|
||||
{
|
||||
Uint8 *pixels;
|
||||
@@ -4891,7 +4891,7 @@ int SDL_GetMessageBoxCount(void)
|
||||
#include "vita/SDL_vitamessagebox.h"
|
||||
#endif
|
||||
|
||||
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
int dummybutton;
|
||||
int retval = -1;
|
||||
@@ -4916,8 +4916,8 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
SDL_ShowCursor();
|
||||
SDL_ResetKeyboard();
|
||||
|
||||
if (!buttonid) {
|
||||
buttonid = &dummybutton;
|
||||
if (!buttonID) {
|
||||
buttonID = &dummybutton;
|
||||
}
|
||||
|
||||
SDL_memcpy(&mbdata, messageboxdata, sizeof(*messageboxdata));
|
||||
@@ -4932,7 +4932,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
SDL_ClearError();
|
||||
|
||||
if (_this && _this->ShowMessageBox) {
|
||||
retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
|
||||
retval = _this->ShowMessageBox(_this, messageboxdata, buttonID);
|
||||
} else {
|
||||
/* It's completely fine to call this function before video is initialized */
|
||||
const char *driver_name = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
|
||||
@@ -4945,7 +4945,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
for (int i = 0; bootstrap[i]; ++i) {
|
||||
if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
||||
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
||||
if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
if (bootstrap[i]->ShowMessageBox(messageboxdata, buttonID) == 0) {
|
||||
retval = 0;
|
||||
}
|
||||
break;
|
||||
@@ -4956,7 +4956,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; bootstrap[i]; ++i) {
|
||||
if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonid) == 0) {
|
||||
if (bootstrap[i]->ShowMessageBox && bootstrap[i]->ShowMessageBox(messageboxdata, buttonID) == 0) {
|
||||
retval = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -25,9 +25,9 @@
|
||||
#include "SDL_androidmessagebox.h"
|
||||
#include "../../core/android/SDL_android.h"
|
||||
|
||||
int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
return Android_JNI_ShowMessageBox(messageboxdata, buttonid);
|
||||
return Android_JNI_ShowMessageBox(messageboxdata, buttonID);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_ANDROID
|
||||
|
||||
extern int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
||||
|
||||
extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
}
|
||||
@end
|
||||
|
||||
static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue)
|
||||
static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonID, int *returnValue)
|
||||
{
|
||||
NSAlert *alert;
|
||||
const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
|
||||
@@ -118,7 +118,7 @@ static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, i
|
||||
if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
|
||||
clicked = messageboxdata->numbuttons - 1 - clicked;
|
||||
}
|
||||
*buttonid = buttons[clicked].buttonid;
|
||||
*buttonID = buttons[clicked].buttonID;
|
||||
*returnValue = 0;
|
||||
} else {
|
||||
*returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked);
|
||||
@@ -126,16 +126,16 @@ static void Cocoa_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, i
|
||||
}
|
||||
|
||||
/* Display a Cocoa message box */
|
||||
int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
@autoreleasepool {
|
||||
__block int returnValue = 0;
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||
});
|
||||
}
|
||||
return returnValue;
|
||||
|
||||
@@ -258,7 +258,7 @@ NSImage *Cocoa_CreateImage(SDL_Surface *surface)
|
||||
isPlanar:NO
|
||||
colorSpaceName:NSDeviceRGBColorSpace
|
||||
bytesPerRow:converted->pitch
|
||||
bitsPerPixel:converted->format->BitsPerPixel];
|
||||
bitsPerPixel:converted->format->bits_per_pixel];
|
||||
if (imgrep == nil) {
|
||||
SDL_DestroySurface(converted);
|
||||
return nil;
|
||||
|
||||
@@ -78,7 +78,7 @@ class HAIKU_SDL_MessageBox : public BAlert
|
||||
SortButtonsPredicate(const SDL_MessageBoxButtonData *aButtonLeft,
|
||||
const SDL_MessageBoxButtonData *aButtonRight)
|
||||
{
|
||||
return aButtonLeft->buttonid < aButtonRight->buttonid;
|
||||
return aButtonLeft->buttonID < aButtonRight->buttonID;
|
||||
}
|
||||
|
||||
alert_type
|
||||
@@ -346,10 +346,10 @@ protected:
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
// Initialize button by closed or error value first.
|
||||
*buttonid = G_CLOSE_BUTTON_ID;
|
||||
*buttonID = G_CLOSE_BUTTON_ID;
|
||||
|
||||
// We need to check "be_app" pointer to "NULL". The "messageboxdata->window" pointer isn't appropriate here
|
||||
// because it is possible to create a MessageBox from another thread. This fixes the following errors:
|
||||
@@ -382,7 +382,7 @@ int HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid
|
||||
}
|
||||
*/
|
||||
// Initialize button by real pushed value then.
|
||||
*buttonid = pushedButton;
|
||||
*buttonID = pushedButton;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
extern int
|
||||
HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void DirectDraw(SDL_VideoDevice *_this, int numrects, SDL_Rect *rects, TUint16 *
|
||||
|
||||
TInt targetStartOffset = fixedOffset.iX + rect2.x + (fixedOffset.iY + rect2.y) * targetScanlineLength;
|
||||
|
||||
switch (screen->format->BitsPerPixel) {
|
||||
switch (screen->format->bits_per_pixel) {
|
||||
case 12:
|
||||
{
|
||||
TUint16 *bitmapLine = (TUint16 *)screen->pixels + sourceStartOffset;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <kernel.h>
|
||||
#include <swis.h>
|
||||
|
||||
int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
_kernel_swi_regs regs;
|
||||
_kernel_oserror error;
|
||||
@@ -60,7 +60,7 @@ int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttoni
|
||||
|
||||
_kernel_swi(Wimp_ReportError, ®s, ®s);
|
||||
|
||||
*buttonid = (regs.r[1] == 0) ? -1 : messageboxdata->buttons[regs.r[1] - 3].buttonid;
|
||||
*buttonID = (regs.r[1] == 0) ? -1 : messageboxdata->buttons[regs.r[1] - 3].buttonID;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_RISCOS
|
||||
|
||||
extern int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
extern SDL_bool UIKit_ShowingMessageBox(void);
|
||||
|
||||
extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
||||
|
||||
@@ -49,7 +49,7 @@ static void UIKit_WaitUntilMessageBoxClosed(const SDL_MessageBoxData *messagebox
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
int i;
|
||||
int __block clickedindex = messageboxdata->numbuttons;
|
||||
@@ -120,14 +120,14 @@ static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messag
|
||||
|
||||
UIKit_ForceUpdateHomeIndicator();
|
||||
|
||||
*buttonid = messageboxdata->buttons[clickedindex].buttonid;
|
||||
*buttonID = messageboxdata->buttons[clickedindex].buttonID;
|
||||
return YES;
|
||||
}
|
||||
|
||||
static void UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid, int *returnValue)
|
||||
static void UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonID, int *returnValue)
|
||||
{
|
||||
@autoreleasepool {
|
||||
if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid)) {
|
||||
if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonID)) {
|
||||
*returnValue = 0;
|
||||
} else {
|
||||
*returnValue = SDL_SetError("Could not show message box.");
|
||||
@@ -135,16 +135,16 @@ static void UIKit_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, i
|
||||
}
|
||||
}
|
||||
|
||||
int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
@autoreleasepool {
|
||||
__block int returnValue = 0;
|
||||
|
||||
if ([NSThread isMainThread]) {
|
||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||
} else {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||
});
|
||||
}
|
||||
return returnValue;
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
#include "../../render/vitagxm/SDL_render_vita_gxm_tools.h"
|
||||
#endif /* SDL_VIDEO_RENDER_VITA_GXM */
|
||||
|
||||
int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
#ifdef SDL_VIDEO_RENDER_VITA_GXM
|
||||
SceMsgDialogParam param;
|
||||
@@ -91,17 +91,17 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
sceMsgDialogGetResult(&dialog_result);
|
||||
|
||||
if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON1) {
|
||||
*buttonid = messageboxdata->buttons[0].buttonid;
|
||||
*buttonID = messageboxdata->buttons[0].buttonID;
|
||||
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON2) {
|
||||
*buttonid = messageboxdata->buttons[1].buttonid;
|
||||
*buttonID = messageboxdata->buttons[1].buttonID;
|
||||
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON3) {
|
||||
*buttonid = messageboxdata->buttons[2].buttonid;
|
||||
*buttonID = messageboxdata->buttons[2].buttonID;
|
||||
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_YES) {
|
||||
*buttonid = messageboxdata->buttons[0].buttonid;
|
||||
*buttonID = messageboxdata->buttons[0].buttonID;
|
||||
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_NO) {
|
||||
*buttonid = messageboxdata->buttons[1].buttonid;
|
||||
*buttonID = messageboxdata->buttons[1].buttonID;
|
||||
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK) {
|
||||
*buttonid = messageboxdata->buttons[0].buttonid;
|
||||
*buttonID = messageboxdata->buttons[0].buttonID;
|
||||
}
|
||||
sceMsgDialogTerm();
|
||||
} else {
|
||||
@@ -117,7 +117,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
return 0;
|
||||
#else
|
||||
(void)messageboxdata;
|
||||
(void)buttonid;
|
||||
(void)buttonID;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_VITA
|
||||
|
||||
extern int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_VITA */
|
||||
|
||||
|
||||
@@ -43,11 +43,11 @@ struct SDL_VideoData
|
||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay)(void *context);
|
||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
|
||||
void(EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
|
||||
void(EGLAPIENTRY *fbGetDisplayInfo)(EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *BitsPerPixel);
|
||||
void(EGLAPIENTRY *fbGetDisplayInfo)(EGLNativeDisplayType Display, int *Width, int *Height, unsigned long *Physical, int *Stride, int *bits_per_pixel);
|
||||
void(EGLAPIENTRY *fbDestroyDisplay)(EGLNativeDisplayType Display);
|
||||
EGLNativeWindowType(EGLAPIENTRY *fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
|
||||
void(EGLAPIENTRY *fbGetWindowGeometry)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height);
|
||||
void(EGLAPIENTRY *fbGetWindowInfo)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *BitsPerPixel, unsigned int *Offset);
|
||||
void(EGLAPIENTRY *fbGetWindowInfo)(EGLNativeWindowType Window, int *X, int *Y, int *Width, int *Height, int *bits_per_pixel, unsigned int *Offset);
|
||||
void(EGLAPIENTRY *fbDestroyWindow)(EGLNativeWindowType Window);
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -131,7 +131,7 @@ static int get_zenity_version(int *major, int *minor)
|
||||
return -1; /* run_zenity should've called SDL_SetError() */
|
||||
}
|
||||
|
||||
int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
int fd_pipe[2]; /* fd_pipe[0]: read end of pipe, fd_pipe[1]: write end of pipe */
|
||||
int zenity_major = 0, zenity_minor = 0, output_len = 0;
|
||||
@@ -213,12 +213,12 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button
|
||||
char *output = NULL;
|
||||
char *tmp = NULL;
|
||||
|
||||
if (!buttonid) {
|
||||
/* if we don't need buttonid, we can return immediately */
|
||||
if (!buttonID) {
|
||||
/* if we don't need buttonID, we can return immediately */
|
||||
close(fd_pipe[0]);
|
||||
return 0; /* success */
|
||||
}
|
||||
*buttonid = -1;
|
||||
*buttonID = -1;
|
||||
|
||||
output = SDL_malloc(output_len + 1);
|
||||
if (!output) {
|
||||
@@ -251,7 +251,7 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button
|
||||
for (i = 0; i < messageboxdata->numbuttons; i += 1) {
|
||||
if (messageboxdata->buttons[i].text) {
|
||||
if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) {
|
||||
*buttonid = messageboxdata->buttons[i].buttonid;
|
||||
*buttonID = messageboxdata->buttons[i].buttonID;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
||||
|
||||
extern int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
|
||||
|
||||
|
||||
@@ -671,7 +671,7 @@ static const char *EscapeAmpersands(char **dst, size_t *dstlen, const char *src)
|
||||
}
|
||||
|
||||
/* This function is called if a Task Dialog is unsupported. */
|
||||
static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
WIN_DialogData *dialog;
|
||||
int i, x, y, retval;
|
||||
@@ -875,13 +875,13 @@ static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *
|
||||
|
||||
result = DialogBoxIndirectParam(NULL, (DLGTEMPLATE *)dialog->lpDialog, ParentWindow, MessageBoxDialogProc, (LPARAM)messageboxdata);
|
||||
if (result >= IDBUTTONINDEX0 && result - IDBUTTONINDEX0 < messageboxdata->numbuttons) {
|
||||
*buttonid = messageboxdata->buttons[result - IDBUTTONINDEX0].buttonid;
|
||||
*buttonID = messageboxdata->buttons[result - IDBUTTONINDEX0].buttonID;
|
||||
retval = 0;
|
||||
} else if (result == IDCLOSED) {
|
||||
/* Dialog window closed by user or system. */
|
||||
/* This could use a special return code. */
|
||||
retval = 0;
|
||||
*buttonid = -1;
|
||||
*buttonID = -1;
|
||||
} else {
|
||||
if (result == 0) {
|
||||
SDL_SetError("Invalid parent window handle");
|
||||
@@ -908,7 +908,7 @@ static int WIN_ShowOldMessageBox(const SDL_MessageBoxData *messageboxdata, int *
|
||||
typedef HRESULT (FAR WINAPI *TASKDIALOGINDIRECTPROC)(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, int *pnRadioButton, BOOL *pfVerificationFlagChecked);
|
||||
/* *INDENT-ON* */ /* clang-format on */
|
||||
|
||||
int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
HWND ParentWindow = NULL;
|
||||
wchar_t *wmessage;
|
||||
@@ -932,7 +932,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
/* If we cannot load comctl32.dll use the old messagebox! */
|
||||
hComctl32 = LoadLibrary(TEXT("comctl32.dll"));
|
||||
if (!hComctl32) {
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonid);
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonID);
|
||||
}
|
||||
|
||||
/* If TaskDialogIndirect doesn't exist use the old messagebox!
|
||||
@@ -945,7 +945,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
pfnTaskDialogIndirect = (TASKDIALOGINDIRECTPROC)GetProcAddress(hComctl32, "TaskDialogIndirect");
|
||||
if (!pfnTaskDialogIndirect) {
|
||||
FreeLibrary(hComctl32);
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonid);
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonID);
|
||||
}
|
||||
|
||||
/* If we have a parent window, get the Instance and HWND for them
|
||||
@@ -985,7 +985,7 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
pButton = &pButtons[messageboxdata->numbuttons - 1 - i];
|
||||
}
|
||||
if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
|
||||
nCancelButton = messageboxdata->buttons[i].buttonid;
|
||||
nCancelButton = messageboxdata->buttons[i].buttonID;
|
||||
pButton->nButtonID = IDCANCEL;
|
||||
} else {
|
||||
pButton->nButtonID = IDBUTTONINDEX0 + i;
|
||||
@@ -1026,17 +1026,17 @@ int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
/* Check the Task Dialog was successful and give the result */
|
||||
if (SUCCEEDED(hr)) {
|
||||
if (nButton == IDCANCEL) {
|
||||
*buttonid = nCancelButton;
|
||||
*buttonID = nCancelButton;
|
||||
} else if (nButton >= IDBUTTONINDEX0 && nButton < IDBUTTONINDEX0 + messageboxdata->numbuttons) {
|
||||
*buttonid = messageboxdata->buttons[nButton - IDBUTTONINDEX0].buttonid;
|
||||
*buttonID = messageboxdata->buttons[nButton - IDBUTTONINDEX0].buttonID;
|
||||
} else {
|
||||
*buttonid = -1;
|
||||
*buttonID = -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We failed showing the Task Dialog, use the old message box! */
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonid);
|
||||
return WIN_ShowOldMessageBox(messageboxdata, buttonID);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WINDOWS */
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
||||
|
||||
extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WINDOWS */
|
||||
|
||||
@@ -40,7 +40,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) {
|
||||
return rtstr;
|
||||
}
|
||||
|
||||
extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
#if SDL_WINAPI_FAMILY_PHONE && NTDDI_VERSION == NTDDI_WIN8
|
||||
/* Sadly, Windows Phone 8 doesn't include the MessageDialog class that
|
||||
@@ -99,10 +99,10 @@ extern "C" int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, in
|
||||
if (operation->Status != Windows::Foundation::AsyncStatus::Completed) {
|
||||
return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
|
||||
}
|
||||
if (buttonid) {
|
||||
if (buttonID) {
|
||||
IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
|
||||
int clicked_index = results.ToInt32();
|
||||
*buttonid = messageboxdata->buttons[clicked_index].buttonid;
|
||||
*buttonID = messageboxdata->buttons[clicked_index].buttonID;
|
||||
}
|
||||
return 0;
|
||||
#endif /* if SDL_WINAPI_FAMILY_PHONE / else */
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_WINRT
|
||||
|
||||
extern int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int WINRT_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_WINRT */
|
||||
|
||||
@@ -101,7 +101,7 @@ typedef struct SDL_MessageBoxDataX11
|
||||
int text_height; /* Height for text lines. */
|
||||
TextLineData *linedata;
|
||||
|
||||
int *pbuttonid; /* Pointer to user return buttonid value. */
|
||||
int *pbuttonid; /* Pointer to user return buttonID value. */
|
||||
|
||||
int button_press_index; /* Index into buttondata/buttonpos for button which is pressed (or -1). */
|
||||
int mouse_over_index; /* Index into buttondata/buttonpos for button mouse is over (or -1). */
|
||||
@@ -701,7 +701,7 @@ static int X11_MessageBoxLoop(SDL_MessageBoxDataX11 *data)
|
||||
SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[i];
|
||||
|
||||
if (buttondatax11->buttondata->flags & mask) {
|
||||
*data->pbuttonid = buttondatax11->buttondata->buttonid;
|
||||
*data->pbuttonid = buttondatax11->buttondata->buttonID;
|
||||
close_dialog = SDL_TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -726,7 +726,7 @@ static int X11_MessageBoxLoop(SDL_MessageBoxDataX11 *data)
|
||||
if (data->button_press_index == button) {
|
||||
SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[button];
|
||||
|
||||
*data->pbuttonid = buttondatax11->buttondata->buttonid;
|
||||
*data->pbuttonid = buttondatax11->buttondata->buttonID;
|
||||
close_dialog = SDL_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -744,7 +744,7 @@ static int X11_MessageBoxLoop(SDL_MessageBoxDataX11 *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
int ret;
|
||||
SDL_MessageBoxDataX11 data;
|
||||
@@ -772,11 +772,11 @@ static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||
/* This code could get called from multiple threads maybe? */
|
||||
X11_XInitThreads();
|
||||
|
||||
/* Initialize the return buttonid value to -1 (for error or dialogbox closed). */
|
||||
*buttonid = -1;
|
||||
/* Initialize the return buttonID value to -1 (for error or dialogbox closed). */
|
||||
*buttonID = -1;
|
||||
|
||||
/* Init and display the message box. */
|
||||
ret = X11_MessageBoxInit(&data, messageboxdata, buttonid);
|
||||
ret = X11_MessageBoxInit(&data, messageboxdata, buttonID);
|
||||
if (ret != -1) {
|
||||
ret = X11_MessageBoxInitPositions(&data);
|
||||
if (ret != -1) {
|
||||
@@ -800,7 +800,7 @@ static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||
}
|
||||
|
||||
/* Display an x11 message box. */
|
||||
int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||
{
|
||||
#if SDL_FORK_MESSAGEBOX
|
||||
/* Use a child process to protect against setlocale(). Annoying. */
|
||||
@@ -809,21 +809,21 @@ int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
int status = 0;
|
||||
|
||||
if (pipe(fds) == -1) {
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonID); /* oh well. */
|
||||
}
|
||||
|
||||
pid = fork();
|
||||
if (pid == -1) { /* failed */
|
||||
close(fds[0]);
|
||||
close(fds[1]);
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonID); /* oh well. */
|
||||
} else if (pid == 0) { /* we're the child */
|
||||
int exitcode = 0;
|
||||
close(fds[0]);
|
||||
status = X11_ShowMessageBoxImpl(messageboxdata, buttonid);
|
||||
status = X11_ShowMessageBoxImpl(messageboxdata, buttonID);
|
||||
if (write(fds[1], &status, sizeof(int)) != sizeof(int)) {
|
||||
exitcode = 1;
|
||||
} else if (write(fds[1], buttonid, sizeof(int)) != sizeof(int)) {
|
||||
} else if (write(fds[1], buttonID, sizeof(int)) != sizeof(int)) {
|
||||
exitcode = 1;
|
||||
}
|
||||
close(fds[1]);
|
||||
@@ -840,16 +840,16 @@ int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||
if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) {
|
||||
status = SDL_SetError("msgbox child process failed");
|
||||
} else if ((read(fds[0], &status, sizeof(int)) != sizeof(int)) ||
|
||||
(read(fds[0], buttonid, sizeof(int)) != sizeof(int))) {
|
||||
(read(fds[0], buttonID, sizeof(int)) != sizeof(int))) {
|
||||
status = SDL_SetError("read from msgbox child process failed");
|
||||
*buttonid = 0;
|
||||
*buttonID = 0;
|
||||
}
|
||||
close(fds[0]);
|
||||
|
||||
return status;
|
||||
}
|
||||
#else
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonid);
|
||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonID);
|
||||
#endif
|
||||
}
|
||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef SDL_VIDEO_DRIVER_X11
|
||||
|
||||
extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
||||
extern int X11_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||
|
||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user