Skip to content

Commit

Permalink
Implemented SDL_LockSurface and SDL_UnlockSurface
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Feb 20, 2019
1 parent e6c43e1 commit 3cb3557
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/SDL12_compat.c
Expand Up @@ -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)
{
Expand Down
4 changes: 4 additions & 0 deletions src/SDL20_include_wrapper.h
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/SDL20_syms.h
Expand Up @@ -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)
Expand Down

0 comments on commit 3cb3557

Please sign in to comment.