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/6955main
parent
6f87973b9c
commit
cacac6cc34
|
@ -2413,21 +2413,41 @@ SDL_Event e1;
|
||||||
- e1.caxis
|
- e1.caxis
|
||||||
+ e1.gaxis
|
+ e1.gaxis
|
||||||
@@
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->caxis
|
||||||
|
+ e1->gaxis
|
||||||
|
@@
|
||||||
SDL_Event e1;
|
SDL_Event e1;
|
||||||
@@
|
@@
|
||||||
- e1.cbutton
|
- e1.cbutton
|
||||||
+ e1.gbutton
|
+ e1.gbutton
|
||||||
@@
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->cbutton
|
||||||
|
+ e1->gbutton
|
||||||
|
@@
|
||||||
SDL_Event e1;
|
SDL_Event e1;
|
||||||
@@
|
@@
|
||||||
- e1.cdevice
|
- e1.cdevice
|
||||||
+ e1.gdevice
|
+ e1.gdevice
|
||||||
@@
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->cdevice
|
||||||
|
+ e1->gdevice
|
||||||
|
@@
|
||||||
SDL_Event e1;
|
SDL_Event e1;
|
||||||
@@
|
@@
|
||||||
- e1.ctouchpad
|
- e1.ctouchpad
|
||||||
+ e1.gtouchpad
|
+ e1.gtouchpad
|
||||||
@@
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->ctouchpad
|
||||||
|
+ e1->gtouchpad
|
||||||
|
@@
|
||||||
SDL_Event e1;
|
SDL_Event e1;
|
||||||
@@
|
@@
|
||||||
- e1.csensor
|
- e1.csensor
|
||||||
|
@ -2435,29 +2455,49 @@ SDL_Event e1;
|
||||||
@@
|
@@
|
||||||
SDL_Event *e1;
|
SDL_Event *e1;
|
||||||
@@
|
@@
|
||||||
- e1->caxis
|
|
||||||
+ e1->gaxis
|
|
||||||
@@
|
|
||||||
SDL_Event *e1;
|
|
||||||
@@
|
|
||||||
- e1->cbutton
|
|
||||||
+ e1->gbutton
|
|
||||||
@@
|
|
||||||
SDL_Event *e1;
|
|
||||||
@@
|
|
||||||
- e1->cdevice
|
|
||||||
+ e1->gdevice
|
|
||||||
@@
|
|
||||||
SDL_Event *e1;
|
|
||||||
@@
|
|
||||||
- e1->ctouchpad
|
|
||||||
+ e1->gtouchpad
|
|
||||||
@@
|
|
||||||
SDL_Event *e1;
|
|
||||||
@@
|
|
||||||
- e1->csensor
|
- e1->csensor
|
||||||
+ e1->gsensor
|
+ e1->gsensor
|
||||||
@@
|
@@
|
||||||
|
SDL_Event e1;
|
||||||
|
@@
|
||||||
|
- e1.wheel.mouseX
|
||||||
|
+ e1.wheel.mouse_x
|
||||||
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->wheel.mouseX
|
||||||
|
+ e1->wheel.mouse_x
|
||||||
|
@@
|
||||||
|
SDL_Event e1;
|
||||||
|
@@
|
||||||
|
- e1.wheel.mouseY
|
||||||
|
+ e1.wheel.mouse_y
|
||||||
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->wheel.mouseY
|
||||||
|
+ e1->wheel.mouse_y
|
||||||
|
@@
|
||||||
|
SDL_Event e1;
|
||||||
|
@@
|
||||||
|
- e1.tfinger.touchId
|
||||||
|
+ e1.tfinger.touchID
|
||||||
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->tfinger.touchId
|
||||||
|
+ e1->tfinger.touchID
|
||||||
|
@@
|
||||||
|
SDL_Event e1;
|
||||||
|
@@
|
||||||
|
- e1.tfinger.fingerId
|
||||||
|
+ e1.tfinger.fingerID
|
||||||
|
@@
|
||||||
|
SDL_Event *e1;
|
||||||
|
@@
|
||||||
|
- e1->tfinger.fingerId
|
||||||
|
+ e1->tfinger.fingerID
|
||||||
|
@@
|
||||||
expression e1, e2, e3, e4;
|
expression e1, e2, e3, e4;
|
||||||
@@
|
@@
|
||||||
- SDL_CreateWindow(e1, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, e2, e3, e4)
|
- SDL_CreateWindow(e1, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, e2, e3, e4)
|
||||||
|
@ -2909,3 +2949,62 @@ expression e1, e2, e3, e4;
|
||||||
- SDL_HasWindowSurface
|
- SDL_HasWindowSurface
|
||||||
+ SDL_WindowHasSurface
|
+ SDL_WindowHasSurface
|
||||||
(...)
|
(...)
|
||||||
|
@@
|
||||||
|
SDL_PixelFormat e1;
|
||||||
|
@@
|
||||||
|
- e1.BitsPerPixel
|
||||||
|
+ e1.bits_per_pixel
|
||||||
|
@@
|
||||||
|
SDL_PixelFormat *e1;
|
||||||
|
@@
|
||||||
|
- e1->BitsPerPixel
|
||||||
|
+ e1->bits_per_pixel
|
||||||
|
@@
|
||||||
|
SDL_PixelFormat e1;
|
||||||
|
@@
|
||||||
|
- e1.BytesPerPixel
|
||||||
|
+ e1.bytes_per_pixel
|
||||||
|
@@
|
||||||
|
SDL_PixelFormat *e1;
|
||||||
|
@@
|
||||||
|
- e1->BytesPerPixel
|
||||||
|
+ e1->bytes_per_pixel
|
||||||
|
@@
|
||||||
|
SDL_MessageBoxButtonData e1;
|
||||||
|
@@
|
||||||
|
- e1.buttonid
|
||||||
|
+ e1.buttonID
|
||||||
|
@@
|
||||||
|
SDL_MessageBoxButtonData *e1;
|
||||||
|
@@
|
||||||
|
- e1->buttonid
|
||||||
|
+ e1->buttonID
|
||||||
|
@@
|
||||||
|
SDL_GamepadBinding e1;
|
||||||
|
@@
|
||||||
|
- e1.inputType
|
||||||
|
+ e1.input_type
|
||||||
|
@@
|
||||||
|
SDL_GamepadBinding *e1;
|
||||||
|
@@
|
||||||
|
- e1->inputType
|
||||||
|
+ e1->input_type
|
||||||
|
@@
|
||||||
|
SDL_GamepadBinding e1;
|
||||||
|
@@
|
||||||
|
- e1.outputType
|
||||||
|
+ e1.output_type
|
||||||
|
@@
|
||||||
|
SDL_GamepadBinding *e1;
|
||||||
|
@@
|
||||||
|
- e1->outputType
|
||||||
|
+ e1->output_type
|
||||||
|
@@
|
||||||
|
@@
|
||||||
|
- SDL_version
|
||||||
|
+ SDL_Version
|
||||||
|
@@
|
||||||
|
typedef SDL_version, SDL_Version;
|
||||||
|
@@
|
||||||
|
- SDL_version
|
||||||
|
+ SDL_Version
|
||||||
|
|
|
@ -330,6 +330,10 @@ The SDL_EVENT_WINDOW_SIZE_CHANGED event has been removed, and you can use SDL_EV
|
||||||
|
|
||||||
The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
|
The gamepad event structures caxis, cbutton, cdevice, ctouchpad, and csensor have been renamed gaxis, gbutton, gdevice, gtouchpad, and gsensor.
|
||||||
|
|
||||||
|
The mouseX and mouseY fields of SDL_MouseWheelEvent have been renamed mouse_x and mouse_y.
|
||||||
|
|
||||||
|
The touchId and fingerId fields of SDL_TouchFingerEvent have been renamed touchID and fingerID.
|
||||||
|
|
||||||
SDL_QUERY, SDL_IGNORE, SDL_ENABLE, and SDL_DISABLE have been removed. You can use the functions SDL_SetEventEnabled() and SDL_EventEnabled() to set and query event processing state.
|
SDL_QUERY, SDL_IGNORE, SDL_ENABLE, and SDL_DISABLE have been removed. You can use the functions SDL_SetEventEnabled() and SDL_EventEnabled() to set and query event processing state.
|
||||||
|
|
||||||
SDL_AddEventWatch() now returns -1 if it fails because it ran out of memory and couldn't add the event watch callback.
|
SDL_AddEventWatch() now returns -1 if it fails because it ran out of memory and couldn't add the event watch callback.
|
||||||
|
@ -504,6 +508,8 @@ SDL_bool SDL_IsJoystickNVIDIASHIELDController(Uint16 vendor_id, Uint16 product_i
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The inputType and outputType fields of SDL_GamepadBinding have been renamed input_type and output_type.
|
||||||
|
|
||||||
The following enums have been renamed:
|
The following enums have been renamed:
|
||||||
* SDL_GameControllerAxis => SDL_GamepadAxis
|
* SDL_GameControllerAxis => SDL_GamepadAxis
|
||||||
* SDL_GameControllerBindType => SDL_GamepadBindingType
|
* SDL_GameControllerBindType => SDL_GamepadBindingType
|
||||||
|
@ -871,6 +877,10 @@ Several platform-specific entry point functions have been removed as unnecessary
|
||||||
#define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
|
#define SDL_GDKRunApp(MAIN_FUNC, RESERVED) SDL_RunApp(0, NULL, MAIN_FUNC, RESERVED)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## SDL_messagebox.h
|
||||||
|
|
||||||
|
The buttonid field of SDL_MessageBoxButtonData has been renamed buttonID.
|
||||||
|
|
||||||
## SDL_metal.h
|
## SDL_metal.h
|
||||||
|
|
||||||
SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
|
SDL_Metal_GetDrawableSize() has been removed. SDL_GetWindowSizeInPixels() can be used in its place.
|
||||||
|
@ -912,6 +922,8 @@ The following symbols have been renamed:
|
||||||
|
|
||||||
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
|
SDL_CalculateGammaRamp has been removed, because SDL_SetWindowGammaRamp has been removed as well due to poor support in modern operating systems (see [SDL_video.h](#sdl_videoh)).
|
||||||
|
|
||||||
|
The BitsPerPixel and BytesPerPixel fields of SDL_PixelFormat have been renamed bits_per_pixel and bytes_per_pixel.
|
||||||
|
|
||||||
The following functions have been renamed:
|
The following functions have been renamed:
|
||||||
* SDL_AllocFormat() => SDL_CreatePixelFormat()
|
* SDL_AllocFormat() => SDL_CreatePixelFormat()
|
||||||
* SDL_AllocPalette() => SDL_CreatePalette()
|
* SDL_AllocPalette() => SDL_CreatePalette()
|
||||||
|
@ -1528,6 +1540,9 @@ The following functions have been removed:
|
||||||
SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in SDL 2.0.
|
SDL_GetRevisionNumber() has been removed from the API, it always returned 0 in SDL 2.0.
|
||||||
|
|
||||||
|
|
||||||
|
The following structures have been renamed:
|
||||||
|
* SDL_version => SDL_Version
|
||||||
|
|
||||||
## SDL_video.h
|
## SDL_video.h
|
||||||
|
|
||||||
Several video backends have had their names lower-cased ("kmsdrm", "rpi", "android", "psp", "ps2", "vita"). SDL already does a case-insensitive compare for SDL_HINT_VIDEO_DRIVER tests, but if your app is calling SDL_GetVideoDriver() or SDL_GetCurrentVideoDriver() and doing case-sensitive compares on those strings, please update your code.
|
Several video backends have had their names lower-cased ("kmsdrm", "rpi", "android", "psp", "ps2", "vita"). SDL already does a case-insensitive compare for SDL_HINT_VIDEO_DRIVER tests, but if your app is calling SDL_GetVideoDriver() or SDL_GetCurrentVideoDriver() and doing case-sensitive compares on those strings, please update your code.
|
||||||
|
|
|
@ -356,8 +356,8 @@ typedef struct SDL_MouseWheelEvent
|
||||||
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
|
float x; /**< The amount scrolled horizontally, positive to the right and negative to the left */
|
||||||
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
|
float y; /**< The amount scrolled vertically, positive away from the user and negative toward the user */
|
||||||
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */
|
||||||
float mouseX; /**< X coordinate, relative to window */
|
float mouse_x; /**< X coordinate, relative to window */
|
||||||
float mouseY; /**< Y coordinate, relative to window */
|
float mouse_y; /**< Y coordinate, relative to window */
|
||||||
} SDL_MouseWheelEvent;
|
} SDL_MouseWheelEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -535,8 +535,8 @@ typedef struct SDL_TouchFingerEvent
|
||||||
Uint32 type; /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
|
Uint32 type; /**< ::SDL_EVENT_FINGER_MOTION or ::SDL_EVENT_FINGER_DOWN or ::SDL_EVENT_FINGER_UP */
|
||||||
Uint32 reserved;
|
Uint32 reserved;
|
||||||
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
Uint64 timestamp; /**< In nanoseconds, populated using SDL_GetTicksNS() */
|
||||||
SDL_TouchID touchId; /**< The touch device id */
|
SDL_TouchID touchID; /**< The touch device id */
|
||||||
SDL_FingerID fingerId;
|
SDL_FingerID fingerID;
|
||||||
float x; /**< Normalized in the range 0...1 */
|
float x; /**< Normalized in the range 0...1 */
|
||||||
float y; /**< Normalized in the range 0...1 */
|
float y; /**< Normalized in the range 0...1 */
|
||||||
float dx; /**< Normalized in the range -1...1 */
|
float dx; /**< Normalized in the range -1...1 */
|
||||||
|
|
|
@ -178,9 +178,9 @@ typedef enum
|
||||||
SDL_GAMEPAD_BINDTYPE_HAT
|
SDL_GAMEPAD_BINDTYPE_HAT
|
||||||
} SDL_GamepadBindingType;
|
} SDL_GamepadBindingType;
|
||||||
|
|
||||||
typedef struct
|
typedef struct SDL_GamepadBinding
|
||||||
{
|
{
|
||||||
SDL_GamepadBindingType inputType;
|
SDL_GamepadBindingType input_type;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
int button;
|
int button;
|
||||||
|
@ -200,7 +200,7 @@ typedef struct
|
||||||
|
|
||||||
} input;
|
} input;
|
||||||
|
|
||||||
SDL_GamepadBindingType outputType;
|
SDL_GamepadBindingType output_type;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
SDL_GamepadButton button;
|
SDL_GamepadButton button;
|
||||||
|
|
|
@ -58,8 +58,8 @@ typedef enum
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
|
Uint32 flags; /**< ::SDL_MessageBoxButtonFlags */
|
||||||
int buttonid; /**< User defined button id (value returned via SDL_ShowMessageBox) */
|
int buttonID; /**< User defined button id (value returned via SDL_ShowMessageBox) */
|
||||||
const char * text; /**< The UTF-8 button text */
|
const char *text; /**< The UTF-8 button text */
|
||||||
} SDL_MessageBoxButtonData;
|
} SDL_MessageBoxButtonData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -492,6 +492,9 @@
|
||||||
/* ##SDL_timer.h */
|
/* ##SDL_timer.h */
|
||||||
#define SDL_GetTicks64 SDL_GetTicks
|
#define SDL_GetTicks64 SDL_GetTicks
|
||||||
|
|
||||||
|
/* ##SDL_version.h */
|
||||||
|
#define SDL_version SDL_Version
|
||||||
|
|
||||||
/* ##SDL_video.h */
|
/* ##SDL_video.h */
|
||||||
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
|
#define SDL_GetClosestDisplayMode SDL_GetClosestFullscreenDisplayMode
|
||||||
#define SDL_GetDisplayOrientation SDL_GetCurrentDisplayOrientation
|
#define SDL_GetDisplayOrientation SDL_GetCurrentDisplayOrientation
|
||||||
|
@ -961,6 +964,9 @@
|
||||||
/* ##SDL_timer.h */
|
/* ##SDL_timer.h */
|
||||||
#define SDL_GetTicks64 SDL_GetTicks64_renamed_SDL_GetTicks
|
#define SDL_GetTicks64 SDL_GetTicks64_renamed_SDL_GetTicks
|
||||||
|
|
||||||
|
/* ##SDL_version.h */
|
||||||
|
#define SDL_version SDL_version_renamed_SDL_Version
|
||||||
|
|
||||||
/* ##SDL_video.h */
|
/* ##SDL_video.h */
|
||||||
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
|
#define SDL_GetClosestDisplayMode SDL_GetClosestDisplayMode_renamed_SDL_GetClosestFullscreenDisplayMode
|
||||||
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_renamed_SDL_GetCurrentDisplayOrientation
|
#define SDL_GetDisplayOrientation SDL_GetDisplayOrientation_renamed_SDL_GetCurrentDisplayOrientation
|
||||||
|
|
|
@ -703,8 +703,8 @@ typedef struct SDL_PixelFormat
|
||||||
{
|
{
|
||||||
Uint32 format;
|
Uint32 format;
|
||||||
SDL_Palette *palette;
|
SDL_Palette *palette;
|
||||||
Uint8 BitsPerPixel;
|
Uint8 bits_per_pixel;
|
||||||
Uint8 BytesPerPixel;
|
Uint8 bytes_per_pixel;
|
||||||
Uint8 padding[2];
|
Uint8 padding[2];
|
||||||
Uint32 Rmask;
|
Uint32 Rmask;
|
||||||
Uint32 Gmask;
|
Uint32 Gmask;
|
||||||
|
|
|
@ -48,12 +48,12 @@ extern "C" {
|
||||||
* \sa SDL_VERSION
|
* \sa SDL_VERSION
|
||||||
* \sa SDL_GetVersion
|
* \sa SDL_GetVersion
|
||||||
*/
|
*/
|
||||||
typedef struct SDL_version
|
typedef struct SDL_Version
|
||||||
{
|
{
|
||||||
Uint8 major; /**< major version */
|
Uint8 major; /**< major version */
|
||||||
Uint8 minor; /**< minor version */
|
Uint8 minor; /**< minor version */
|
||||||
Uint8 patch; /**< update version */
|
Uint8 patch; /**< update version */
|
||||||
} SDL_version;
|
} SDL_Version;
|
||||||
|
|
||||||
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
|
||||||
*/
|
*/
|
||||||
|
@ -64,16 +64,16 @@ typedef struct SDL_version
|
||||||
/**
|
/**
|
||||||
* Macro to determine SDL version program was compiled against.
|
* Macro to determine SDL version program was compiled against.
|
||||||
*
|
*
|
||||||
* This macro fills in a SDL_version structure with the version of the
|
* This macro fills in an SDL_Version structure with the version of the
|
||||||
* library you compiled against. This is determined by what header the
|
* library you compiled against. This is determined by what header the
|
||||||
* compiler uses. Note that if you dynamically linked the library, you might
|
* compiler uses. Note that if you dynamically linked the library, you might
|
||||||
* have a slightly newer or older version at runtime. That version can be
|
* have a slightly newer or older version at runtime. That version can be
|
||||||
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
|
* determined with SDL_GetVersion(), which, unlike SDL_VERSION(),
|
||||||
* is not a macro.
|
* is not a macro.
|
||||||
*
|
*
|
||||||
* \param x A pointer to a SDL_version struct to initialize.
|
* \param x A pointer to an SDL_Version struct to initialize.
|
||||||
*
|
*
|
||||||
* \sa SDL_version
|
* \sa SDL_Version
|
||||||
* \sa SDL_GetVersion
|
* \sa SDL_GetVersion
|
||||||
*/
|
*/
|
||||||
#define SDL_VERSION(x) \
|
#define SDL_VERSION(x) \
|
||||||
|
@ -114,7 +114,7 @@ typedef struct SDL_version
|
||||||
*
|
*
|
||||||
* This function may be called safely at any time, even before SDL_Init().
|
* This function may be called safely at any time, even before SDL_Init().
|
||||||
*
|
*
|
||||||
* \param ver the SDL_version structure that contains the version information
|
* \param ver the SDL_Version structure that contains the version information
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
* \returns 0 on success or a negative error code on failure; call
|
||||||
* SDL_GetError() for more information.
|
* SDL_GetError() for more information.
|
||||||
*
|
*
|
||||||
|
@ -122,7 +122,7 @@ typedef struct SDL_version
|
||||||
*
|
*
|
||||||
* \sa SDL_GetRevision
|
* \sa SDL_GetRevision
|
||||||
*/
|
*/
|
||||||
extern DECLSPEC int SDLCALL SDL_GetVersion(SDL_version * ver);
|
extern DECLSPEC int SDLCALL SDL_GetVersion(SDL_Version * ver);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the code revision of SDL that is linked against your program.
|
* Get the code revision of SDL that is linked against your program.
|
||||||
|
|
|
@ -66,11 +66,11 @@ SDL_COMPILE_TIME_ASSERT(SDL_BUILD_MICRO_VERSION,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0);
|
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0);
|
||||||
/* Limited only by the need to fit in SDL_version */
|
/* Limited only by the need to fit in SDL_Version */
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255);
|
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255);
|
||||||
|
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0);
|
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0);
|
||||||
/* Limited only by the need to fit in SDL_version */
|
/* Limited only by the need to fit in SDL_Version */
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255);
|
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255);
|
||||||
|
|
||||||
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0);
|
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0);
|
||||||
|
@ -534,7 +534,7 @@ Uint32 SDL_GetNextObjectID(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the library version number */
|
/* Get the library version number */
|
||||||
int SDL_GetVersion(SDL_version *ver)
|
int SDL_GetVersion(SDL_Version *ver)
|
||||||
{
|
{
|
||||||
static SDL_bool check_hint = SDL_TRUE;
|
static SDL_bool check_hint = SDL_TRUE;
|
||||||
static SDL_bool legacy_version = SDL_FALSE;
|
static SDL_bool legacy_version = SDL_FALSE;
|
||||||
|
|
|
@ -137,13 +137,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Optimized functions from 'SDL_blit_0.c'
|
/* Optimized functions from 'SDL_blit_0.c'
|
||||||
- blit with source BitsPerPixel < 8, palette */
|
- blit with source bits_per_pixel < 8, palette */
|
||||||
#ifndef SDL_HAVE_BLIT_0
|
#ifndef SDL_HAVE_BLIT_0
|
||||||
#define SDL_HAVE_BLIT_0 !SDL_LEAN_AND_MEAN
|
#define SDL_HAVE_BLIT_0 !SDL_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Optimized functions from 'SDL_blit_1.c'
|
/* Optimized functions from 'SDL_blit_1.c'
|
||||||
- blit with source BytesPerPixel == 1, palette */
|
- blit with source bytes_per_pixel == 1, palette */
|
||||||
#ifndef SDL_HAVE_BLIT_1
|
#ifndef SDL_HAVE_BLIT_1
|
||||||
#define SDL_HAVE_BLIT_1 !SDL_LEAN_AND_MEAN
|
#define SDL_HAVE_BLIT_1 !SDL_LEAN_AND_MEAN
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2264,7 +2264,7 @@ SDL_bool Android_JNI_IsScreenKeyboardShown(void)
|
||||||
return is_shown;
|
return is_shown;
|
||||||
}
|
}
|
||||||
|
|
||||||
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||||
{
|
{
|
||||||
JNIEnv *env;
|
JNIEnv *env;
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
|
@ -2304,7 +2304,7 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu
|
||||||
|
|
||||||
temp = sdlButton->flags;
|
temp = sdlButton->flags;
|
||||||
(*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp);
|
(*env)->SetIntArrayRegion(env, button_flags, i, 1, &temp);
|
||||||
temp = sdlButton->buttonid;
|
temp = sdlButton->buttonID;
|
||||||
(*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp);
|
(*env)->SetIntArrayRegion(env, button_ids, i, 1, &temp);
|
||||||
text = (*env)->NewStringUTF(env, sdlButton->text);
|
text = (*env)->NewStringUTF(env, sdlButton->text);
|
||||||
(*env)->SetObjectArrayElement(env, button_texts, i, text);
|
(*env)->SetObjectArrayElement(env, button_texts, i, text);
|
||||||
|
@ -2333,7 +2333,7 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu
|
||||||
|
|
||||||
mid = (*env)->GetMethodID(env, clazz,
|
mid = (*env)->GetMethodID(env, clazz,
|
||||||
"messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
|
"messageboxShowMessageBox", "(ILjava/lang/String;Ljava/lang/String;[I[I[Ljava/lang/String;[I)I");
|
||||||
*buttonid = (*env)->CallIntMethod(env, context, mid,
|
*buttonID = (*env)->CallIntMethod(env, context, mid,
|
||||||
messageboxdata->flags,
|
messageboxdata->flags,
|
||||||
title,
|
title,
|
||||||
message,
|
message,
|
||||||
|
|
|
@ -113,7 +113,7 @@ int Android_JNI_SendMessage(int command, int param);
|
||||||
JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv *mEnv, jclass cls);
|
JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv *mEnv, jclass cls);
|
||||||
|
|
||||||
/* MessageBox */
|
/* MessageBox */
|
||||||
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||||
|
|
||||||
/* Cursor support */
|
/* Cursor support */
|
||||||
int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y);
|
int Android_JNI_CreateCustomCursor(SDL_Surface *surface, int hot_x, int hot_y);
|
||||||
|
|
|
@ -406,7 +406,7 @@ SDL_DYNAPI_PROC(Uint64,SDL_GetTicks,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return)
|
SDL_DYNAPI_PROC(Uint64,SDL_GetTicksNS,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return)
|
SDL_DYNAPI_PROC(SDL_TouchDeviceType,SDL_GetTouchDeviceType,(SDL_TouchID a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Finger*,SDL_GetTouchFinger,(SDL_TouchID a, int b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_Finger*,SDL_GetTouchFinger,(SDL_TouchID a, int b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_version *a),(a),return)
|
SDL_DYNAPI_PROC(int,SDL_GetVersion,(SDL_Version *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetVideoDriver,(int a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
|
SDL_DYNAPI_PROC(float,SDL_GetWindowDisplayScale,(SDL_Window *a),(a),return)
|
||||||
|
|
|
@ -463,8 +463,8 @@ static void SDL_LogEvent(const SDL_Event *event)
|
||||||
|
|
||||||
#define PRINT_FINGER_EVENT(event) \
|
#define PRINT_FINGER_EVENT(event) \
|
||||||
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIu64 " fingerid=%" SDL_PRIu64 " x=%f y=%f dx=%f dy=%f pressure=%f)", \
|
(void)SDL_snprintf(details, sizeof(details), " (timestamp=%u touchid=%" SDL_PRIu64 " fingerid=%" SDL_PRIu64 " x=%f y=%f dx=%f dy=%f pressure=%f)", \
|
||||||
(uint)event->tfinger.timestamp, event->tfinger.touchId, \
|
(uint)event->tfinger.timestamp, event->tfinger.touchID, \
|
||||||
event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \
|
event->tfinger.fingerID, event->tfinger.x, event->tfinger.y, \
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure)
|
||||||
SDL_EVENT_CASE(SDL_EVENT_FINGER_DOWN)
|
SDL_EVENT_CASE(SDL_EVENT_FINGER_DOWN)
|
||||||
PRINT_FINGER_EVENT(event);
|
PRINT_FINGER_EVENT(event);
|
||||||
|
|
|
@ -880,8 +880,8 @@ int SDL_SendMouseWheel(Uint64 timestamp, SDL_Window *window, SDL_MouseID mouseID
|
||||||
event.wheel.x = x;
|
event.wheel.x = x;
|
||||||
event.wheel.y = y;
|
event.wheel.y = y;
|
||||||
event.wheel.direction = (Uint32)direction;
|
event.wheel.direction = (Uint32)direction;
|
||||||
event.wheel.mouseX = mouse->x;
|
event.wheel.mouse_x = mouse->x;
|
||||||
event.wheel.mouseY = mouse->y;
|
event.wheel.mouse_y = mouse->y;
|
||||||
posted = (SDL_PushEvent(&event) > 0);
|
posted = (SDL_PushEvent(&event) > 0);
|
||||||
}
|
}
|
||||||
return posted;
|
return posted;
|
||||||
|
|
|
@ -328,8 +328,8 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_EVENT_FINGER_DOWN;
|
event.type = SDL_EVENT_FINGER_DOWN;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchID = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerID = fingerid;
|
||||||
event.tfinger.x = x;
|
event.tfinger.x = x;
|
||||||
event.tfinger.y = y;
|
event.tfinger.y = y;
|
||||||
event.tfinger.dx = 0;
|
event.tfinger.dx = 0;
|
||||||
|
@ -349,8 +349,8 @@ int SDL_SendTouch(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid, SDL_W
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_EVENT_FINGER_UP;
|
event.type = SDL_EVENT_FINGER_UP;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchID = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerID = fingerid;
|
||||||
/* I don't trust the coordinates passed on fingerUp */
|
/* I don't trust the coordinates passed on fingerUp */
|
||||||
event.tfinger.x = finger->x;
|
event.tfinger.x = finger->x;
|
||||||
event.tfinger.y = finger->y;
|
event.tfinger.y = finger->y;
|
||||||
|
@ -446,8 +446,8 @@ int SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid,
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_EVENT_FINGER_MOTION;
|
event.type = SDL_EVENT_FINGER_MOTION;
|
||||||
event.common.timestamp = timestamp;
|
event.common.timestamp = timestamp;
|
||||||
event.tfinger.touchId = id;
|
event.tfinger.touchID = id;
|
||||||
event.tfinger.fingerId = fingerid;
|
event.tfinger.fingerID = fingerid;
|
||||||
event.tfinger.x = x;
|
event.tfinger.x = x;
|
||||||
event.tfinger.y = y;
|
event.tfinger.y = y;
|
||||||
event.tfinger.dx = xrel;
|
event.tfinger.dx = xrel;
|
||||||
|
|
|
@ -160,11 +160,11 @@ static int SDL_SendGamepadButton(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_Gam
|
||||||
|
|
||||||
static SDL_bool HasSameOutput(SDL_GamepadBinding *a, SDL_GamepadBinding *b)
|
static SDL_bool HasSameOutput(SDL_GamepadBinding *a, SDL_GamepadBinding *b)
|
||||||
{
|
{
|
||||||
if (a->outputType != b->outputType) {
|
if (a->output_type != b->output_type) {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (a->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (a->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
return a->output.axis.axis == b->output.axis.axis;
|
return a->output.axis.axis == b->output.axis.axis;
|
||||||
} else {
|
} else {
|
||||||
return a->output.button == b->output.button;
|
return a->output.button == b->output.button;
|
||||||
|
@ -173,7 +173,7 @@ static SDL_bool HasSameOutput(SDL_GamepadBinding *a, SDL_GamepadBinding *b)
|
||||||
|
|
||||||
static void ResetOutput(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadBinding *bind)
|
static void ResetOutput(Uint64 timestamp, SDL_Gamepad *gamepad, SDL_GamepadBinding *bind)
|
||||||
{
|
{
|
||||||
if (bind->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (bind->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
SDL_SendGamepadAxis(timestamp, gamepad, bind->output.axis.axis, 0);
|
SDL_SendGamepadAxis(timestamp, gamepad, bind->output.axis.axis, 0);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendGamepadButton(timestamp, gamepad, bind->output.button, SDL_RELEASED);
|
SDL_SendGamepadButton(timestamp, gamepad, bind->output.button, SDL_RELEASED);
|
||||||
|
@ -191,7 +191,7 @@ static void HandleJoystickAxis(Uint64 timestamp, SDL_Gamepad *gamepad, int axis,
|
||||||
last_match = gamepad->last_match_axis[axis];
|
last_match = gamepad->last_match_axis[axis];
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
||||||
axis == binding->input.axis.axis) {
|
axis == binding->input.axis.axis) {
|
||||||
if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
|
if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
|
||||||
if (value >= binding->input.axis.axis_min &&
|
if (value >= binding->input.axis.axis_min &&
|
||||||
|
@ -215,7 +215,7 @@ static void HandleJoystickAxis(Uint64 timestamp, SDL_Gamepad *gamepad, int axis,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
if (match->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (match->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) {
|
if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) {
|
||||||
float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min);
|
float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min);
|
||||||
value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min));
|
value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min));
|
||||||
|
@ -243,9 +243,9 @@ static void HandleJoystickButton(Uint64 timestamp, SDL_Gamepad *gamepad, int but
|
||||||
|
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON &&
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_BUTTON &&
|
||||||
button == binding->input.button) {
|
button == binding->input.button) {
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min;
|
int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min;
|
||||||
SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)value);
|
SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -267,10 +267,10 @@ static void HandleJoystickHat(Uint64 timestamp, SDL_Gamepad *gamepad, int hat, U
|
||||||
changed_mask = (last_mask ^ value);
|
changed_mask = (last_mask ^ value);
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT && hat == binding->input.hat.hat) {
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_HAT && hat == binding->input.hat.hat) {
|
||||||
if ((changed_mask & binding->input.hat.hat_mask) != 0) {
|
if ((changed_mask & binding->input.hat.hat_mask) != 0) {
|
||||||
if (value & binding->input.hat.hat_mask) {
|
if (value & binding->input.hat.hat_mask) {
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max);
|
SDL_SendGamepadAxis(timestamp, gamepad, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max);
|
||||||
} else {
|
} else {
|
||||||
SDL_SendGamepadButton(timestamp, gamepad, binding->output.button, SDL_PRESSED);
|
SDL_SendGamepadButton(timestamp, gamepad, binding->output.button, SDL_PRESSED);
|
||||||
|
@ -1173,7 +1173,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
|
||||||
axis = SDL_GetGamepadAxisFromString(szGameButton);
|
axis = SDL_GetGamepadAxisFromString(szGameButton);
|
||||||
button = SDL_PrivateGetGamepadButtonFromString(szGameButton, baxy_mapping);
|
button = SDL_PrivateGetGamepadButtonFromString(szGameButton, baxy_mapping);
|
||||||
if (axis != SDL_GAMEPAD_AXIS_INVALID) {
|
if (axis != SDL_GAMEPAD_AXIS_INVALID) {
|
||||||
bind.outputType = SDL_GAMEPAD_BINDTYPE_AXIS;
|
bind.output_type = SDL_GAMEPAD_BINDTYPE_AXIS;
|
||||||
bind.output.axis.axis = axis;
|
bind.output.axis.axis = axis;
|
||||||
if (axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER || axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
if (axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER || axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER) {
|
||||||
bind.output.axis.axis_min = 0;
|
bind.output.axis.axis_min = 0;
|
||||||
|
@ -1191,7 +1191,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (button != SDL_GAMEPAD_BUTTON_INVALID) {
|
} else if (button != SDL_GAMEPAD_BUTTON_INVALID) {
|
||||||
bind.outputType = SDL_GAMEPAD_BINDTYPE_BUTTON;
|
bind.output_type = SDL_GAMEPAD_BINDTYPE_BUTTON;
|
||||||
bind.output.button = button;
|
bind.output.button = button;
|
||||||
} else {
|
} else {
|
||||||
return SDL_FALSE;
|
return SDL_FALSE;
|
||||||
|
@ -1205,7 +1205,7 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
|
||||||
}
|
}
|
||||||
|
|
||||||
if (szJoystickButton[0] == 'a' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
|
if (szJoystickButton[0] == 'a' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
|
||||||
bind.inputType = SDL_GAMEPAD_BINDTYPE_AXIS;
|
bind.input_type = SDL_GAMEPAD_BINDTYPE_AXIS;
|
||||||
bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]);
|
bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]);
|
||||||
if (half_axis_input == '+') {
|
if (half_axis_input == '+') {
|
||||||
bind.input.axis.axis_min = 0;
|
bind.input.axis.axis_min = 0;
|
||||||
|
@ -1223,13 +1223,13 @@ static SDL_bool SDL_PrivateParseGamepadElement(SDL_Gamepad *gamepad, const char
|
||||||
bind.input.axis.axis_max = tmp;
|
bind.input.axis.axis_max = tmp;
|
||||||
}
|
}
|
||||||
} else if (szJoystickButton[0] == 'b' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
|
} else if (szJoystickButton[0] == 'b' && SDL_isdigit((unsigned char)szJoystickButton[1])) {
|
||||||
bind.inputType = SDL_GAMEPAD_BINDTYPE_BUTTON;
|
bind.input_type = SDL_GAMEPAD_BINDTYPE_BUTTON;
|
||||||
bind.input.button = SDL_atoi(&szJoystickButton[1]);
|
bind.input.button = SDL_atoi(&szJoystickButton[1]);
|
||||||
} else if (szJoystickButton[0] == 'h' && SDL_isdigit((unsigned char)szJoystickButton[1]) &&
|
} else if (szJoystickButton[0] == 'h' && SDL_isdigit((unsigned char)szJoystickButton[1]) &&
|
||||||
szJoystickButton[2] == '.' && SDL_isdigit((unsigned char)szJoystickButton[3])) {
|
szJoystickButton[2] == '.' && SDL_isdigit((unsigned char)szJoystickButton[3])) {
|
||||||
int hat = SDL_atoi(&szJoystickButton[1]);
|
int hat = SDL_atoi(&szJoystickButton[1]);
|
||||||
int mask = SDL_atoi(&szJoystickButton[3]);
|
int mask = SDL_atoi(&szJoystickButton[3]);
|
||||||
bind.inputType = SDL_GAMEPAD_BINDTYPE_HAT;
|
bind.input_type = SDL_GAMEPAD_BINDTYPE_HAT;
|
||||||
bind.input.hat.hat = hat;
|
bind.input.hat.hat = hat;
|
||||||
bind.input.hat.hat_mask = mask;
|
bind.input.hat.hat_mask = mask;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1419,8 +1419,8 @@ static void SDL_PrivateLoadButtonMapping(SDL_Gamepad *gamepad, GamepadMapping_t
|
||||||
/* Set the zero point for triggers */
|
/* Set the zero point for triggers */
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
||||||
binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS &&
|
||||||
(binding->output.axis.axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER ||
|
(binding->output.axis.axis == SDL_GAMEPAD_AXIS_LEFT_TRIGGER ||
|
||||||
binding->output.axis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER)) {
|
binding->output.axis.axis == SDL_GAMEPAD_AXIS_RIGHT_TRIGGER)) {
|
||||||
if (binding->input.axis.axis < gamepad->joystick->naxes) {
|
if (binding->input.axis.axis < gamepad->joystick->naxes) {
|
||||||
|
@ -2671,7 +2671,7 @@ SDL_bool SDL_GamepadHasAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
|
||||||
|
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
|
||||||
retval = SDL_TRUE;
|
retval = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2697,12 +2697,12 @@ Sint16 SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
|
||||||
|
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_AXIS && binding->output.axis.axis == axis) {
|
||||||
int value = 0;
|
int value = 0;
|
||||||
SDL_bool valid_input_range;
|
SDL_bool valid_input_range;
|
||||||
SDL_bool valid_output_range;
|
SDL_bool valid_output_range;
|
||||||
|
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
value = SDL_GetJoystickAxis(gamepad->joystick, binding->input.axis.axis);
|
value = SDL_GetJoystickAxis(gamepad->joystick, binding->input.axis.axis);
|
||||||
if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
|
if (binding->input.axis.axis_min < binding->input.axis.axis_max) {
|
||||||
valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max);
|
valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max);
|
||||||
|
@ -2717,12 +2717,12 @@ Sint16 SDL_GetGamepadAxis(SDL_Gamepad *gamepad, SDL_GamepadAxis axis)
|
||||||
} else {
|
} else {
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
} else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON) {
|
} else if (binding->input_type == SDL_GAMEPAD_BINDTYPE_BUTTON) {
|
||||||
value = SDL_GetJoystickButton(gamepad->joystick, binding->input.button);
|
value = SDL_GetJoystickButton(gamepad->joystick, binding->input.button);
|
||||||
if (value == SDL_PRESSED) {
|
if (value == SDL_PRESSED) {
|
||||||
value = binding->output.axis.axis_max;
|
value = binding->output.axis.axis_max;
|
||||||
}
|
}
|
||||||
} else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT) {
|
} else if (binding->input_type == SDL_GAMEPAD_BINDTYPE_HAT) {
|
||||||
int hat_mask = SDL_GetJoystickHat(gamepad->joystick, binding->input.hat.hat);
|
int hat_mask = SDL_GetJoystickHat(gamepad->joystick, binding->input.hat.hat);
|
||||||
if (hat_mask & binding->input.hat.hat_mask) {
|
if (hat_mask & binding->input.hat.hat_mask) {
|
||||||
value = binding->output.axis.axis_max;
|
value = binding->output.axis.axis_max;
|
||||||
|
@ -2762,7 +2762,7 @@ SDL_bool SDL_GamepadHasButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
|
||||||
|
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && binding->output.button == button) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && binding->output.button == button) {
|
||||||
retval = SDL_TRUE;
|
retval = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2788,8 +2788,8 @@ Uint8 SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
|
||||||
|
|
||||||
for (i = 0; i < gamepad->num_bindings; ++i) {
|
for (i = 0; i < gamepad->num_bindings; ++i) {
|
||||||
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
SDL_GamepadBinding *binding = &gamepad->bindings[i];
|
||||||
if (binding->outputType == SDL_GAMEPAD_BINDTYPE_BUTTON && binding->output.button == button) {
|
if (binding->output_type == SDL_GAMEPAD_BINDTYPE_BUTTON && binding->output.button == button) {
|
||||||
if (binding->inputType == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
if (binding->input_type == SDL_GAMEPAD_BINDTYPE_AXIS) {
|
||||||
SDL_bool valid_input_range;
|
SDL_bool valid_input_range;
|
||||||
|
|
||||||
int value = SDL_GetJoystickAxis(gamepad->joystick, binding->input.axis.axis);
|
int value = SDL_GetJoystickAxis(gamepad->joystick, binding->input.axis.axis);
|
||||||
|
@ -2807,10 +2807,10 @@ Uint8 SDL_GetGamepadButton(SDL_Gamepad *gamepad, SDL_GamepadButton button)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_BUTTON) {
|
} else if (binding->input_type == SDL_GAMEPAD_BINDTYPE_BUTTON) {
|
||||||
retval = SDL_GetJoystickButton(gamepad->joystick, binding->input.button);
|
retval = SDL_GetJoystickButton(gamepad->joystick, binding->input.button);
|
||||||
break;
|
break;
|
||||||
} else if (binding->inputType == SDL_GAMEPAD_BINDTYPE_HAT) {
|
} else if (binding->input_type == SDL_GAMEPAD_BINDTYPE_HAT) {
|
||||||
int hat_mask = SDL_GetJoystickHat(gamepad->joystick, binding->input.hat.hat);
|
int hat_mask = SDL_GetJoystickHat(gamepad->joystick, binding->input.hat.hat);
|
||||||
retval = (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED;
|
retval = (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -2668,7 +2668,10 @@ int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event
|
||||||
} else if (event->type == SDL_EVENT_MOUSE_WHEEL) {
|
} else if (event->type == SDL_EVENT_MOUSE_WHEEL) {
|
||||||
SDL_Window *window = SDL_GetWindowFromID(event->wheel.windowID);
|
SDL_Window *window = SDL_GetWindowFromID(event->wheel.windowID);
|
||||||
if (window == renderer->window) {
|
if (window == renderer->window) {
|
||||||
SDL_RenderCoordinatesFromWindow(renderer, event->wheel.mouseX, event->wheel.mouseY, &event->wheel.mouseX, &event->wheel.mouseY);
|
SDL_RenderCoordinatesFromWindow(renderer, event->wheel.mouse_x,
|
||||||
|
event->wheel.mouse_y,
|
||||||
|
&event->wheel.mouse_x,
|
||||||
|
&event->wheel.mouse_y);
|
||||||
}
|
}
|
||||||
} else if (event->type == SDL_EVENT_FINGER_DOWN ||
|
} else if (event->type == SDL_EVENT_FINGER_DOWN ||
|
||||||
event->type == SDL_EVENT_FINGER_UP ||
|
event->type == SDL_EVENT_FINGER_UP ||
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
|
||||||
SDL_PixelFormat *fmt = dst->format;
|
SDL_PixelFormat *fmt = dst->format;
|
||||||
unsigned inva = 0xff - a;
|
unsigned inva = 0xff - a;
|
||||||
|
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
|
@ -181,7 +181,7 @@ static int SDL_BlendFillRect_RGBA(SDL_Surface *dst, const SDL_Rect *rect,
|
||||||
SDL_PixelFormat *fmt = dst->format;
|
SDL_PixelFormat *fmt = dst->format;
|
||||||
unsigned inva = 0xff - a;
|
unsigned inva = 0xff - a;
|
||||||
|
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 4:
|
case 4:
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
|
@ -216,7 +216,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
|
return SDL_SetError("SDL_BlendFillRect(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ int SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect,
|
||||||
b = DRAW_MUL(b, a);
|
b = DRAW_MUL(b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst->format->BitsPerPixel) {
|
switch (dst->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
switch (dst->format->Rmask) {
|
switch (dst->format->Rmask) {
|
||||||
case 0x7C00:
|
case 0x7C00:
|
||||||
|
@ -286,7 +286,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
|
return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Does this function pointer slow things down significantly? */
|
/* FIXME: Does this function pointer slow things down significantly? */
|
||||||
switch (dst->format->BitsPerPixel) {
|
switch (dst->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
switch (dst->format->Rmask) {
|
switch (dst->format->Rmask) {
|
||||||
case 0x7C00:
|
case 0x7C00:
|
||||||
|
|
|
@ -765,7 +765,7 @@ typedef void (*BlendLineFunc)(SDL_Surface *dst,
|
||||||
|
|
||||||
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
|
static BlendLineFunc SDL_CalculateBlendLineFunc(const SDL_PixelFormat *fmt)
|
||||||
{
|
{
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
if (fmt->Rmask == 0x7C00) {
|
if (fmt->Rmask == 0x7C00) {
|
||||||
return SDL_BlendLine_RGB555;
|
return SDL_BlendLine_RGB555;
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blen
|
||||||
SDL_PixelFormat *fmt = dst->format;
|
SDL_PixelFormat *fmt = dst->format;
|
||||||
unsigned inva = 0xff - a;
|
unsigned inva = 0xff - a;
|
||||||
|
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
|
@ -181,7 +181,7 @@ static int SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode ble
|
||||||
SDL_PixelFormat *fmt = dst->format;
|
SDL_PixelFormat *fmt = dst->format;
|
||||||
unsigned inva = 0xff - a;
|
unsigned inva = 0xff - a;
|
||||||
|
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 4:
|
case 4:
|
||||||
switch (blendMode) {
|
switch (blendMode) {
|
||||||
case SDL_BLENDMODE_BLEND:
|
case SDL_BLENDMODE_BLEND:
|
||||||
|
@ -214,7 +214,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
|
return SDL_SetError("SDL_BlendPoint(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ int SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint
|
||||||
b = DRAW_MUL(b, a);
|
b = DRAW_MUL(b, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst->format->BitsPerPixel) {
|
switch (dst->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
switch (dst->format->Rmask) {
|
switch (dst->format->Rmask) {
|
||||||
case 0x7C00:
|
case 0x7C00:
|
||||||
|
@ -282,7 +282,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
|
return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: Does this function pointer slow things down significantly? */
|
/* FIXME: Does this function pointer slow things down significantly? */
|
||||||
switch (dst->format->BitsPerPixel) {
|
switch (dst->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
switch (dst->format->Rmask) {
|
switch (dst->format->Rmask) {
|
||||||
case 0x7C00:
|
case 0x7C00:
|
||||||
|
|
|
@ -364,7 +364,7 @@
|
||||||
#define HLINE(type, op, draw_end) \
|
#define HLINE(type, op, draw_end) \
|
||||||
{ \
|
{ \
|
||||||
int length; \
|
int length; \
|
||||||
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
|
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||||
type *pixel; \
|
type *pixel; \
|
||||||
if (x1 <= x2) { \
|
if (x1 <= x2) { \
|
||||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||||
|
@ -386,7 +386,7 @@
|
||||||
#define VLINE(type, op, draw_end) \
|
#define VLINE(type, op, draw_end) \
|
||||||
{ \
|
{ \
|
||||||
int length; \
|
int length; \
|
||||||
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
|
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||||
type *pixel; \
|
type *pixel; \
|
||||||
if (y1 <= y2) { \
|
if (y1 <= y2) { \
|
||||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||||
|
@ -408,7 +408,7 @@
|
||||||
#define DLINE(type, op, draw_end) \
|
#define DLINE(type, op, draw_end) \
|
||||||
{ \
|
{ \
|
||||||
int length; \
|
int length; \
|
||||||
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
|
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||||
type *pixel; \
|
type *pixel; \
|
||||||
if (y1 <= y2) { \
|
if (y1 <= y2) { \
|
||||||
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
pixel = (type *)dst->pixels + y1 * pitch + x1; \
|
||||||
|
@ -628,7 +628,7 @@
|
||||||
do { \
|
do { \
|
||||||
int width = rect->w; \
|
int width = rect->w; \
|
||||||
int height = rect->h; \
|
int height = rect->h; \
|
||||||
int pitch = (dst->pitch / dst->format->BytesPerPixel); \
|
int pitch = (dst->pitch / dst->format->bytes_per_pixel); \
|
||||||
int skip = pitch - width; \
|
int skip = pitch - width; \
|
||||||
type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
|
type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
|
||||||
while (height--) { \
|
while (height--) { \
|
||||||
|
|
|
@ -31,7 +31,7 @@ static void SDL_DrawLine1(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
|
||||||
{
|
{
|
||||||
if (y1 == y2) {
|
if (y1 == y2) {
|
||||||
int length;
|
int length;
|
||||||
int pitch = (dst->pitch / dst->format->BytesPerPixel);
|
int pitch = (dst->pitch / dst->format->bytes_per_pixel);
|
||||||
Uint8 *pixel;
|
Uint8 *pixel;
|
||||||
if (x1 <= x2) {
|
if (x1 <= x2) {
|
||||||
pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
|
pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
|
||||||
|
@ -119,9 +119,9 @@ typedef void (*DrawLineFunc)(SDL_Surface *dst,
|
||||||
|
|
||||||
static DrawLineFunc SDL_CalculateDrawLineFunc(const SDL_PixelFormat *fmt)
|
static DrawLineFunc SDL_CalculateDrawLineFunc(const SDL_PixelFormat *fmt)
|
||||||
{
|
{
|
||||||
switch (fmt->BytesPerPixel) {
|
switch (fmt->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
if (fmt->BitsPerPixel < 8) {
|
if (fmt->bits_per_pixel < 8) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return SDL_DrawLine1;
|
return SDL_DrawLine1;
|
||||||
|
|
|
@ -32,7 +32,7 @@ int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
|
return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ int SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst->format->BytesPerPixel) {
|
switch (dst->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
DRAW_FASTSETPIXELXY1(x, y);
|
DRAW_FASTSETPIXELXY1(x, y);
|
||||||
break;
|
break;
|
||||||
|
@ -72,7 +72,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This function doesn't work on surfaces < 8 bpp */
|
/* This function doesn't work on surfaces < 8 bpp */
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
|
return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +89,7 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dst->format->BytesPerPixel) {
|
switch (dst->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
DRAW_FASTSETPIXELXY1(x, y);
|
DRAW_FASTSETPIXELXY1(x, y);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -143,8 +143,8 @@ static int SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
src = (Uint8 *)pixels;
|
src = (Uint8 *)pixels;
|
||||||
dst = (Uint8 *)surface->pixels +
|
dst = (Uint8 *)surface->pixels +
|
||||||
rect->y * surface->pitch +
|
rect->y * surface->pitch +
|
||||||
rect->x * surface->format->BytesPerPixel;
|
rect->x * surface->format->bytes_per_pixel;
|
||||||
length = (size_t)rect->w * surface->format->BytesPerPixel;
|
length = (size_t)rect->w * surface->format->bytes_per_pixel;
|
||||||
for (row = 0; row < rect->h; ++row) {
|
for (row = 0; row < rect->h; ++row) {
|
||||||
SDL_memcpy(dst, src, length);
|
SDL_memcpy(dst, src, length);
|
||||||
src += pitch;
|
src += pitch;
|
||||||
|
@ -163,7 +163,7 @@ static int SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
|
||||||
|
|
||||||
*pixels =
|
*pixels =
|
||||||
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
|
(void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
|
||||||
rect->x * surface->format->BytesPerPixel);
|
rect->x * surface->format->bytes_per_pixel);
|
||||||
*pitch = surface->pitch;
|
*pitch = surface->pitch;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||||
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
||||||
|
|
||||||
/* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */
|
/* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */
|
||||||
if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
|
if (src->format->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) {
|
||||||
blitRequired = SDL_TRUE;
|
blitRequired = SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||||
* to be created. This makes all source pixels opaque and the colors get copied correctly.
|
* to be created. This makes all source pixels opaque and the colors get copied correctly.
|
||||||
*/
|
*/
|
||||||
SDL_Surface *src_rotated_rgb;
|
SDL_Surface *src_rotated_rgb;
|
||||||
int f = SDL_GetPixelFormatEnumForMasks(src_rotated->format->BitsPerPixel,
|
int f = SDL_GetPixelFormatEnumForMasks(src_rotated->format->bits_per_pixel,
|
||||||
src_rotated->format->Rmask,
|
src_rotated->format->Rmask,
|
||||||
src_rotated->format->Gmask,
|
src_rotated->format->Gmask,
|
||||||
src_rotated->format->Bmask,
|
src_rotated->format->Bmask,
|
||||||
|
@ -995,7 +995,7 @@ static SDL_Surface *SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
||||||
|
|
||||||
pixels = (void *)((Uint8 *)surface->pixels +
|
pixels = (void *)((Uint8 *)surface->pixels +
|
||||||
rect->y * surface->pitch +
|
rect->y * surface->pitch +
|
||||||
rect->x * surface->format->BytesPerPixel);
|
rect->x * surface->format->bytes_per_pixel);
|
||||||
|
|
||||||
return SDL_DuplicatePixels(rect->w, rect->h, surface->format->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
|
return SDL_DuplicatePixels(rect->w, rect->h, surface->format->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -508,8 +508,8 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
||||||
is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable;
|
is8bit = src->format->bits_per_pixel == 8 && colorKeyAvailable;
|
||||||
if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) {
|
if (!(is8bit || (src->format->bits_per_pixel == 32 && src->format->Amask))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -299,13 +299,13 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
|
||||||
|
|
||||||
SDL_SetSurfaceBlendMode(tmp, blend);
|
SDL_SetSurfaceBlendMode(tmp, blend);
|
||||||
|
|
||||||
dstbpp = tmp->format->BytesPerPixel;
|
dstbpp = tmp->format->bytes_per_pixel;
|
||||||
dst_ptr = tmp->pixels;
|
dst_ptr = tmp->pixels;
|
||||||
dst_pitch = tmp->pitch;
|
dst_pitch = tmp->pitch;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* Write directly to destination surface */
|
/* Write directly to destination surface */
|
||||||
dstbpp = dst->format->BytesPerPixel;
|
dstbpp = dst->format->bytes_per_pixel;
|
||||||
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
||||||
dst_pitch = dst->pitch;
|
dst_pitch = dst->pitch;
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ int SDL_SW_BlitTriangle(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set destination pointer */
|
/* Set destination pointer */
|
||||||
dstbpp = dst->format->BytesPerPixel;
|
dstbpp = dst->format->bytes_per_pixel;
|
||||||
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
|
||||||
dst_pitch = dst->pitch;
|
dst_pitch = dst->pitch;
|
||||||
|
|
||||||
|
@ -794,8 +794,8 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
|
||||||
Uint32 dstR, dstG, dstB, dstA;
|
Uint32 dstR, dstG, dstB, dstA;
|
||||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||||
int srcbpp = src_fmt->BytesPerPixel;
|
int srcbpp = src_fmt->bytes_per_pixel;
|
||||||
int dstbpp = dst_fmt->BytesPerPixel;
|
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||||
int srcfmt_val;
|
int srcfmt_val;
|
||||||
int dstfmt_val;
|
int dstfmt_val;
|
||||||
Uint32 rgbmask = ~src_fmt->Amask;
|
Uint32 rgbmask = ~src_fmt->Amask;
|
||||||
|
|
|
@ -1890,8 +1890,8 @@ static void SDLTest_PrintEvent(const SDL_Event *event)
|
||||||
|
|
||||||
case SDL_EVENT_FINGER_MOTION:
|
case SDL_EVENT_FINGER_MOTION:
|
||||||
SDL_Log("SDL EVENT: Finger: motion touch=%" SDL_PRIu64 ", finger=%" SDL_PRIu64 ", x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
|
SDL_Log("SDL EVENT: Finger: motion touch=%" SDL_PRIu64 ", finger=%" SDL_PRIu64 ", x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
|
||||||
event->tfinger.touchId,
|
event->tfinger.touchID,
|
||||||
event->tfinger.fingerId,
|
event->tfinger.fingerID,
|
||||||
event->tfinger.x, event->tfinger.y,
|
event->tfinger.x, event->tfinger.y,
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
||||||
break;
|
break;
|
||||||
|
@ -1899,8 +1899,8 @@ static void SDLTest_PrintEvent(const SDL_Event *event)
|
||||||
case SDL_EVENT_FINGER_UP:
|
case SDL_EVENT_FINGER_UP:
|
||||||
SDL_Log("SDL EVENT: Finger: %s touch=%" SDL_PRIu64 ", finger=%" SDL_PRIu64 ", x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
|
SDL_Log("SDL EVENT: Finger: %s touch=%" SDL_PRIu64 ", finger=%" SDL_PRIu64 ", x=%f, y=%f, dx=%f, dy=%f, pressure=%f",
|
||||||
(event->type == SDL_EVENT_FINGER_DOWN) ? "down" : "up",
|
(event->type == SDL_EVENT_FINGER_DOWN) ? "down" : "up",
|
||||||
event->tfinger.touchId,
|
event->tfinger.touchID,
|
||||||
event->tfinger.fingerId,
|
event->tfinger.fingerID,
|
||||||
event->tfinger.x, event->tfinger.y,
|
event->tfinger.x, event->tfinger.y,
|
||||||
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -36,7 +36,8 @@ static int _CompareSurfaceCount = 0;
|
||||||
static void
|
static void
|
||||||
LogErrorFormat(const char *name, const SDL_PixelFormat *format)
|
LogErrorFormat(const char *name, const SDL_PixelFormat *format)
|
||||||
{
|
{
|
||||||
SDLTest_LogError("%s: %08" SDL_PRIx32 " %s, %u bits/%u bytes per pixel", name, format->format, SDL_GetPixelFormatName(format->format), format->BitsPerPixel, format->BytesPerPixel);
|
SDLTest_LogError("%s: %08" SDL_PRIx32 " %s, %u bits/%u bytes per pixel", name, format->format, SDL_GetPixelFormatName(format->format),
|
||||||
|
format->bits_per_pixel, format->bytes_per_pixel);
|
||||||
SDLTest_LogError("%s: R mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Rmask, format->Rloss, format->Rshift);
|
SDLTest_LogError("%s: R mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Rmask, format->Rloss, format->Rshift);
|
||||||
SDLTest_LogError("%s: G mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Gmask, format->Gloss, format->Gshift);
|
SDLTest_LogError("%s: G mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Gmask, format->Gloss, format->Gshift);
|
||||||
SDLTest_LogError("%s: B mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Bmask, format->Bloss, format->Bshift);
|
SDLTest_LogError("%s: B mask %08" SDL_PRIx32 ", loss %u, shift %u", name, format->Bmask, format->Bloss, format->Bshift);
|
||||||
|
|
|
@ -297,7 +297,7 @@
|
||||||
#define CHOOSE_BLIT(blitter, alpha, fmt) \
|
#define CHOOSE_BLIT(blitter, alpha, fmt) \
|
||||||
do { \
|
do { \
|
||||||
if (alpha == 255) { \
|
if (alpha == 255) { \
|
||||||
switch (fmt->BytesPerPixel) { \
|
switch (fmt->bytes_per_pixel) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
blitter(1, Uint8, OPAQUE_BLIT); \
|
blitter(1, Uint8, OPAQUE_BLIT); \
|
||||||
break; \
|
break; \
|
||||||
|
@ -312,7 +312,7 @@
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
} else { \
|
} else { \
|
||||||
switch (fmt->BytesPerPixel) { \
|
switch (fmt->bytes_per_pixel) { \
|
||||||
case 1: \
|
case 1: \
|
||||||
/* No 8bpp alpha blitting */ \
|
/* No 8bpp alpha blitting */ \
|
||||||
break; \
|
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 */
|
/* Set up the source and destination pointers */
|
||||||
x = dstrect->x;
|
x = dstrect->x;
|
||||||
y = dstrect->y;
|
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;
|
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:
|
case 1:
|
||||||
RLESKIP(1, Uint8);
|
RLESKIP(1, Uint8);
|
||||||
break;
|
break;
|
||||||
|
@ -608,7 +608,7 @@ done:
|
||||||
macro-compatible with SDL_PixelFormat but without the unneeded fields */
|
macro-compatible with SDL_PixelFormat but without the unneeded fields */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Uint8 BytesPerPixel;
|
Uint8 bytes_per_pixel;
|
||||||
Uint8 padding[3];
|
Uint8 padding[3];
|
||||||
Uint32 Rmask;
|
Uint32 Rmask;
|
||||||
Uint32 Gmask;
|
Uint32 Gmask;
|
||||||
|
@ -702,7 +702,7 @@ static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst,
|
||||||
} while (--linecount); \
|
} while (--linecount); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
||||||
RLEALPHACLIPBLIT(Uint16, Uint8, BLIT_TRANSL_565);
|
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;
|
x = dstrect->x;
|
||||||
y = dstrect->y;
|
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);
|
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;
|
int vskip = srcrect->y;
|
||||||
if (vskip) {
|
if (vskip) {
|
||||||
int ofs;
|
int ofs;
|
||||||
if (df->BytesPerPixel == 2) {
|
if (df->bytes_per_pixel == 2) {
|
||||||
/* the 16/32 interleaved format */
|
/* the 16/32 interleaved format */
|
||||||
do {
|
do {
|
||||||
/* skip opaque line */
|
/* skip opaque line */
|
||||||
|
@ -850,7 +850,7 @@ static int SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcre
|
||||||
} while (--linecount); \
|
} while (--linecount); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
if (df->Gmask == 0x07e0 || df->Rmask == 0x07e0 || df->Bmask == 0x07e0) {
|
||||||
RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_565);
|
RLEALPHABLIT(Uint16, Uint8, BLIT_TRANSL_565);
|
||||||
|
@ -1027,14 +1027,14 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
df = dest->format;
|
df = dest->format;
|
||||||
if (surface->format->BitsPerPixel != 32) {
|
if (surface->format->bits_per_pixel != 32) {
|
||||||
return -1; /* only 32bpp source supported */
|
return -1; /* only 32bpp source supported */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find out whether the destination is one we support,
|
/* find out whether the destination is one we support,
|
||||||
and determine the max size of the encoded result */
|
and determine the max size of the encoded result */
|
||||||
masksum = df->Rmask | df->Gmask | df->Bmask;
|
masksum = df->Rmask | df->Gmask | df->Bmask;
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->bytes_per_pixel) {
|
||||||
case 2:
|
case 2:
|
||||||
/* 16bpp: only support 565 and 555 formats */
|
/* 16bpp: only support 565 and 555 formats */
|
||||||
switch (masksum) {
|
switch (masksum) {
|
||||||
|
@ -1086,7 +1086,7 @@ static int RLEAlphaSurface(SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
/* save the destination format so we can undo the encoding later */
|
/* save the destination format so we can undo the encoding later */
|
||||||
RLEDestFormat *r = (RLEDestFormat *)rlebuf;
|
RLEDestFormat *r = (RLEDestFormat *)rlebuf;
|
||||||
r->BytesPerPixel = df->BytesPerPixel;
|
r->bytes_per_pixel = df->bytes_per_pixel;
|
||||||
r->Rmask = df->Rmask;
|
r->Rmask = df->Rmask;
|
||||||
r->Gmask = df->Gmask;
|
r->Gmask = df->Gmask;
|
||||||
r->Bmask = df->Bmask;
|
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 */
|
/* opaque counts are 8 or 16 bits, depending on target depth */
|
||||||
#define ADD_OPAQUE_COUNTS(n, m) \
|
#define ADD_OPAQUE_COUNTS(n, m) \
|
||||||
if (df->BytesPerPixel == 4) { \
|
if (df->bytes_per_pixel == 4) { \
|
||||||
((Uint16 *)dst)[0] = (Uint16)n; \
|
((Uint16 *)dst)[0] = (Uint16)n; \
|
||||||
((Uint16 *)dst)[1] = (Uint16)m; \
|
((Uint16 *)dst)[1] = (Uint16)m; \
|
||||||
dst += 4; \
|
dst += 4; \
|
||||||
|
@ -1272,7 +1272,7 @@ static int RLEColorkeySurface(SDL_Surface *surface)
|
||||||
int y;
|
int y;
|
||||||
Uint8 *srcbuf, *lastline;
|
Uint8 *srcbuf, *lastline;
|
||||||
int maxsize = 0;
|
int maxsize = 0;
|
||||||
const int bpp = surface->format->BytesPerPixel;
|
const int bpp = surface->format->bytes_per_pixel;
|
||||||
getpix_func getpix;
|
getpix_func getpix;
|
||||||
Uint32 ckey, rgbmask;
|
Uint32 ckey, rgbmask;
|
||||||
int w, h;
|
int w, h;
|
||||||
|
@ -1413,7 +1413,7 @@ int SDL_RLESurface(SDL_Surface *surface)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't support RLE encoding of bitmaps */
|
/* We don't support RLE encoding of bitmaps */
|
||||||
if (surface->format->BitsPerPixel < 8) {
|
if (surface->format->bits_per_pixel < 8) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1481,7 +1481,7 @@ static SDL_bool UnRLEAlpha(SDL_Surface *surface)
|
||||||
int (*uncopy_transl)(Uint32 *, void *, int,
|
int (*uncopy_transl)(Uint32 *, void *, int,
|
||||||
RLEDestFormat *, SDL_PixelFormat *);
|
RLEDestFormat *, SDL_PixelFormat *);
|
||||||
int w = surface->w;
|
int w = surface->w;
|
||||||
int bpp = df->BytesPerPixel;
|
int bpp = df->bytes_per_pixel;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
if (bpp == 2) {
|
if (bpp == 2) {
|
||||||
|
|
|
@ -66,20 +66,20 @@ static int SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||||
/* Set up the blit information */
|
/* Set up the blit information */
|
||||||
info->src = (Uint8 *)src->pixels +
|
info->src = (Uint8 *)src->pixels +
|
||||||
(Uint16)srcrect->y * src->pitch +
|
(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_w = srcrect->w;
|
||||||
info->src_h = srcrect->h;
|
info->src_h = srcrect->h;
|
||||||
info->src_pitch = src->pitch;
|
info->src_pitch = src->pitch;
|
||||||
info->src_skip =
|
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 =
|
info->dst =
|
||||||
(Uint8 *)dst->pixels + (Uint16)dstrect->y * dst->pitch +
|
(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_w = dstrect->w;
|
||||||
info->dst_h = dstrect->h;
|
info->dst_h = dstrect->h;
|
||||||
info->dst_pitch = dst->pitch;
|
info->dst_pitch = dst->pitch;
|
||||||
info->dst_skip =
|
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;
|
RunBlit = (SDL_BlitFunc)src->map->data;
|
||||||
|
|
||||||
/* Run the actual software blit */
|
/* 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 */
|
/* 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);
|
SDL_InvalidateMap(map);
|
||||||
return SDL_SetError("Blit combination not supported");
|
return SDL_SetError("Blit combination not supported");
|
||||||
}
|
}
|
||||||
|
@ -232,8 +232,8 @@ int SDL_CalculateBlit(SDL_Surface *surface)
|
||||||
/* Choose a standard blit function */
|
/* Choose a standard blit function */
|
||||||
if (!blit) {
|
if (!blit) {
|
||||||
if (src_colorspace != dst_colorspace ||
|
if (src_colorspace != dst_colorspace ||
|
||||||
surface->format->BytesPerPixel > 4 ||
|
surface->format->bytes_per_pixel > 4 ||
|
||||||
dst->format->BytesPerPixel > 4) {
|
dst->format->bytes_per_pixel > 4) {
|
||||||
blit = SDL_Blit_Slow_Float;
|
blit = SDL_Blit_Slow_Float;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -244,13 +244,13 @@ int SDL_CalculateBlit(SDL_Surface *surface)
|
||||||
blit = SDL_Blit_Slow;
|
blit = SDL_Blit_Slow;
|
||||||
}
|
}
|
||||||
#if SDL_HAVE_BLIT_0
|
#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)) {
|
SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||||
blit = SDL_CalculateBlit0(surface);
|
blit = SDL_CalculateBlit0(surface);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if SDL_HAVE_BLIT_1
|
#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)) {
|
SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||||
blit = SDL_CalculateBlit1(surface);
|
blit = SDL_CalculateBlit1(surface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -625,7 +625,7 @@ SDL_FORCE_INLINE void BlitBtoNAlpha(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||||
const unsigned A = info->a;
|
const unsigned A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
if (srcbpp == 4)
|
if (srcbpp == 4)
|
||||||
srcskip += width - (width + 1) / 2;
|
srcskip += width - (width + 1) / 2;
|
||||||
else if (srcbpp == 2)
|
else if (srcbpp == 2)
|
||||||
|
@ -703,7 +703,7 @@ SDL_FORCE_INLINE void BlitBtoNAlphaKey(SDL_BlitInfo *info, const Uint32 srcbpp)
|
||||||
Uint32 ckey = info->colorkey;
|
Uint32 ckey = info->colorkey;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
if (srcbpp == 4)
|
if (srcbpp == 4)
|
||||||
srcskip += width - (width + 1) / 2;
|
srcskip += width - (width + 1) / 2;
|
||||||
else if (srcbpp == 2)
|
else if (srcbpp == 2)
|
||||||
|
@ -920,10 +920,10 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
|
|
||||||
if (surface->map->dst->format->BitsPerPixel < 8) {
|
if (surface->map->dst->format->bits_per_pixel < 8) {
|
||||||
which = 0;
|
which = 0;
|
||||||
} else {
|
} else {
|
||||||
which = surface->map->dst->format->BytesPerPixel;
|
which = surface->map->dst->format->bytes_per_pixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX1) {
|
if (SDL_PIXELTYPE(surface->format->format) == SDL_PIXELTYPE_INDEX1) {
|
||||||
|
|
|
@ -440,7 +440,7 @@ static void Blit1toNAlpha(SDL_BlitInfo *info)
|
||||||
const unsigned A = info->a;
|
const unsigned A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
/* *INDENT-OFF* */ /* clang-format off */
|
||||||
|
@ -481,7 +481,7 @@ static void Blit1toNAlphaKey(SDL_BlitInfo *info)
|
||||||
const unsigned A = info->a;
|
const unsigned A = info->a;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
/* *INDENT-OFF* */ /* clang-format off */
|
||||||
|
@ -520,10 +520,10 @@ SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface *surface)
|
||||||
SDL_PixelFormat *dstfmt;
|
SDL_PixelFormat *dstfmt;
|
||||||
|
|
||||||
dstfmt = surface->map->dst->format;
|
dstfmt = surface->map->dst->format;
|
||||||
if (dstfmt->BitsPerPixel < 8) {
|
if (dstfmt->bits_per_pixel < 8) {
|
||||||
which = 0;
|
which = 0;
|
||||||
} else {
|
} else {
|
||||||
which = dstfmt->BytesPerPixel;
|
which = dstfmt->bytes_per_pixel;
|
||||||
}
|
}
|
||||||
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
|
@ -38,7 +38,7 @@ static void BlitNto1SurfaceAlpha(SDL_BlitInfo *info)
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB;
|
unsigned sR, sG, sB;
|
||||||
unsigned dR, dG, dB;
|
unsigned dR, dG, dB;
|
||||||
|
@ -84,7 +84,7 @@ static void BlitNto1PixelAlpha(SDL_BlitInfo *info)
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB, sA;
|
unsigned sR, sG, sB, sA;
|
||||||
unsigned dR, dG, dB;
|
unsigned dR, dG, dB;
|
||||||
|
@ -129,7 +129,7 @@ static void BlitNto1SurfaceAlphaKey(SDL_BlitInfo *info)
|
||||||
Uint8 *palmap = info->table;
|
Uint8 *palmap = info->table;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
Uint32 ckey = info->colorkey;
|
Uint32 ckey = info->colorkey;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB;
|
unsigned sR, sG, sB;
|
||||||
|
@ -1208,8 +1208,8 @@ static void BlitNtoNSurfaceAlpha(SDL_BlitInfo *info)
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB;
|
unsigned sR, sG, sB;
|
||||||
unsigned dR, dG, dB, dA;
|
unsigned dR, dG, dB, dA;
|
||||||
|
@ -1247,8 +1247,8 @@ static void BlitNtoNSurfaceAlphaKey(SDL_BlitInfo *info)
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
Uint32 ckey = info->colorkey;
|
Uint32 ckey = info->colorkey;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB;
|
unsigned sR, sG, sB;
|
||||||
unsigned dR, dG, dB, dA;
|
unsigned dR, dG, dB, dA;
|
||||||
|
@ -1293,8 +1293,8 @@ static void BlitNtoNPixelAlpha(SDL_BlitInfo *info)
|
||||||
unsigned dR, dG, dB, dA;
|
unsigned dR, dG, dB, dA;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
srcbpp = srcfmt->BytesPerPixel;
|
srcbpp = srcfmt->bytes_per_pixel;
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
|
|
||||||
while (height--) {
|
while (height--) {
|
||||||
/* *INDENT-OFF* */ /* clang-format off */
|
/* *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) {
|
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||||
case SDL_COPY_BLEND:
|
case SDL_COPY_BLEND:
|
||||||
/* Per-pixel alpha blits */
|
/* Per-pixel alpha blits */
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
if (df->palette) {
|
if (df->palette) {
|
||||||
return BlitNto1PixelAlpha;
|
return BlitNto1PixelAlpha;
|
||||||
|
@ -1335,7 +1335,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
#if defined(SDL_ARM_NEON_BLITTERS) || defined(SDL_ARM_SIMD_BLITTERS)
|
#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
|
#ifdef SDL_ARM_NEON_BLITTERS
|
||||||
if (SDL_HasNEON()) {
|
if (SDL_HasNEON()) {
|
||||||
return BlitARGBto565PixelAlphaARMNEON;
|
return BlitARGBto565PixelAlphaARMNEON;
|
||||||
|
@ -1348,7 +1348,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#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) {
|
if (df->Gmask == 0x7e0) {
|
||||||
return BlitARGBto565PixelAlpha;
|
return BlitARGBto565PixelAlpha;
|
||||||
} else if (df->Gmask == 0x3e0) {
|
} else if (df->Gmask == 0x3e0) {
|
||||||
|
@ -1358,7 +1358,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
return BlitNtoNPixelAlpha;
|
return BlitNtoNPixelAlpha;
|
||||||
|
|
||||||
case 4:
|
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
|
#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 (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && sf->Ashift % 8 == 0 && sf->Aloss == 0) {
|
||||||
if (SDL_HasMMX()) {
|
if (SDL_HasMMX()) {
|
||||||
|
@ -1379,7 +1379,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
#endif
|
#endif
|
||||||
return BlitRGBtoRGBPixelAlpha;
|
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) {
|
if (sf->Amask == 0xff000000) {
|
||||||
return BlitRGBtoBGRPixelAlpha;
|
return BlitRGBtoBGRPixelAlpha;
|
||||||
}
|
}
|
||||||
|
@ -1395,7 +1395,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
if (sf->Amask == 0) {
|
if (sf->Amask == 0) {
|
||||||
/* Per-surface alpha blits */
|
/* Per-surface alpha blits */
|
||||||
switch (df->BytesPerPixel) {
|
switch (df->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
if (df->palette) {
|
if (df->palette) {
|
||||||
return BlitNto1SurfaceAlpha;
|
return BlitNto1SurfaceAlpha;
|
||||||
|
@ -1429,7 +1429,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
return BlitNtoNSurfaceAlpha;
|
return BlitNtoNSurfaceAlpha;
|
||||||
|
|
||||||
case 4:
|
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
|
#ifdef SDL_MMX_INTRINSICS
|
||||||
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) {
|
if (sf->Rshift % 8 == 0 && sf->Gshift % 8 == 0 && sf->Bshift % 8 == 0 && SDL_HasMMX()) {
|
||||||
return BlitRGBtoRGBSurfaceAlphaMMX;
|
return BlitRGBtoRGBSurfaceAlphaMMX;
|
||||||
|
@ -1450,7 +1450,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
|
||||||
|
|
||||||
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
case SDL_COPY_COLORKEY | SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND:
|
||||||
if (sf->Amask == 0) {
|
if (sf->Amask == 0) {
|
||||||
if (df->BytesPerPixel == 1) {
|
if (df->bytes_per_pixel == 1) {
|
||||||
|
|
||||||
if (df->palette) {
|
if (df->palette) {
|
||||||
return BlitNto1SurfaceAlphaKey;
|
return BlitNto1SurfaceAlphaKey;
|
||||||
|
|
|
@ -345,8 +345,8 @@ static void Blit_RGB565_32Altivec(SDL_BlitInfo *info)
|
||||||
vector unsigned char vgreen2 =
|
vector unsigned char vgreen2 =
|
||||||
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
||||||
|
|
||||||
SDL_assert(srcfmt->BytesPerPixel == 2);
|
SDL_assert(srcfmt->bytes_per_pixel == 2);
|
||||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||||
|
|
||||||
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
||||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
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 vgreen2 =
|
||||||
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
(vector unsigned char)(vec_add((vector unsigned int)vgreen1, vec_sl(v8, v8)));
|
||||||
|
|
||||||
SDL_assert(srcfmt->BytesPerPixel == 2);
|
SDL_assert(srcfmt->bytes_per_pixel == 2);
|
||||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||||
|
|
||||||
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
vf800 = (vector unsigned short)vec_splat_u8(-7);
|
||||||
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
vf800 = vec_sl(vf800, vec_splat_u16(8));
|
||||||
|
@ -581,9 +581,9 @@ static void Blit32to32KeyAltivec(SDL_BlitInfo *info)
|
||||||
Uint32 *dstp = (Uint32 *)info->dst;
|
Uint32 *dstp = (Uint32 *)info->dst;
|
||||||
int dstskip = info->dst_skip / 4;
|
int dstskip = info->dst_skip / 4;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
|
int copy_alpha = (srcfmt->Amask && dstfmt->Amask);
|
||||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
Uint32 rgbmask = srcfmt->Rmask | srcfmt->Gmask | srcfmt->Bmask;
|
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(srcfmt->bytes_per_pixel == 4);
|
||||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||||
|
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
/* reorder bytes for PowerPC little 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(srcfmt->bytes_per_pixel == 4);
|
||||||
SDL_assert(dstfmt->BytesPerPixel == 4);
|
SDL_assert(dstfmt->bytes_per_pixel == 4);
|
||||||
|
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
/* reorder bytes for PowerPC little endian */
|
/* reorder bytes for PowerPC little endian */
|
||||||
|
@ -2107,7 +2107,7 @@ static void BlitNto1(SDL_BlitInfo *info)
|
||||||
dstskip = info->dst_skip;
|
dstskip = info->dst_skip;
|
||||||
map = info->table;
|
map = info->table;
|
||||||
srcfmt = info->src_fmt;
|
srcfmt = info->src_fmt;
|
||||||
srcbpp = srcfmt->BytesPerPixel;
|
srcbpp = srcfmt->bytes_per_pixel;
|
||||||
|
|
||||||
if (!map) {
|
if (!map) {
|
||||||
while (height--) {
|
while (height--) {
|
||||||
|
@ -2232,8 +2232,8 @@ static void get_permutation(SDL_PixelFormat *srcfmt, SDL_PixelFormat *dstfmt,
|
||||||
int Pixel = 0x04030201; /* identity permutation */
|
int Pixel = 0x04030201; /* identity permutation */
|
||||||
#else
|
#else
|
||||||
int Pixel = 0x01020304; /* identity permutation */
|
int Pixel = 0x01020304; /* identity permutation */
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (srcfmt->Amask) {
|
if (srcfmt->Amask) {
|
||||||
|
@ -2319,9 +2319,9 @@ static void BlitNtoN(SDL_BlitInfo *info)
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
|
|
||||||
#if HAVE_FAST_WRITE_INT8
|
#if HAVE_FAST_WRITE_INT8
|
||||||
|
@ -2437,9 +2437,9 @@ static void BlitNtoNCopyAlpha(SDL_BlitInfo *info)
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
#if HAVE_FAST_WRITE_INT8
|
#if HAVE_FAST_WRITE_INT8
|
||||||
|
@ -2502,7 +2502,7 @@ static void BlitNto1Key(SDL_BlitInfo *info)
|
||||||
unsigned sR, sG, sB;
|
unsigned sR, sG, sB;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
srcbpp = srcfmt->BytesPerPixel;
|
srcbpp = srcfmt->bytes_per_pixel;
|
||||||
ckey &= rgbmask;
|
ckey &= rgbmask;
|
||||||
|
|
||||||
if (!palmap) {
|
if (!palmap) {
|
||||||
|
@ -2594,8 +2594,8 @@ static void BlitNtoNKey(SDL_BlitInfo *info)
|
||||||
Uint32 ckey = info->colorkey;
|
Uint32 ckey = info->colorkey;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
unsigned alpha = dstfmt->Amask ? info->a : 0;
|
||||||
Uint32 rgbmask = ~srcfmt->Amask;
|
Uint32 rgbmask = ~srcfmt->Amask;
|
||||||
int sfmt = srcfmt->format;
|
int sfmt = srcfmt->format;
|
||||||
|
@ -2873,8 +2873,8 @@ static void BlitNtoNKeyCopyAlpha(SDL_BlitInfo *info)
|
||||||
unsigned sR, sG, sB, sA;
|
unsigned sR, sG, sB, sA;
|
||||||
|
|
||||||
/* Set up some basic variables */
|
/* Set up some basic variables */
|
||||||
srcbpp = srcfmt->BytesPerPixel;
|
srcbpp = srcfmt->bytes_per_pixel;
|
||||||
dstbpp = dstfmt->BytesPerPixel;
|
dstbpp = dstfmt->bytes_per_pixel;
|
||||||
ckey &= rgbmask;
|
ckey &= rgbmask;
|
||||||
|
|
||||||
/* Fastpath: same source/destination format, with Amask, bpp 32, loop is vectorized. ~10x faster */
|
/* 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;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB, sA;
|
unsigned sR, sG, sB, sA;
|
||||||
|
|
||||||
|
@ -2997,7 +2997,7 @@ static void BlitNto2101010(SDL_BlitInfo *info)
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
Uint32 Pixel;
|
Uint32 Pixel;
|
||||||
unsigned sR, sG, sB, sA;
|
unsigned sR, sG, sB, sA;
|
||||||
|
|
||||||
|
@ -3028,9 +3028,9 @@ static void Blit_3or4_to_3or4__same_rgb(SDL_BlitInfo *info)
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
|
|
||||||
if (dstfmt->Amask) {
|
if (dstfmt->Amask) {
|
||||||
/* SET_ALPHA */
|
/* SET_ALPHA */
|
||||||
|
@ -3101,9 +3101,9 @@ static void Blit_3or4_to_3or4__inversed_rgb(SDL_BlitInfo *info)
|
||||||
Uint8 *dst = info->dst;
|
Uint8 *dst = info->dst;
|
||||||
int dstskip = info->dst_skip;
|
int dstskip = info->dst_skip;
|
||||||
SDL_PixelFormat *srcfmt = info->src_fmt;
|
SDL_PixelFormat *srcfmt = info->src_fmt;
|
||||||
int srcbpp = srcfmt->BytesPerPixel;
|
int srcbpp = srcfmt->bytes_per_pixel;
|
||||||
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
SDL_PixelFormat *dstfmt = info->dst_fmt;
|
||||||
int dstbpp = dstfmt->BytesPerPixel;
|
int dstbpp = dstfmt->bytes_per_pixel;
|
||||||
|
|
||||||
if (dstfmt->Amask) {
|
if (dstfmt->Amask) {
|
||||||
if (srcfmt->Amask) {
|
if (srcfmt->Amask) {
|
||||||
|
@ -3347,20 +3347,20 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||||
dstfmt = surface->map->dst->format;
|
dstfmt = surface->map->dst->format;
|
||||||
|
|
||||||
/* We don't support destinations less than 8-bits */
|
/* We don't support destinations less than 8-bits */
|
||||||
if (dstfmt->BitsPerPixel < 8) {
|
if (dstfmt->bits_per_pixel < 8) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
switch (surface->map->info.flags & ~SDL_COPY_RLE_MASK) {
|
||||||
case 0:
|
case 0:
|
||||||
blitfun = NULL;
|
blitfun = NULL;
|
||||||
if (dstfmt->BitsPerPixel == 8) {
|
if (dstfmt->bits_per_pixel == 8) {
|
||||||
if ((srcfmt->BytesPerPixel == 4) &&
|
if ((srcfmt->bytes_per_pixel == 4) &&
|
||||||
(srcfmt->Rmask == 0x00FF0000) &&
|
(srcfmt->Rmask == 0x00FF0000) &&
|
||||||
(srcfmt->Gmask == 0x0000FF00) &&
|
(srcfmt->Gmask == 0x0000FF00) &&
|
||||||
(srcfmt->Bmask == 0x000000FF)) {
|
(srcfmt->Bmask == 0x000000FF)) {
|
||||||
blitfun = Blit_XRGB8888_index8;
|
blitfun = Blit_XRGB8888_index8;
|
||||||
} else if ((srcfmt->BytesPerPixel == 4) &&
|
} else if ((srcfmt->bytes_per_pixel == 4) &&
|
||||||
(srcfmt->Rmask == 0x3FF00000) &&
|
(srcfmt->Rmask == 0x3FF00000) &&
|
||||||
(srcfmt->Gmask == 0x000FFC00) &&
|
(srcfmt->Gmask == 0x000FFC00) &&
|
||||||
(srcfmt->Bmask == 0x000003FF)) {
|
(srcfmt->Bmask == 0x000003FF)) {
|
||||||
|
@ -3374,9 +3374,9 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||||
if (dstfmt->Amask) {
|
if (dstfmt->Amask) {
|
||||||
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
|
a_need = srcfmt->Amask ? COPY_ALPHA : SET_ALPHA;
|
||||||
}
|
}
|
||||||
if (srcfmt->BytesPerPixel > 0 &&
|
if (srcfmt->bytes_per_pixel > 0 &&
|
||||||
srcfmt->BytesPerPixel <= SDL_arraysize(normal_blit)) {
|
srcfmt->bytes_per_pixel <= SDL_arraysize(normal_blit)) {
|
||||||
table = normal_blit[srcfmt->BytesPerPixel - 1];
|
table = normal_blit[srcfmt->bytes_per_pixel - 1];
|
||||||
for (which = 0; table[which].dstbpp; ++which) {
|
for (which = 0; table[which].dstbpp; ++which) {
|
||||||
if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
|
if (MASKOK(srcfmt->Rmask, table[which].srcR) &&
|
||||||
MASKOK(srcfmt->Gmask, table[which].srcG) &&
|
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->Rmask, table[which].dstR) &&
|
||||||
MASKOK(dstfmt->Gmask, table[which].dstG) &&
|
MASKOK(dstfmt->Gmask, table[which].dstG) &&
|
||||||
MASKOK(dstfmt->Bmask, table[which].dstB) &&
|
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 &&
|
(a_need & table[which].alpha) == a_need &&
|
||||||
((table[which].blit_features & GetBlitFeatures()) ==
|
((table[which].blit_features & GetBlitFeatures()) ==
|
||||||
table[which].blit_features)) {
|
table[which].blit_features)) {
|
||||||
|
@ -3399,8 +3399,8 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
|
||||||
blitfun = Blit2101010toN;
|
blitfun = Blit2101010toN;
|
||||||
} else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
|
} else if (dstfmt->format == SDL_PIXELFORMAT_ARGB2101010) {
|
||||||
blitfun = BlitNto2101010;
|
blitfun = BlitNto2101010;
|
||||||
} else if (srcfmt->BytesPerPixel == 4 &&
|
} else if (srcfmt->bytes_per_pixel == 4 &&
|
||||||
dstfmt->BytesPerPixel == 4 &&
|
dstfmt->bytes_per_pixel == 4 &&
|
||||||
srcfmt->Rmask == dstfmt->Rmask &&
|
srcfmt->Rmask == dstfmt->Rmask &&
|
||||||
srcfmt->Gmask == dstfmt->Gmask &&
|
srcfmt->Gmask == dstfmt->Gmask &&
|
||||||
srcfmt->Bmask == dstfmt->Bmask) {
|
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.
|
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 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;
|
return Blit2to2Key;
|
||||||
} else if (dstfmt->BytesPerPixel == 1) {
|
} else if (dstfmt->bytes_per_pixel == 1) {
|
||||||
return BlitNto1Key;
|
return BlitNto1Key;
|
||||||
} else {
|
} else {
|
||||||
#ifdef SDL_ALTIVEC_BLITTERS
|
#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;
|
return Blit32to32KeyAltivec;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,7 +104,7 @@ void SDL_BlitCopy(SDL_BlitInfo *info)
|
||||||
int w, h;
|
int w, h;
|
||||||
int srcskip, dstskip;
|
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;
|
h = info->dst_h;
|
||||||
src = info->src;
|
src = info->src;
|
||||||
dst = info->dst;
|
dst = info->dst;
|
||||||
|
|
|
@ -34,7 +34,7 @@ typedef enum
|
||||||
|
|
||||||
static SlowBlitPixelAccess GetPixelAccessMethod(SDL_PixelFormat *pf)
|
static SlowBlitPixelAccess GetPixelAccessMethod(SDL_PixelFormat *pf)
|
||||||
{
|
{
|
||||||
if (pf->BytesPerPixel > 4) {
|
if (pf->bytes_per_pixel > 4) {
|
||||||
return SlowBlitPixelAccess_Large;
|
return SlowBlitPixelAccess_Large;
|
||||||
} else if (SDL_ISPIXELFORMAT_10BIT(pf->format)) {
|
} else if (SDL_ISPIXELFORMAT_10BIT(pf->format)) {
|
||||||
return SlowBlitPixelAccess_10Bit;
|
return SlowBlitPixelAccess_10Bit;
|
||||||
|
@ -64,8 +64,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
|
||||||
Uint64 incy, incx;
|
Uint64 incy, incx;
|
||||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||||
int srcbpp = src_fmt->BytesPerPixel;
|
int srcbpp = src_fmt->bytes_per_pixel;
|
||||||
int dstbpp = dst_fmt->BytesPerPixel;
|
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||||
SlowBlitPixelAccess src_access;
|
SlowBlitPixelAccess src_access;
|
||||||
SlowBlitPixelAccess dst_access;
|
SlowBlitPixelAccess dst_access;
|
||||||
Uint32 rgbmask = ~src_fmt->Amask;
|
Uint32 rgbmask = ~src_fmt->Amask;
|
||||||
|
@ -380,14 +380,14 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||||
|
|
||||||
switch (access) {
|
switch (access) {
|
||||||
case SlowBlitPixelAccess_RGB:
|
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;
|
fR = (float)R / 255.0f;
|
||||||
fG = (float)G / 255.0f;
|
fG = (float)G / 255.0f;
|
||||||
fB = (float)B / 255.0f;
|
fB = (float)B / 255.0f;
|
||||||
fA = 1.0f;
|
fA = 1.0f;
|
||||||
break;
|
break;
|
||||||
case SlowBlitPixelAccess_RGBA:
|
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;
|
fR = (float)R / 255.0f;
|
||||||
fG = (float)G / 255.0f;
|
fG = (float)G / 255.0f;
|
||||||
fB = (float)B / 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[0] = (float)(((Uint16 *)pixels)[0]) / SDL_MAX_UINT16;
|
||||||
v[1] = (float)(((Uint16 *)pixels)[1]) / SDL_MAX_UINT16;
|
v[1] = (float)(((Uint16 *)pixels)[1]) / SDL_MAX_UINT16;
|
||||||
v[2] = (float)(((Uint16 *)pixels)[2]) / 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;
|
v[3] = (float)(((Uint16 *)pixels)[3]) / SDL_MAX_UINT16;
|
||||||
} else {
|
} else {
|
||||||
v[3] = 1.0f;
|
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[0] = half_to_float(((Uint16 *)pixels)[0]);
|
||||||
v[1] = half_to_float(((Uint16 *)pixels)[1]);
|
v[1] = half_to_float(((Uint16 *)pixels)[1]);
|
||||||
v[2] = half_to_float(((Uint16 *)pixels)[2]);
|
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]);
|
v[3] = half_to_float(((Uint16 *)pixels)[3]);
|
||||||
} else {
|
} else {
|
||||||
v[3] = 1.0f;
|
v[3] = 1.0f;
|
||||||
|
@ -441,7 +441,7 @@ static void ReadFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_PixelF
|
||||||
v[0] = ((float *)pixels)[0];
|
v[0] = ((float *)pixels)[0];
|
||||||
v[1] = ((float *)pixels)[1];
|
v[1] = ((float *)pixels)[1];
|
||||||
v[2] = ((float *)pixels)[2];
|
v[2] = ((float *)pixels)[2];
|
||||||
if (fmt->BytesPerPixel == 16) {
|
if (fmt->bytes_per_pixel == 16) {
|
||||||
v[3] = ((float *)pixels)[3];
|
v[3] = ((float *)pixels)[3];
|
||||||
} else {
|
} else {
|
||||||
v[3] = 1.0f;
|
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);
|
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);
|
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);
|
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;
|
break;
|
||||||
case SlowBlitPixelAccess_RGBA:
|
case SlowBlitPixelAccess_RGBA:
|
||||||
R = (Uint8)SDL_roundf(SDL_clamp(fR, 0.0f, 1.0f) * 255.0f);
|
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);
|
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);
|
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);
|
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;
|
break;
|
||||||
case SlowBlitPixelAccess_10Bit:
|
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)[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)[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);
|
((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);
|
((Uint16 *)pixels)[3] = (Uint16)SDL_roundf(SDL_clamp(v[3], 0.0f, 1.0f) * SDL_MAX_UINT16);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -648,7 +648,7 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||||
((Uint16 *)pixels)[0] = float_to_half(v[0]);
|
((Uint16 *)pixels)[0] = float_to_half(v[0]);
|
||||||
((Uint16 *)pixels)[1] = float_to_half(v[1]);
|
((Uint16 *)pixels)[1] = float_to_half(v[1]);
|
||||||
((Uint16 *)pixels)[2] = float_to_half(v[2]);
|
((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]);
|
((Uint16 *)pixels)[3] = float_to_half(v[3]);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -656,7 +656,7 @@ static void WriteFloatPixel(Uint8 *pixels, SlowBlitPixelAccess access, SDL_Pixel
|
||||||
((float *)pixels)[0] = v[0];
|
((float *)pixels)[0] = v[0];
|
||||||
((float *)pixels)[1] = v[1];
|
((float *)pixels)[1] = v[1];
|
||||||
((float *)pixels)[2] = v[2];
|
((float *)pixels)[2] = v[2];
|
||||||
if (fmt->BytesPerPixel == 16) {
|
if (fmt->bytes_per_pixel == 16) {
|
||||||
((float *)pixels)[3] = v[3];
|
((float *)pixels)[3] = v[3];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -725,8 +725,8 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
|
||||||
Uint64 incy, incx;
|
Uint64 incy, incx;
|
||||||
SDL_PixelFormat *src_fmt = info->src_fmt;
|
SDL_PixelFormat *src_fmt = info->src_fmt;
|
||||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||||
int srcbpp = src_fmt->BytesPerPixel;
|
int srcbpp = src_fmt->bytes_per_pixel;
|
||||||
int dstbpp = dst_fmt->BytesPerPixel;
|
int dstbpp = dst_fmt->bytes_per_pixel;
|
||||||
SlowBlitPixelAccess src_access;
|
SlowBlitPixelAccess src_access;
|
||||||
SlowBlitPixelAccess dst_access;
|
SlowBlitPixelAccess dst_access;
|
||||||
SDL_Colorspace src_colorspace;
|
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
|
#ifdef SAVE_32BIT_BMP
|
||||||
/* We can save alpha information in a 32-bit 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->format->Amask != 0 ||
|
||||||
surface->map->info.flags & SDL_COPY_COLORKEY)) {
|
surface->map->info.flags & SDL_COPY_COLORKEY)) {
|
||||||
save32bit = SDL_TRUE;
|
save32bit = SDL_TRUE;
|
||||||
|
@ -647,14 +647,14 @@ int SDL_SaveBMP_RW(SDL_Surface *surface, SDL_RWops *dst, SDL_bool freedst)
|
||||||
#endif /* SAVE_32BIT_BMP */
|
#endif /* SAVE_32BIT_BMP */
|
||||||
|
|
||||||
if (surface->format->palette && !save32bit) {
|
if (surface->format->palette && !save32bit) {
|
||||||
if (surface->format->BitsPerPixel == 8) {
|
if (surface->format->bits_per_pixel == 8) {
|
||||||
intermediate_surface = surface;
|
intermediate_surface = surface;
|
||||||
} else {
|
} else {
|
||||||
SDL_SetError("%u bpp BMP files not supported",
|
SDL_SetError("%u bpp BMP files not supported",
|
||||||
surface->format->BitsPerPixel);
|
surface->format->bits_per_pixel);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
} else if ((surface->format->BitsPerPixel == 24) && !save32bit &&
|
} else if ((surface->format->bits_per_pixel == 24) && !save32bit &&
|
||||||
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
|
||||||
(surface->format->Rmask == 0x00FF0000) &&
|
(surface->format->Rmask == 0x00FF0000) &&
|
||||||
(surface->format->Gmask == 0x0000FF00) &&
|
(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) {
|
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 */
|
/* Set the BMP file header values */
|
||||||
bfSize = 0; /* We'll write this when we're done */
|
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;
|
biWidth = intermediate_surface->w;
|
||||||
biHeight = intermediate_surface->h;
|
biHeight = intermediate_surface->h;
|
||||||
biPlanes = 1;
|
biPlanes = 1;
|
||||||
biBitCount = intermediate_surface->format->BitsPerPixel;
|
biBitCount = intermediate_surface->format->bits_per_pixel;
|
||||||
biCompression = BI_RGB;
|
biCompression = BI_RGB;
|
||||||
biSizeImage = intermediate_surface->h * intermediate_surface->pitch;
|
biSizeImage = intermediate_surface->h * intermediate_surface->pitch;
|
||||||
biXPelsPerMeter = 0;
|
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
|
/* This function doesn't usually work on surfaces < 8 bpp
|
||||||
* Except: support for 4bits, when filling full size.
|
* Except: support for 4bits, when filling full size.
|
||||||
*/
|
*/
|
||||||
if (dst->format->BitsPerPixel < 8) {
|
if (dst->format->bits_per_pixel < 8) {
|
||||||
if (count == 1) {
|
if (count == 1) {
|
||||||
const SDL_Rect *r = &rects[0];
|
const SDL_Rect *r = &rects[0];
|
||||||
if (r->x == 0 && r->y == 0 && r->w == dst->w && r->h == dst->h) {
|
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);
|
Uint8 b = (((Uint8)color << 4) | (Uint8)color);
|
||||||
SDL_memset(dst->pixels, b, (size_t)dst->h * dst->pitch);
|
SDL_memset(dst->pixels, b, (size_t)dst->h * dst->pitch);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -340,8 +340,8 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SDL_ARM_NEON_BLITTERS
|
#ifdef SDL_ARM_NEON_BLITTERS
|
||||||
if (SDL_HasNEON() && dst->format->BytesPerPixel != 3 && !fill_function) {
|
if (SDL_HasNEON() && dst->format->bytes_per_pixel != 3 && !fill_function) {
|
||||||
switch (dst->format->BytesPerPixel) {
|
switch (dst->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
fill_function = fill_8_neon;
|
fill_function = fill_8_neon;
|
||||||
break;
|
break;
|
||||||
|
@ -355,8 +355,8 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef SDL_ARM_SIMD_BLITTERS
|
#ifdef SDL_ARM_SIMD_BLITTERS
|
||||||
if (SDL_HasARMSIMD() && dst->format->BytesPerPixel != 3 && !fill_function) {
|
if (SDL_HasARMSIMD() && dst->format->bytes_per_pixel != 3 && !fill_function) {
|
||||||
switch (dst->format->BytesPerPixel) {
|
switch (dst->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
fill_function = fill_8_simd;
|
fill_function = fill_8_simd;
|
||||||
break;
|
break;
|
||||||
|
@ -371,7 +371,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!fill_function) {
|
if (!fill_function) {
|
||||||
switch (dst->format->BytesPerPixel) {
|
switch (dst->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
color |= (color << 8);
|
color |= (color << 8);
|
||||||
|
@ -432,7 +432,7 @@ int SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
|
||||||
rect = &clipped;
|
rect = &clipped;
|
||||||
|
|
||||||
pixels = (Uint8 *)dst->pixels + rect->y * dst->pitch +
|
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);
|
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 */
|
/* Set up the format */
|
||||||
SDL_zerop(format);
|
SDL_zerop(format);
|
||||||
format->format = pixel_format;
|
format->format = pixel_format;
|
||||||
format->BitsPerPixel = (Uint8)bpp;
|
format->bits_per_pixel = (Uint8)bpp;
|
||||||
format->BytesPerPixel = (Uint8)((bpp + 7) / 8);
|
format->bytes_per_pixel = (Uint8)((bpp + 7) / 8);
|
||||||
|
|
||||||
format->Rmask = Rmask;
|
format->Rmask = Rmask;
|
||||||
format->Rshift = 0;
|
format->Rshift = 0;
|
||||||
|
@ -1047,7 +1047,7 @@ int SDL_SetPixelFormatPalette(SDL_PixelFormat *format, SDL_Palette *palette)
|
||||||
return SDL_InvalidParamError("SDL_SetPixelFormatPalette(): format");
|
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");
|
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;
|
int bpp;
|
||||||
SDL_Palette *pal = src->palette;
|
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);
|
map = (Uint8 *)SDL_calloc(256, bpp);
|
||||||
if (!map) {
|
if (!map) {
|
||||||
return NULL;
|
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 G = (Uint8)((pal->colors[i].g * Gmod) / 255);
|
||||||
Uint8 B = (Uint8)((pal->colors[i].b * Bmod) / 255);
|
Uint8 B = (Uint8)((pal->colors[i].b * Bmod) / 255);
|
||||||
Uint8 A = (Uint8)((pal->colors[i].a * Amod) / 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;
|
return map;
|
||||||
}
|
}
|
||||||
|
@ -1433,7 +1434,7 @@ int SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (srcfmt->BitsPerPixel != dstfmt->BitsPerPixel) {
|
if (srcfmt->bits_per_pixel != dstfmt->bits_per_pixel) {
|
||||||
map->identity = 0;
|
map->identity = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -49,7 +49,7 @@ int SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scaleMode == SDL_SCALEMODE_LINEAR) {
|
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");
|
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 src_pitch = s->pitch;
|
||||||
int dst_pitch = d->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 *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);
|
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)) {
|
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||||
SDL_Palette *palette =
|
SDL_Palette *palette =
|
||||||
SDL_CreatePalette((1 << surface->format->BitsPerPixel));
|
SDL_CreatePalette((1 << surface->format->bits_per_pixel));
|
||||||
if (!palette) {
|
if (!palette) {
|
||||||
SDL_DestroySurface(surface);
|
SDL_DestroySurface(surface);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -423,7 +423,7 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, SDL_bool ignore_alp
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bpp = surface->format->BytesPerPixel;
|
bpp = surface->format->bytes_per_pixel;
|
||||||
|
|
||||||
SDL_LockSurface(surface);
|
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) &&
|
if (!(src->map->info.flags & complex_copy_flags) &&
|
||||||
src->format->format == dst->format->format &&
|
src->format->format == dst->format->format &&
|
||||||
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) &&
|
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) &&
|
||||||
src->format->BytesPerPixel == 4 &&
|
src->format->bytes_per_pixel == 4 &&
|
||||||
src->format->format != SDL_PIXELFORMAT_ARGB2101010) {
|
src->format->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||||
/* fast path */
|
/* fast path */
|
||||||
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
|
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;
|
srcrect2.h = srcrect->h;
|
||||||
|
|
||||||
/* Change source format if not appropriate for scaling */
|
/* 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;
|
SDL_Rect tmprect;
|
||||||
int fmt;
|
int fmt;
|
||||||
tmprect.x = 0;
|
tmprect.x = 0;
|
||||||
tmprect.y = 0;
|
tmprect.y = 0;
|
||||||
tmprect.w = src->w;
|
tmprect.w = src->w;
|
||||||
tmprect.h = src->h;
|
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;
|
fmt = dst->format->format;
|
||||||
} else {
|
} else {
|
||||||
fmt = SDL_PIXELFORMAT_ARGB8888;
|
fmt = SDL_PIXELFORMAT_ARGB8888;
|
||||||
|
@ -1118,7 +1118,7 @@ static int SDL_FlipSurfaceHorizontal(SDL_Surface *surface)
|
||||||
Uint8 *row, *a, *b, *tmp;
|
Uint8 *row, *a, *b, *tmp;
|
||||||
int i, j, bpp;
|
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 */
|
/* We could implement this if needed, but we'd have to flip sets of bits within a byte */
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
@ -1131,7 +1131,7 @@ static int SDL_FlipSurfaceHorizontal(SDL_Surface *surface)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bpp = surface->format->BytesPerPixel;
|
bpp = surface->format->bytes_per_pixel;
|
||||||
row = (Uint8 *)surface->pixels;
|
row = (Uint8 *)surface->pixels;
|
||||||
tmp = SDL_small_alloc(Uint8, surface->pitch, &isstack);
|
tmp = SDL_small_alloc(Uint8, surface->pitch, &isstack);
|
||||||
for (i = surface->h; i--; ) {
|
for (i = surface->h; i--; ) {
|
||||||
|
@ -1419,7 +1419,7 @@ static SDL_Surface *SDL_ConvertSurfaceWithPixelFormatAndColorspace(SDL_Surface *
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the converted colorkey */
|
/* 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(tmp);
|
||||||
SDL_DestroySurface(tmp2);
|
SDL_DestroySurface(tmp2);
|
||||||
|
@ -1763,7 +1763,7 @@ int SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g,
|
||||||
a = &unused;
|
a = &unused;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_per_pixel = surface->format->BytesPerPixel;
|
bytes_per_pixel = surface->format->bytes_per_pixel;
|
||||||
|
|
||||||
if (SDL_MUSTLOCK(surface)) {
|
if (SDL_MUSTLOCK(surface)) {
|
||||||
SDL_LockSurface(surface);
|
SDL_LockSurface(surface);
|
||||||
|
|
|
@ -330,7 +330,7 @@ struct SDL_VideoDevice
|
||||||
SDL_bool (*HasPrimarySelectionText)(SDL_VideoDevice *_this);
|
SDL_bool (*HasPrimarySelectionText)(SDL_VideoDevice *_this);
|
||||||
|
|
||||||
/* MessageBox */
|
/* 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 */
|
/* Hit-testing */
|
||||||
int (*SetWindowHitTest)(SDL_Window *window, SDL_bool enabled);
|
int (*SetWindowHitTest)(SDL_Window *window, SDL_bool enabled);
|
||||||
|
@ -455,7 +455,7 @@ typedef struct VideoBootStrap
|
||||||
const char *name;
|
const char *name;
|
||||||
const char *desc;
|
const char *desc;
|
||||||
SDL_VideoDevice *(*create)(void);
|
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;
|
} VideoBootStrap;
|
||||||
|
|
||||||
/* Not all of these are available in a given build. Use #ifdefs, etc. */
|
/* 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)))
|
mask[(y * ((icon->w + 7) / 8)) + (x / 8)] &= ~(0x01 << (7 - (x % 8)))
|
||||||
|
|
||||||
colorkey = icon->format->colorkey;
|
colorkey = icon->format->colorkey;
|
||||||
switch (icon->format->BytesPerPixel) {
|
switch (icon->format->bytes_per_pixel) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
Uint8 *pixels;
|
Uint8 *pixels;
|
||||||
|
@ -4891,7 +4891,7 @@ int SDL_GetMessageBoxCount(void)
|
||||||
#include "vita/SDL_vitamessagebox.h"
|
#include "vita/SDL_vitamessagebox.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||||
{
|
{
|
||||||
int dummybutton;
|
int dummybutton;
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
@ -4916,8 +4916,8 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
SDL_ShowCursor();
|
SDL_ShowCursor();
|
||||||
SDL_ResetKeyboard();
|
SDL_ResetKeyboard();
|
||||||
|
|
||||||
if (!buttonid) {
|
if (!buttonID) {
|
||||||
buttonid = &dummybutton;
|
buttonID = &dummybutton;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_memcpy(&mbdata, messageboxdata, sizeof(*messageboxdata));
|
SDL_memcpy(&mbdata, messageboxdata, sizeof(*messageboxdata));
|
||||||
|
@ -4932,7 +4932,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
SDL_ClearError();
|
SDL_ClearError();
|
||||||
|
|
||||||
if (_this && _this->ShowMessageBox) {
|
if (_this && _this->ShowMessageBox) {
|
||||||
retval = _this->ShowMessageBox(_this, messageboxdata, buttonid);
|
retval = _this->ShowMessageBox(_this, messageboxdata, buttonID);
|
||||||
} else {
|
} else {
|
||||||
/* It's completely fine to call this function before video is initialized */
|
/* It's completely fine to call this function before video is initialized */
|
||||||
const char *driver_name = SDL_GetHint(SDL_HINT_VIDEO_DRIVER);
|
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) {
|
for (int i = 0; bootstrap[i]; ++i) {
|
||||||
if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
if (bootstrap[i]->ShowMessageBox && (driver_attempt_len == SDL_strlen(bootstrap[i]->name)) &&
|
||||||
(SDL_strncasecmp(bootstrap[i]->name, driver_attempt, driver_attempt_len) == 0)) {
|
(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;
|
retval = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -4956,7 +4956,7 @@ int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; bootstrap[i]; ++i) {
|
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;
|
retval = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,9 @@
|
||||||
#include "SDL_androidmessagebox.h"
|
#include "SDL_androidmessagebox.h"
|
||||||
#include "../../core/android/SDL_android.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 */
|
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_ANDROID
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_ANDROID */
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_COCOA
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_COCOA */
|
||||||
|
|
|
@ -66,7 +66,7 @@
|
||||||
}
|
}
|
||||||
@end
|
@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;
|
NSAlert *alert;
|
||||||
const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons;
|
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) {
|
if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
|
||||||
clicked = messageboxdata->numbuttons - 1 - clicked;
|
clicked = messageboxdata->numbuttons - 1 - clicked;
|
||||||
}
|
}
|
||||||
*buttonid = buttons[clicked].buttonid;
|
*buttonID = buttons[clicked].buttonID;
|
||||||
*returnValue = 0;
|
*returnValue = 0;
|
||||||
} else {
|
} else {
|
||||||
*returnValue = SDL_SetError("Did not get a valid `clicked button' id: %ld", (long)clicked);
|
*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 */
|
/* Display a Cocoa message box */
|
||||||
int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
int Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||||
{
|
{
|
||||||
@autoreleasepool {
|
@autoreleasepool {
|
||||||
__block int returnValue = 0;
|
__block int returnValue = 0;
|
||||||
|
|
||||||
if ([NSThread isMainThread]) {
|
if ([NSThread isMainThread]) {
|
||||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||||
} else {
|
} else {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
Cocoa_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
|
@ -258,7 +258,7 @@ NSImage *Cocoa_CreateImage(SDL_Surface *surface)
|
||||||
isPlanar:NO
|
isPlanar:NO
|
||||||
colorSpaceName:NSDeviceRGBColorSpace
|
colorSpaceName:NSDeviceRGBColorSpace
|
||||||
bytesPerRow:converted->pitch
|
bytesPerRow:converted->pitch
|
||||||
bitsPerPixel:converted->format->BitsPerPixel];
|
bitsPerPixel:converted->format->bits_per_pixel];
|
||||||
if (imgrep == nil) {
|
if (imgrep == nil) {
|
||||||
SDL_DestroySurface(converted);
|
SDL_DestroySurface(converted);
|
||||||
return nil;
|
return nil;
|
||||||
|
|
|
@ -78,7 +78,7 @@ class HAIKU_SDL_MessageBox : public BAlert
|
||||||
SortButtonsPredicate(const SDL_MessageBoxButtonData *aButtonLeft,
|
SortButtonsPredicate(const SDL_MessageBoxButtonData *aButtonLeft,
|
||||||
const SDL_MessageBoxButtonData *aButtonRight)
|
const SDL_MessageBoxButtonData *aButtonRight)
|
||||||
{
|
{
|
||||||
return aButtonLeft->buttonid < aButtonRight->buttonid;
|
return aButtonLeft->buttonID < aButtonRight->buttonID;
|
||||||
}
|
}
|
||||||
|
|
||||||
alert_type
|
alert_type
|
||||||
|
@ -346,10 +346,10 @@ protected:
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#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.
|
// 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
|
// 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:
|
// 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.
|
// Initialize button by real pushed value then.
|
||||||
*buttonid = pushedButton;
|
*buttonID = pushedButton;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern int
|
extern int
|
||||||
HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid);
|
HAIKU_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonID);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#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;
|
TInt targetStartOffset = fixedOffset.iX + rect2.x + (fixedOffset.iY + rect2.y) * targetScanlineLength;
|
||||||
|
|
||||||
switch (screen->format->BitsPerPixel) {
|
switch (screen->format->bits_per_pixel) {
|
||||||
case 12:
|
case 12:
|
||||||
{
|
{
|
||||||
TUint16 *bitmapLine = (TUint16 *)screen->pixels + sourceStartOffset;
|
TUint16 *bitmapLine = (TUint16 *)screen->pixels + sourceStartOffset;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <swis.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_swi_regs regs;
|
||||||
_kernel_oserror error;
|
_kernel_oserror error;
|
||||||
|
@ -60,7 +60,7 @@ int RISCOS_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttoni
|
||||||
|
|
||||||
_kernel_swi(Wimp_ReportError, ®s, ®s);
|
_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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_RISCOS
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_RISCOS */
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
|
|
||||||
extern SDL_bool UIKit_ShowingMessageBox(void);
|
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 */
|
#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 i;
|
||||||
int __block clickedindex = messageboxdata->numbuttons;
|
int __block clickedindex = messageboxdata->numbuttons;
|
||||||
|
@ -120,14 +120,14 @@ static BOOL UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messag
|
||||||
|
|
||||||
UIKit_ForceUpdateHomeIndicator();
|
UIKit_ForceUpdateHomeIndicator();
|
||||||
|
|
||||||
*buttonid = messageboxdata->buttons[clickedindex].buttonid;
|
*buttonID = messageboxdata->buttons[clickedindex].buttonID;
|
||||||
return YES;
|
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 {
|
@autoreleasepool {
|
||||||
if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonid)) {
|
if (UIKit_ShowMessageBoxAlertController(messageboxdata, buttonID)) {
|
||||||
*returnValue = 0;
|
*returnValue = 0;
|
||||||
} else {
|
} else {
|
||||||
*returnValue = SDL_SetError("Could not show message box.");
|
*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 {
|
@autoreleasepool {
|
||||||
__block int returnValue = 0;
|
__block int returnValue = 0;
|
||||||
|
|
||||||
if ([NSThread isMainThread]) {
|
if ([NSThread isMainThread]) {
|
||||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
UIKit_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||||
} else {
|
} else {
|
||||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||||
UIKit_ShowMessageBoxImpl(messageboxdata, buttonid, &returnValue);
|
UIKit_ShowMessageBoxImpl(messageboxdata, buttonID, &returnValue);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return returnValue;
|
return returnValue;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include "../../render/vitagxm/SDL_render_vita_gxm_tools.h"
|
#include "../../render/vitagxm/SDL_render_vita_gxm_tools.h"
|
||||||
#endif /* SDL_VIDEO_RENDER_VITA_GXM */
|
#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
|
#ifdef SDL_VIDEO_RENDER_VITA_GXM
|
||||||
SceMsgDialogParam param;
|
SceMsgDialogParam param;
|
||||||
|
@ -91,17 +91,17 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
sceMsgDialogGetResult(&dialog_result);
|
sceMsgDialogGetResult(&dialog_result);
|
||||||
|
|
||||||
if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_BUTTON1) {
|
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) {
|
} 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) {
|
} 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) {
|
} 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) {
|
} 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) {
|
} else if (dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK) {
|
||||||
*buttonid = messageboxdata->buttons[0].buttonid;
|
*buttonID = messageboxdata->buttons[0].buttonID;
|
||||||
}
|
}
|
||||||
sceMsgDialogTerm();
|
sceMsgDialogTerm();
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,7 +117,7 @@ int VITA_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
(void)messageboxdata;
|
(void)messageboxdata;
|
||||||
(void)buttonid;
|
(void)buttonID;
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_VITA
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_VITA */
|
||||||
|
|
||||||
|
|
|
@ -43,11 +43,11 @@ struct SDL_VideoData
|
||||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay)(void *context);
|
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplay)(void *context);
|
||||||
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
|
EGLNativeDisplayType(EGLAPIENTRY *fbGetDisplayByIndex)(int DisplayIndex);
|
||||||
void(EGLAPIENTRY *fbGetDisplayGeometry)(EGLNativeDisplayType Display, int *Width, int *Height);
|
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);
|
void(EGLAPIENTRY *fbDestroyDisplay)(EGLNativeDisplayType Display);
|
||||||
EGLNativeWindowType(EGLAPIENTRY *fbCreateWindow)(EGLNativeDisplayType Display, int X, int Y, int Width, int Height);
|
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 *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);
|
void(EGLAPIENTRY *fbDestroyWindow)(EGLNativeWindowType Window);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int get_zenity_version(int *major, int *minor)
|
||||||
return -1; /* run_zenity should've called SDL_SetError() */
|
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 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;
|
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 *output = NULL;
|
||||||
char *tmp = NULL;
|
char *tmp = NULL;
|
||||||
|
|
||||||
if (!buttonid) {
|
if (!buttonID) {
|
||||||
/* if we don't need buttonid, we can return immediately */
|
/* if we don't need buttonID, we can return immediately */
|
||||||
close(fd_pipe[0]);
|
close(fd_pipe[0]);
|
||||||
return 0; /* success */
|
return 0; /* success */
|
||||||
}
|
}
|
||||||
*buttonid = -1;
|
*buttonID = -1;
|
||||||
|
|
||||||
output = SDL_malloc(output_len + 1);
|
output = SDL_malloc(output_len + 1);
|
||||||
if (!output) {
|
if (!output) {
|
||||||
|
@ -251,7 +251,7 @@ int Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *button
|
||||||
for (i = 0; i < messageboxdata->numbuttons; i += 1) {
|
for (i = 0; i < messageboxdata->numbuttons; i += 1) {
|
||||||
if (messageboxdata->buttons[i].text) {
|
if (messageboxdata->buttons[i].text) {
|
||||||
if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) {
|
if (SDL_strcmp(output, messageboxdata->buttons[i].text) == 0) {
|
||||||
*buttonid = messageboxdata->buttons[i].buttonid;
|
*buttonID = messageboxdata->buttons[i].buttonID;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WAYLAND
|
#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 */
|
#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. */
|
/* 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;
|
WIN_DialogData *dialog;
|
||||||
int i, x, y, retval;
|
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);
|
result = DialogBoxIndirectParam(NULL, (DLGTEMPLATE *)dialog->lpDialog, ParentWindow, MessageBoxDialogProc, (LPARAM)messageboxdata);
|
||||||
if (result >= IDBUTTONINDEX0 && result - IDBUTTONINDEX0 < messageboxdata->numbuttons) {
|
if (result >= IDBUTTONINDEX0 && result - IDBUTTONINDEX0 < messageboxdata->numbuttons) {
|
||||||
*buttonid = messageboxdata->buttons[result - IDBUTTONINDEX0].buttonid;
|
*buttonID = messageboxdata->buttons[result - IDBUTTONINDEX0].buttonID;
|
||||||
retval = 0;
|
retval = 0;
|
||||||
} else if (result == IDCLOSED) {
|
} else if (result == IDCLOSED) {
|
||||||
/* Dialog window closed by user or system. */
|
/* Dialog window closed by user or system. */
|
||||||
/* This could use a special return code. */
|
/* This could use a special return code. */
|
||||||
retval = 0;
|
retval = 0;
|
||||||
*buttonid = -1;
|
*buttonID = -1;
|
||||||
} else {
|
} else {
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
SDL_SetError("Invalid parent window handle");
|
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);
|
typedef HRESULT (FAR WINAPI *TASKDIALOGINDIRECTPROC)(const TASKDIALOGCONFIG *pTaskConfig, int *pnButton, int *pnRadioButton, BOOL *pfVerificationFlagChecked);
|
||||||
/* *INDENT-ON* */ /* clang-format on */
|
/* *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;
|
HWND ParentWindow = NULL;
|
||||||
wchar_t *wmessage;
|
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! */
|
/* If we cannot load comctl32.dll use the old messagebox! */
|
||||||
hComctl32 = LoadLibrary(TEXT("comctl32.dll"));
|
hComctl32 = LoadLibrary(TEXT("comctl32.dll"));
|
||||||
if (!hComctl32) {
|
if (!hComctl32) {
|
||||||
return WIN_ShowOldMessageBox(messageboxdata, buttonid);
|
return WIN_ShowOldMessageBox(messageboxdata, buttonID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If TaskDialogIndirect doesn't exist use the old messagebox!
|
/* 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");
|
pfnTaskDialogIndirect = (TASKDIALOGINDIRECTPROC)GetProcAddress(hComctl32, "TaskDialogIndirect");
|
||||||
if (!pfnTaskDialogIndirect) {
|
if (!pfnTaskDialogIndirect) {
|
||||||
FreeLibrary(hComctl32);
|
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
|
/* 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];
|
pButton = &pButtons[messageboxdata->numbuttons - 1 - i];
|
||||||
}
|
}
|
||||||
if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
|
if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
|
||||||
nCancelButton = messageboxdata->buttons[i].buttonid;
|
nCancelButton = messageboxdata->buttons[i].buttonID;
|
||||||
pButton->nButtonID = IDCANCEL;
|
pButton->nButtonID = IDCANCEL;
|
||||||
} else {
|
} else {
|
||||||
pButton->nButtonID = IDBUTTONINDEX0 + i;
|
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 */
|
/* Check the Task Dialog was successful and give the result */
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
if (nButton == IDCANCEL) {
|
if (nButton == IDCANCEL) {
|
||||||
*buttonid = nCancelButton;
|
*buttonID = nCancelButton;
|
||||||
} else if (nButton >= IDBUTTONINDEX0 && nButton < IDBUTTONINDEX0 + messageboxdata->numbuttons) {
|
} else if (nButton >= IDBUTTONINDEX0 && nButton < IDBUTTONINDEX0 + messageboxdata->numbuttons) {
|
||||||
*buttonid = messageboxdata->buttons[nButton - IDBUTTONINDEX0].buttonid;
|
*buttonID = messageboxdata->buttons[nButton - IDBUTTONINDEX0].buttonID;
|
||||||
} else {
|
} else {
|
||||||
*buttonid = -1;
|
*buttonID = -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We failed showing the Task Dialog, use the old message box! */
|
/* 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 */
|
#endif /* SDL_VIDEO_DRIVER_WINDOWS */
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WINDOWS
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_WINDOWS */
|
||||||
|
|
|
@ -40,7 +40,7 @@ static String ^ WINRT_UTF8ToPlatformString(const char *str) {
|
||||||
return rtstr;
|
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
|
#if SDL_WINAPI_FAMILY_PHONE && NTDDI_VERSION == NTDDI_WIN8
|
||||||
/* Sadly, Windows Phone 8 doesn't include the MessageDialog class that
|
/* 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) {
|
if (operation->Status != Windows::Foundation::AsyncStatus::Completed) {
|
||||||
return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
|
return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
|
||||||
}
|
}
|
||||||
if (buttonid) {
|
if (buttonID) {
|
||||||
IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
|
IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
|
||||||
int clicked_index = results.ToInt32();
|
int clicked_index = results.ToInt32();
|
||||||
*buttonid = messageboxdata->buttons[clicked_index].buttonid;
|
*buttonID = messageboxdata->buttons[clicked_index].buttonID;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* if SDL_WINAPI_FAMILY_PHONE / else */
|
#endif /* if SDL_WINAPI_FAMILY_PHONE / else */
|
||||||
|
|
|
@ -22,6 +22,6 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_WINRT
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_WINRT */
|
||||||
|
|
|
@ -101,7 +101,7 @@ typedef struct SDL_MessageBoxDataX11
|
||||||
int text_height; /* Height for text lines. */
|
int text_height; /* Height for text lines. */
|
||||||
TextLineData *linedata;
|
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 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). */
|
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];
|
SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[i];
|
||||||
|
|
||||||
if (buttondatax11->buttondata->flags & mask) {
|
if (buttondatax11->buttondata->flags & mask) {
|
||||||
*data->pbuttonid = buttondatax11->buttondata->buttonid;
|
*data->pbuttonid = buttondatax11->buttondata->buttonID;
|
||||||
close_dialog = SDL_TRUE;
|
close_dialog = SDL_TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -726,7 +726,7 @@ static int X11_MessageBoxLoop(SDL_MessageBoxDataX11 *data)
|
||||||
if (data->button_press_index == button) {
|
if (data->button_press_index == button) {
|
||||||
SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[button];
|
SDL_MessageBoxButtonDataX11 *buttondatax11 = &data->buttonpos[button];
|
||||||
|
|
||||||
*data->pbuttonid = buttondatax11->buttondata->buttonid;
|
*data->pbuttonid = buttondatax11->buttondata->buttonID;
|
||||||
close_dialog = SDL_TRUE;
|
close_dialog = SDL_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -744,7 +744,7 @@ static int X11_MessageBoxLoop(SDL_MessageBoxDataX11 *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int *buttonID)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
SDL_MessageBoxDataX11 data;
|
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? */
|
/* This code could get called from multiple threads maybe? */
|
||||||
X11_XInitThreads();
|
X11_XInitThreads();
|
||||||
|
|
||||||
/* Initialize the return buttonid value to -1 (for error or dialogbox closed). */
|
/* Initialize the return buttonID value to -1 (for error or dialogbox closed). */
|
||||||
*buttonid = -1;
|
*buttonID = -1;
|
||||||
|
|
||||||
/* Init and display the message box. */
|
/* Init and display the message box. */
|
||||||
ret = X11_MessageBoxInit(&data, messageboxdata, buttonid);
|
ret = X11_MessageBoxInit(&data, messageboxdata, buttonID);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
ret = X11_MessageBoxInitPositions(&data);
|
ret = X11_MessageBoxInitPositions(&data);
|
||||||
if (ret != -1) {
|
if (ret != -1) {
|
||||||
|
@ -800,7 +800,7 @@ static int X11_ShowMessageBoxImpl(const SDL_MessageBoxData *messageboxdata, int
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display an x11 message box. */
|
/* 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
|
#if SDL_FORK_MESSAGEBOX
|
||||||
/* Use a child process to protect against setlocale(). Annoying. */
|
/* 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;
|
int status = 0;
|
||||||
|
|
||||||
if (pipe(fds) == -1) {
|
if (pipe(fds) == -1) {
|
||||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonid); /* oh well. */
|
return X11_ShowMessageBoxImpl(messageboxdata, buttonID); /* oh well. */
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = fork();
|
pid = fork();
|
||||||
if (pid == -1) { /* failed */
|
if (pid == -1) { /* failed */
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
close(fds[1]);
|
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 */
|
} else if (pid == 0) { /* we're the child */
|
||||||
int exitcode = 0;
|
int exitcode = 0;
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
status = X11_ShowMessageBoxImpl(messageboxdata, buttonid);
|
status = X11_ShowMessageBoxImpl(messageboxdata, buttonID);
|
||||||
if (write(fds[1], &status, sizeof(int)) != sizeof(int)) {
|
if (write(fds[1], &status, sizeof(int)) != sizeof(int)) {
|
||||||
exitcode = 1;
|
exitcode = 1;
|
||||||
} else if (write(fds[1], buttonid, sizeof(int)) != sizeof(int)) {
|
} else if (write(fds[1], buttonID, sizeof(int)) != sizeof(int)) {
|
||||||
exitcode = 1;
|
exitcode = 1;
|
||||||
}
|
}
|
||||||
close(fds[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)) {
|
if ((rc == -1) || (!WIFEXITED(status)) || (WEXITSTATUS(status) != 0)) {
|
||||||
status = SDL_SetError("msgbox child process failed");
|
status = SDL_SetError("msgbox child process failed");
|
||||||
} else if ((read(fds[0], &status, sizeof(int)) != sizeof(int)) ||
|
} 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");
|
status = SDL_SetError("read from msgbox child process failed");
|
||||||
*buttonid = 0;
|
*buttonID = 0;
|
||||||
}
|
}
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return X11_ShowMessageBoxImpl(messageboxdata, buttonid);
|
return X11_ShowMessageBoxImpl(messageboxdata, buttonID);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* SDL_VIDEO_DRIVER_X11 */
|
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#ifdef SDL_VIDEO_DRIVER_X11
|
#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 */
|
#endif /* SDL_VIDEO_DRIVER_X11 */
|
||||||
|
|
||||||
|
|
|
@ -1168,7 +1168,7 @@ int SDL_AppEvent(const SDL_Event *event)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_EVENT_MOUSE_WHEEL:
|
case SDL_EVENT_MOUSE_WHEEL:
|
||||||
UpdateMouseOver(event->wheel.mouseX, event->wheel.mouseY);
|
UpdateMouseOver(event->wheel.mouse_x, event->wheel.mouse_y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_EVENT_KEY_DOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
|
|
|
@ -140,8 +140,12 @@ static int pixels_allocFreeFormat(void *arg)
|
||||||
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
SDLTest_AssertCheck(result != NULL, "Verify result is not NULL");
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
|
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
|
||||||
SDLTest_AssertCheck(result->BitsPerPixel == 0, "Verify value of result.BitsPerPixel; expected: 0, got %u", result->BitsPerPixel);
|
SDLTest_AssertCheck(result->bits_per_pixel == 0,
|
||||||
SDLTest_AssertCheck(result->BytesPerPixel == 0, "Verify value of result.BytesPerPixel; expected: 0, got %u", result->BytesPerPixel);
|
"Verify value of result.bits_per_pixel; expected: 0, got %u",
|
||||||
|
result->bits_per_pixel);
|
||||||
|
SDLTest_AssertCheck(result->bytes_per_pixel == 0,
|
||||||
|
"Verify value of result.bytes_per_pixel; expected: 0, got %u",
|
||||||
|
result->bytes_per_pixel);
|
||||||
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
|
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
|
||||||
SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %" SDL_PRIu32, masks);
|
SDLTest_AssertCheck(masks == 0, "Verify value of result.[RGBA]mask combined; expected: 0, got %" SDL_PRIu32, masks);
|
||||||
|
|
||||||
|
@ -162,8 +166,12 @@ static int pixels_allocFreeFormat(void *arg)
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
|
SDLTest_AssertCheck(result->format == format, "Verify value of result.format; expected: %" SDL_PRIu32 ", got %" SDL_PRIu32, format, result->format);
|
||||||
if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
|
if (!SDL_ISPIXELFORMAT_FOURCC(format)) {
|
||||||
SDLTest_AssertCheck(result->BitsPerPixel > 0, "Verify value of result.BitsPerPixel; expected: >0, got %u", result->BitsPerPixel);
|
SDLTest_AssertCheck(result->bits_per_pixel > 0,
|
||||||
SDLTest_AssertCheck(result->BytesPerPixel > 0, "Verify value of result.BytesPerPixel; expected: >0, got %u", result->BytesPerPixel);
|
"Verify value of result.bits_per_pixel; expected: >0, got %u",
|
||||||
|
result->bits_per_pixel);
|
||||||
|
SDLTest_AssertCheck(result->bytes_per_pixel > 0,
|
||||||
|
"Verify value of result.bytes_per_pixel; expected: >0, got %u",
|
||||||
|
result->bytes_per_pixel);
|
||||||
if (!SDL_ISPIXELFORMAT_INDEXED(format)) {
|
if (!SDL_ISPIXELFORMAT_INDEXED(format)) {
|
||||||
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
|
masks = result->Rmask | result->Gmask | result->Bmask | result->Amask;
|
||||||
SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks);
|
SDLTest_AssertCheck(masks > 0, "Verify value of result.[RGBA]mask combined; expected: >0, got %" SDL_PRIu32, masks);
|
||||||
|
|
|
@ -209,7 +209,7 @@ static int platform_testHasFunctions(void *arg)
|
||||||
*/
|
*/
|
||||||
static int platform_testGetVersion(void *arg)
|
static int platform_testGetVersion(void *arg)
|
||||||
{
|
{
|
||||||
SDL_version linked;
|
SDL_Version linked;
|
||||||
int major = SDL_MAJOR_VERSION;
|
int major = SDL_MAJOR_VERSION;
|
||||||
int minor = SDL_MINOR_VERSION;
|
int minor = SDL_MINOR_VERSION;
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ static int platform_testGetVersion(void *arg)
|
||||||
*/
|
*/
|
||||||
static int platform_testSDLVersion(void *arg)
|
static int platform_testSDLVersion(void *arg)
|
||||||
{
|
{
|
||||||
SDL_version compiled;
|
SDL_Version compiled;
|
||||||
int major = SDL_MAJOR_VERSION;
|
int major = SDL_MAJOR_VERSION;
|
||||||
int minor = SDL_MINOR_VERSION;
|
int minor = SDL_MINOR_VERSION;
|
||||||
|
|
||||||
|
|
|
@ -373,8 +373,8 @@ static int surface_testCompleteSurfaceConversion(void *arg)
|
||||||
cvt2 = SDL_ConvertSurface(cvt1, fmt2);
|
cvt2 = SDL_ConvertSurface(cvt1, fmt2);
|
||||||
SDL_assert(cvt2 != NULL);
|
SDL_assert(cvt2 != NULL);
|
||||||
|
|
||||||
if (fmt1->BytesPerPixel == face->format->BytesPerPixel &&
|
if (fmt1->bytes_per_pixel == face->format->bytes_per_pixel &&
|
||||||
fmt2->BytesPerPixel == face->format->BytesPerPixel &&
|
fmt2->bytes_per_pixel == face->format->bytes_per_pixel &&
|
||||||
(fmt1->Amask != 0) == (face->format->Amask != 0) &&
|
(fmt1->Amask != 0) == (face->format->Amask != 0) &&
|
||||||
(fmt2->Amask != 0) == (face->format->Amask != 0)) {
|
(fmt2->Amask != 0) == (face->format->Amask != 0)) {
|
||||||
final = SDL_ConvertSurface(cvt2, face->format);
|
final = SDL_ConvertSurface(cvt2, face->format);
|
||||||
|
@ -840,7 +840,7 @@ static int surface_testFlip(void *arg)
|
||||||
CHECK_FUNC(SDL_FlipSurface, (surface, SDL_FLIP_HORIZONTAL));
|
CHECK_FUNC(SDL_FlipSurface, (surface, SDL_FLIP_HORIZONTAL));
|
||||||
SDLTest_AssertCheck(pixels[offset] == 0x00,
|
SDLTest_AssertCheck(pixels[offset] == 0x00,
|
||||||
"Expected pixels[%d] == 0x00 got 0x%.2X", offset, pixels[offset]);
|
"Expected pixels[%d] == 0x00 got 0x%.2X", offset, pixels[offset]);
|
||||||
offset += (surface->w - 1) * surface->format->BytesPerPixel;
|
offset += (surface->w - 1) * surface->format->bytes_per_pixel;
|
||||||
SDLTest_AssertCheck(pixels[offset] == 0xFF,
|
SDLTest_AssertCheck(pixels[offset] == 0xFF,
|
||||||
"Expected pixels[%d] == 0xFF got 0x%.2X", offset, pixels[offset]);
|
"Expected pixels[%d] == 0xFF got 0x%.2X", offset, pixels[offset]);
|
||||||
|
|
||||||
|
|
|
@ -117,14 +117,14 @@ init_color_cursor(const char *file)
|
||||||
SDL_Surface *surface = SDL_LoadBMP(file);
|
SDL_Surface *surface = SDL_LoadBMP(file);
|
||||||
if (surface) {
|
if (surface) {
|
||||||
if (surface->format->palette) {
|
if (surface->format->palette) {
|
||||||
const Uint8 bpp = surface->format->BitsPerPixel;
|
const Uint8 bpp = surface->format->bits_per_pixel;
|
||||||
const Uint8 mask = (1 << bpp) - 1;
|
const Uint8 mask = (1 << bpp) - 1;
|
||||||
if (SDL_PIXELORDER(surface->format->format) == SDL_BITMAPORDER_4321)
|
if (SDL_PIXELORDER(surface->format->format) == SDL_BITMAPORDER_4321)
|
||||||
SDL_SetSurfaceColorKey(surface, 1, (*(Uint8 *)surface->pixels) & mask);
|
SDL_SetSurfaceColorKey(surface, 1, (*(Uint8 *)surface->pixels) & mask);
|
||||||
else
|
else
|
||||||
SDL_SetSurfaceColorKey(surface, 1, ((*(Uint8 *)surface->pixels) >> (8 - bpp)) & mask);
|
SDL_SetSurfaceColorKey(surface, 1, ((*(Uint8 *)surface->pixels) >> (8 - bpp)) & mask);
|
||||||
} else {
|
} else {
|
||||||
switch (surface->format->BitsPerPixel) {
|
switch (surface->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
SDL_SetSurfaceColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
|
SDL_SetSurfaceColorKey(surface, 1, (*(Uint16 *)surface->pixels) & 0x00007FFF);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -104,14 +104,14 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
|
||||||
/* Set transparent pixel as the pixel at (0,0) */
|
/* Set transparent pixel as the pixel at (0,0) */
|
||||||
if (transparent) {
|
if (transparent) {
|
||||||
if (temp->format->palette) {
|
if (temp->format->palette) {
|
||||||
const Uint8 bpp = temp->format->BitsPerPixel;
|
const Uint8 bpp = temp->format->bits_per_pixel;
|
||||||
const Uint8 mask = (1 << bpp) - 1;
|
const Uint8 mask = (1 << bpp) - 1;
|
||||||
if (SDL_PIXELORDER(temp->format->format) == SDL_BITMAPORDER_4321)
|
if (SDL_PIXELORDER(temp->format->format) == SDL_BITMAPORDER_4321)
|
||||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE, (*(Uint8 *)temp->pixels) & mask);
|
SDL_SetSurfaceColorKey(temp, SDL_TRUE, (*(Uint8 *)temp->pixels) & mask);
|
||||||
else
|
else
|
||||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE, ((*(Uint8 *)temp->pixels) >> (8 - bpp)) & mask);
|
SDL_SetSurfaceColorKey(temp, SDL_TRUE, ((*(Uint8 *)temp->pixels) >> (8 - bpp)) & mask);
|
||||||
} else {
|
} else {
|
||||||
switch (temp->format->BitsPerPixel) {
|
switch (temp->format->bits_per_pixel) {
|
||||||
case 15:
|
case 15:
|
||||||
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
|
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
|
||||||
(*(Uint16 *)temp->pixels) & 0x00007FFF);
|
(*(Uint16 *)temp->pixels) & 0x00007FFF);
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
SDL_version compiled;
|
SDL_Version compiled;
|
||||||
SDL_version linked;
|
SDL_Version linked;
|
||||||
|
|
||||||
/* Enable standard application logging */
|
/* Enable standard application logging */
|
||||||
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
|
||||||
|
|
Loading…
Reference in New Issue