From 3cb3557f5959855f120965d81463859c0da867d2 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 20 Feb 2019 11:56:40 -0500 Subject: [PATCH] Implemented SDL_LockSurface and SDL_UnlockSurface --- src/SDL12_compat.c | 17 +++++++++++++++++ src/SDL20_include_wrapper.h | 4 ++++ src/SDL20_syms.h | 2 ++ 3 files changed, 23 insertions(+) diff --git a/src/SDL12_compat.c b/src/SDL12_compat.c index 2f03fc84d..0784822e5 100644 --- a/src/SDL12_compat.c +++ b/src/SDL12_compat.c @@ -2037,6 +2037,23 @@ SDL_SetAlpha(SDL12_Surface * surface, Uint32 flag, Uint8 value) return SDL20_Unsupported(); } +DECLSPEC int SDLCALL +SDL_LockSurface(SDL12_Surface *surface12) +{ + const int retval = SDL20_LockSurface(surface12->surface20); + surface12->pixels = surface12->surface20->pixels; + surface12->pitch = surface12->surface20->pitch; + return retval; +} + +DECLSPEC void SDLCALL +SDL_UnlockSurface(SDL12_Surface *surface12) +{ + SDL20_UnlockSurface(surface12->surface20); + surface12->pixels = surface12->surface20->pixels; + surface12->pitch = surface12->surface20->pitch; +} + DECLSPEC SDL12_Surface * SDLCALL SDL_ConvertSurface(SDL12_Surface *src12, const SDL12_PixelFormat *format12, Uint32 flags12) { diff --git a/src/SDL20_include_wrapper.h b/src/SDL20_include_wrapper.h index 2c9978e0a..178629f6e 100644 --- a/src/SDL20_include_wrapper.h +++ b/src/SDL20_include_wrapper.h @@ -87,6 +87,8 @@ #define SDL_LowerBlit IGNORE_THIS_VERSION_OF_SDL_LowerBlit #define SDL_ConvertSurface IGNORE_THIS_VERSION_OF_SDL_ConvertSurface #define SDL_SetColorKey IGNORE_THIS_VERSION_OF_SDL_SetColorKey +#define SDL_LockSurface IGNORE_THIS_VERSION_OF_SDL_LockSurface +#define SDL_UnlockSurface IGNORE_THIS_VERSION_OF_SDL_UnlockSurface #define BUILD_SDL 1 #include "SDL.h" @@ -151,6 +153,8 @@ #undef SDL_LowerBlit #undef SDL_ConvertSurface #undef SDL_SetColorKey +#undef SDL_LockSurface +#undef SDL_UnlockSurface #ifdef SDL_BlitSurface #undef SDL_BlitSurface diff --git a/src/SDL20_syms.h b/src/SDL20_syms.h index ad46567de..c48cbc8c5 100644 --- a/src/SDL20_syms.h +++ b/src/SDL20_syms.h @@ -88,6 +88,8 @@ SDL20_SYM(SDL_Surface *,CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 SDL20_SYM(SDL_Surface *,CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i),(a,b,c,d,e,f,g,h,i),return) SDL20_SYM(SDL_Surface *,CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return) SDL20_SYM(SDL_Surface *,ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c),(a,b,c),return) +SDL20_SYM(int,LockSurface,(SDL_Surface *a),(a),return) +SDL20_SYM(void,UnlockSurface,(SDL_Surface *a),(a),) SDL20_SYM(int,UpperBlit,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL20_SYM(int,LowerBlit,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c, SDL_Rect *d),(a,b,c,d),return) SDL20_SYM(int,SetColorKey,(SDL_Surface *a, int b, Uint32 c),(a,b,c),return)