diff --git a/sc2/ChangeLog b/sc2/ChangeLog index db7711c6f..0562811f8 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,6 @@ Changes towards version 0.7: +- Added TFB_Canvas_Lock(), TFB_Canvas_Unlock() and TFB_Canvas_GetStride() + - SvdB - Scaling images with respect to their hotspots: stabilizes compound Melee objects; re-added bilinear Melee scaler; zooming planet uses bilinear; fixes bug #685 - Alex diff --git a/sc2/src/sc2code/libs/graphics/sdl/canvas.c b/sc2/src/sc2code/libs/graphics/sdl/canvas.c index cc77b7844..6059b2265 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/canvas.c +++ b/sc2/src/sc2code/libs/graphics/sdl/canvas.c @@ -1527,6 +1527,20 @@ TFB_DrawCanvas_Rescale_Bilinear (TFB_Canvas src_canvas, TFB_Canvas dst_canvas, SDL_UnlockSurface(src); } +void +TFB_DrawCanvas_Lock (TFB_Canvas canvas) +{ + SDL_Surface *surf = (SDL_Surface *)canvas; + SDL_LockSurface (surf); +} + +void +TFB_DrawCanvas_Unlock (TFB_Canvas canvas) +{ + SDL_Surface *surf = (SDL_Surface *)canvas; + SDL_UnlockSurface (surf); +} + void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt) { @@ -1553,11 +1567,18 @@ TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt) } } +int +TFB_DrawCanvas_GetStride (TFB_Canvas canvas) +{ + SDL_Surface *surf = (SDL_Surface *)canvas; + return surf->pitch; +} + void* TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line) { - SDL_Surface* surf = (SDL_Surface *)canvas; - return (uint8*)surf->pixels + surf->pitch * line; + SDL_Surface *surf = (SDL_Surface *)canvas; + return (uint8 *)surf->pixels + surf->pitch * line; } void @@ -1618,3 +1639,4 @@ TFB_DrawCanvas_GetRotatedExtent (TFB_Canvas src_canvas, int angle, EXTENT *size) size->height = dsth; size->width = dstw; } + diff --git a/sc2/src/sc2code/libs/graphics/tfb_draw.h b/sc2/src/sc2code/libs/graphics/tfb_draw.h index 55ccd65e6..d3b113c55 100644 --- a/sc2/src/sc2code/libs/graphics/tfb_draw.h +++ b/sc2/src/sc2code/libs/graphics/tfb_draw.h @@ -150,7 +150,10 @@ BOOLEAN TFB_DrawCanvas_GetTransparentColor (TFB_Canvas canvas, int *r, int *g, i void TFB_DrawCanvas_SetTransparentColor (TFB_Canvas canvas, int r, int g, int b, BOOLEAN rleaccel); void TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src, TFB_Canvas dst); void TFB_DrawCanvas_Initialize (void); +void TFB_DrawCanvas_Lock (TFB_Canvas canvas); +void TFB_DrawCanvas_Unlock (TFB_Canvas canvas); void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt); +int TFB_DrawCanvas_GetStride (TFB_Canvas canvas); void* TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line); void TFB_DrawCanvas_GetPixel (TFB_Canvas canvas, int x, int y, int *r, int *g, int *b);