Added TFB_DrawCanvas_GetScreenCanvas() and a callback DrawCommand.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2837 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
@@ -41,6 +41,7 @@ enum
|
|||||||
TFB_DRAWCOMMANDTYPE_DELETEDATA,
|
TFB_DRAWCOMMANDTYPE_DELETEDATA,
|
||||||
TFB_DRAWCOMMANDTYPE_SENDSIGNAL,
|
TFB_DRAWCOMMANDTYPE_SENDSIGNAL,
|
||||||
TFB_DRAWCOMMANDTYPE_REINITVIDEO,
|
TFB_DRAWCOMMANDTYPE_REINITVIDEO,
|
||||||
|
TFB_DRAWCOMMANDTYPE_CALLBACK,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct tfb_dc_line
|
typedef struct tfb_dc_line
|
||||||
@@ -135,6 +136,12 @@ typedef struct tfb_dc_reinit_video
|
|||||||
int driver, flags, width, height;
|
int driver, flags, width, height;
|
||||||
} TFB_DrawCommand_ReinitVideo;
|
} TFB_DrawCommand_ReinitVideo;
|
||||||
|
|
||||||
|
typedef struct tfb_dc_callback
|
||||||
|
{
|
||||||
|
void (*callback)(void *arg);
|
||||||
|
void *arg;
|
||||||
|
} TFB_DrawCommand_Callback;
|
||||||
|
|
||||||
typedef struct tfb_drawcommand
|
typedef struct tfb_drawcommand
|
||||||
{
|
{
|
||||||
int Type;
|
int Type;
|
||||||
@@ -153,6 +160,7 @@ typedef struct tfb_drawcommand
|
|||||||
TFB_DrawCommand_DeleteData deletedata;
|
TFB_DrawCommand_DeleteData deletedata;
|
||||||
TFB_DrawCommand_SendSignal sendsignal;
|
TFB_DrawCommand_SendSignal sendsignal;
|
||||||
TFB_DrawCommand_ReinitVideo reinitvideo;
|
TFB_DrawCommand_ReinitVideo reinitvideo;
|
||||||
|
TFB_DrawCommand_Callback callback;
|
||||||
} data;
|
} data;
|
||||||
} TFB_DrawCommand;
|
} TFB_DrawCommand;
|
||||||
|
|
||||||
|
|||||||
@@ -1541,6 +1541,14 @@ TFB_DrawCanvas_Unlock (TFB_Canvas canvas)
|
|||||||
SDL_UnlockSurface (surf);
|
SDL_UnlockSurface (surf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This function should only be called from the graphics thread,
|
||||||
|
// like from a TFB_DrawCommand_Callback command.
|
||||||
|
TFB_Canvas
|
||||||
|
TFB_DrawCanvas_GetScreenCanvas (SCREEN screen)
|
||||||
|
{
|
||||||
|
return (TFB_Canvas) SDL_Screens[screen];
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt)
|
TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ TFB_ComputeFPS (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_FlushGraphics () // Only call from main thread!!
|
TFB_FlushGraphics (void) // Only call from main thread!!
|
||||||
{
|
{
|
||||||
int commands_handled;
|
int commands_handled;
|
||||||
BOOLEAN livelock_deterrence;
|
BOOLEAN livelock_deterrence;
|
||||||
@@ -908,6 +908,11 @@ TFB_FlushGraphics () // Only call from main thread!!
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TFB_DRAWCOMMANDTYPE_CALLBACK:
|
||||||
|
{
|
||||||
|
DC.data.callback.callback (DC.data.callback.arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,6 +228,16 @@ TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height)
|
|||||||
TFB_EnqueueDrawCommand (&DrawCommand);
|
TFB_EnqueueDrawCommand (&DrawCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
TFB_DrawScreen_Callback (void (*callback) (void *arg), void *arg)
|
||||||
|
{
|
||||||
|
TFB_DrawCommand DrawCommand;
|
||||||
|
DrawCommand.Type = TFB_DRAWCOMMANDTYPE_CALLBACK;
|
||||||
|
DrawCommand.data.callback.callback = callback;
|
||||||
|
DrawCommand.data.callback.arg = arg;
|
||||||
|
TFB_EnqueueDrawCommand(&DrawCommand);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
TFB_DrawImage_Line (int x1, int y1, int x2, int y2, int r, int g, int b,
|
||||||
TFB_Image *dest)
|
TFB_Image *dest)
|
||||||
@@ -417,3 +427,4 @@ TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type)
|
|||||||
image->last_scale = target;
|
image->last_scale = target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ void TFB_DrawScreen_DeleteData (void *);
|
|||||||
void TFB_DrawScreen_WaitForSignal (void);
|
void TFB_DrawScreen_WaitForSignal (void);
|
||||||
void TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height);
|
void TFB_DrawScreen_ReinitVideo (int driver, int flags, int width, int height);
|
||||||
void TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b);
|
void TFB_DrawScreen_SetPalette (int paletteIndex, int r, int g, int b);
|
||||||
|
void TFB_DrawScreen_Callback (void (*callback) (void *arg), void *arg);
|
||||||
|
|
||||||
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
TFB_Image *TFB_DrawImage_New (TFB_Canvas canvas);
|
||||||
TFB_Image *TFB_DrawImage_CreateForScreen (int w, int h, BOOLEAN withalpha);
|
TFB_Image *TFB_DrawImage_CreateForScreen (int w, int h, BOOLEAN withalpha);
|
||||||
@@ -152,6 +153,7 @@ void TFB_DrawCanvas_CopyTransparencyInfo (TFB_Canvas src, TFB_Canvas dst);
|
|||||||
void TFB_DrawCanvas_Initialize (void);
|
void TFB_DrawCanvas_Initialize (void);
|
||||||
void TFB_DrawCanvas_Lock (TFB_Canvas canvas);
|
void TFB_DrawCanvas_Lock (TFB_Canvas canvas);
|
||||||
void TFB_DrawCanvas_Unlock (TFB_Canvas canvas);
|
void TFB_DrawCanvas_Unlock (TFB_Canvas canvas);
|
||||||
|
TFB_Canvas TFB_DrawCanvas_GetScreenCanvas (SCREEN screen);
|
||||||
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
void TFB_DrawCanvas_GetScreenFormat (TFB_PixelFormat *fmt);
|
||||||
int TFB_DrawCanvas_GetStride (TFB_Canvas canvas);
|
int TFB_DrawCanvas_GetStride (TFB_Canvas canvas);
|
||||||
void *TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
void *TFB_DrawCanvas_GetLine (TFB_Canvas canvas, int line);
|
||||||
|
|||||||
Reference in New Issue
Block a user