Commit 9ba72107 authored by Sam Lantinga's avatar Sam Lantinga

Date: Fri, 19 Dec 2008 20:17:35 +0100

From: Couriersud
Subject: Re: Aw: Experience using SDL1.3 in sdlmame/Proposal for api additions

> For consistency you'd probably want:
> SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a);
> SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode);
> SDL_RenderLine(int x1, int y1, int x2, int y2);
> SDL_RenderFill(SDL_Rect *rect);
>
> You probably also want to add API functions query the current state.
>

I have implemented the above api for the opengl, x11, directfb and
software renderers. I have also renamed *TEXTUREBLENDMODE* constants to
BLENDMODE*. The unix build compiles. The windows renderer still needs to
be updated, but I have no windows development machine at hand. Have a
look at the x11 renderer for a sample.

Vector games now run at 90% both on opengl and directfb in comparison to
sdlmame's own opengl renderer. The same applies to raster games.

The diff also includes

a) Changed XDrawRect to XFillRect in x11 renderer
b) A number of changes to fix blending and modulation issues in the
directfb renderer.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403346
parent 60c39418
......@@ -5,6 +5,7 @@
- in progress, software support is done, Ryan is working on OpenGL shaders
* Implement desktop video mode change notification?
* Implement icon support (with translucency?)
* Add draw blend mode and line drawing support for software renderer and win32
* Verify mouse grab support
* Properly handle mouse grab with Vista DPI scaling
* Make sure the mouse is where it's supposed to be when un-grabbed
......
......@@ -145,7 +145,7 @@ initializeTextures()
if (shipID == 0) {
fatalError("could not create ship texture");
}
SDL_SetTextureBlendMode(shipID, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetTextureBlendMode(shipID, SDL_BLENDMODE_BLEND);
/* set the width and height of the ship from the surface dimensions */
ship.rect.w = bmp_surface->w;
......
......@@ -127,7 +127,7 @@ initializeTexture()
if (texture_id == 0) {
fatalError("could not create texture");
}
SDL_SetTextureBlendMode(texture_id, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetTextureBlendMode(texture_id, SDL_BLENDMODE_BLEND);
/* free up allocated memory */
SDL_FreeSurface(bmp_surface_rgba);
......
......@@ -223,7 +223,7 @@ loadFont(void)
printf("texture creation failed: %s\n", SDL_GetError());
} else {
/* set blend mode for our texture */
SDL_SetTextureBlendMode(textureID, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetTextureBlendMode(textureID, SDL_BLENDMODE_BLEND);
}
SDL_FreeSurface(surface);
SDL_FreeSurface(converted);
......
......@@ -65,7 +65,7 @@ initializeTexture()
fatalError("could not create brush texture");
}
/* additive blending -- laying strokes on top of eachother makes them brighter */
SDL_SetTextureBlendMode(brushID, SDL_TEXTUREBLENDMODE_ADD);
SDL_SetTextureBlendMode(brushID, SDL_BLENDMODE_ADD);
/* set brush color (red) */
SDL_SetTextureColorMod(brushID, 255, 100, 100);
}
......
......@@ -206,18 +206,18 @@ typedef enum
} SDL_TextureModulate;
/**
* \enum SDL_TextureBlendMode
* \enum SDL_BlendMode
*
* \brief The texture blend mode used in SDL_RenderCopy()
* \brief The blend mode used in SDL_RenderCopy() and drawing operations
*/
typedef enum
{
SDL_TEXTUREBLENDMODE_NONE = 0x00000000, /**< No blending */
SDL_TEXTUREBLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst (alpha is mask) */
SDL_TEXTUREBLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
SDL_TEXTUREBLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
SDL_TEXTUREBLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
} SDL_TextureBlendMode;
SDL_BLENDMODE_NONE = 0x00000000, /**< No blending */
SDL_BLENDMODE_MASK = 0x00000001, /**< dst = A ? src : dst (alpha is mask) */
SDL_BLENDMODE_BLEND = 0x00000002, /**< dst = (src * A) + (dst * (1-A)) */
SDL_BLENDMODE_ADD = 0x00000004, /**< dst = (src * A) + dst */
SDL_BLENDMODE_MOD = 0x00000008 /**< dst = src * dst */
} SDL_BlendMode;
/**
* \enum SDL_TextureScaleMode
......@@ -1141,9 +1141,80 @@ extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
const SDL_Rect * rects);
/**
* \fn void SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect *rect)
* \fn void SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
*
* \brief Fill the current rendering target with the specified color.
* \brief Set the color used for drawing operations (Fill and Line).
*
* \param r The red value used to draw on the rendering target
* \param g The green value used to draw on the rendering target
* \param b The blue value used to draw on the rendering target
* \param a The alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
* \return 0 on success, or -1 if there is no rendering context current
*/
extern DECLSPEC int SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b,
Uint8 a);
/**
* \fn void SDL_GetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
*
* \brief Get the color used for drawing operations (Fill and Line).
*
* \param r A pointer to the red value used to draw on the rendering target
* \param g A pointer to the green value used to draw on the rendering target
* \param b A pointer to the blue value used to draw on the rendering target
* \param a A pointer to the alpha value used to draw on the rendering target, usually SDL_ALPHA_OPAQUE (255)
* \return 0 on success, or -1 if there is no rendering context current
*/
extern DECLSPEC int SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b,
Uint8 * a);
/**
* \fn int SDL_SetRenderDrawBlendMode(int blendMode)
*
* \brief Set the blend mode used for drawing operations
*
* \param blendMode SDL_BlendMode to use for blending
*
* \return 0 on success, or -1 if there is no rendering context current
*
* \note If the blend mode is not supported, the closest supported mode is chosen.
*
* \sa SDL_SetRenderDrawBlendMode()
*/
extern DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(int blendMode);
/**
* \fn int SDL_GetRenderDrawBlendMode(int *blendMode)
*
* \brief Get the blend mode used for drawing operations
*
* \param blendMode A pointer filled in with the current blend mode
*
* \return 0 on success, or -1 if there is no rendering context current
*
* \sa SDL_SetRenderDrawBlendMode()
*/
extern DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(int *blendMode);
/**
* \fn void SDL_RenderLine(int x1, int y1, int x2, int y2)
*
* \brief Draw a line on the current rendering target.
*
* \param x1 The x coordinate of the start point
* \param y1 The y coordinate of the start point
* \param x2 The x coordinate of the end point
* \param y2 The y coordinate of the end point
*
* \return 0 on success, or -1 if there is no rendering context current
*/
extern DECLSPEC int SDLCALL SDL_RenderLine(int x1, int y1, int x2, int y2);
/**
* \fn void SDL_RenderFill(const SDL_Rect *rect)
*
* \brief Fill the current rendering target with the drawing color.
*
* \param r The red value used to fill the rendering target
* \param g The green value used to fill the rendering target
......@@ -1153,8 +1224,7 @@ extern DECLSPEC void SDLCALL SDL_DirtyTexture(SDL_TextureID textureID,
*
* \return 0 on success, or -1 if there is no rendering context current
*/
extern DECLSPEC int SDLCALL SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a,
const SDL_Rect * rect);
extern DECLSPEC int SDLCALL SDL_RenderFill(const SDL_Rect * rect);
/**
* \fn int SDL_RenderCopy(SDL_TextureID textureID, const SDL_Rect *srcrect, const SDL_Rect *dstrect)
......
......@@ -696,10 +696,10 @@ SDL_SetAlpha(SDL_Surface * surface, Uint32 flag, Uint8 value)
value = 0xFF;
}
SDL_SetSurfaceAlphaMod(surface, value);
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
} else {
SDL_SetSurfaceAlphaMod(surface, 0xFF);
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_NONE);
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
}
SDL_SetSurfaceRLE(surface, (flag & SDL_RLEACCEL));
......
......@@ -206,7 +206,7 @@ SDL_PROC_UNUSED(void, glLighti, (GLenum light, GLenum pname, GLint param))
SDL_PROC_UNUSED(void, glLightiv,
(GLenum light, GLenum pname, const GLint * params))
SDL_PROC_UNUSED(void, glLineStipple, (GLint factor, GLushort pattern))
SDL_PROC_UNUSED(void, glLineWidth, (GLfloat width))
SDL_PROC(void, glLineWidth, (GLfloat width))
SDL_PROC_UNUSED(void, glListBase, (GLuint base))
SDL_PROC(void, glLoadIdentity, (void))
SDL_PROC_UNUSED(void, glLoadMatrixd, (const GLdouble * m))
......@@ -272,7 +272,7 @@ SDL_PROC(void, glPixelStorei, (GLenum pname, GLint param))
SDL_PROC_UNUSED(void, glPixelTransferf, (GLenum pname, GLfloat param))
SDL_PROC_UNUSED(void, glPixelTransferi, (GLenum pname, GLint param))
SDL_PROC_UNUSED(void, glPixelZoom, (GLfloat xfactor, GLfloat yfactor))
SDL_PROC_UNUSED(void, glPointSize, (GLfloat size))
SDL_PROC(void, glPointSize, (GLfloat size))
SDL_PROC_UNUSED(void, glPolygonMode, (GLenum face, GLenum mode))
SDL_PROC_UNUSED(void, glPolygonOffset, (GLfloat factor, GLfloat units))
SDL_PROC_UNUSED(void, glPolygonStipple, (const GLubyte * mask))
......@@ -324,7 +324,7 @@ SDL_PROC_UNUSED(void, glRectdv, (const GLdouble * v1, const GLdouble * v2))
SDL_PROC_UNUSED(void, glRectf,
(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2))
SDL_PROC_UNUSED(void, glRectfv, (const GLfloat * v1, const GLfloat * v2))
SDL_PROC_UNUSED(void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2))
SDL_PROC(void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2))
SDL_PROC_UNUSED(void, glRectiv, (const GLint * v1, const GLint * v2))
SDL_PROC_UNUSED(void, glRects,
(GLshort x1, GLshort y1, GLshort x2, GLshort y2))
......
This diff is collapsed.
......@@ -85,9 +85,8 @@ SDL_RenderDriver GL_ES_RenderDriver = {
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
(SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
SDL_TEXTUREBLENDMODE_MOD),
(SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
SDL_TEXTURESCALEMODE_SLOW), 2,
{
......@@ -499,15 +498,15 @@ static int
GLES_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
{
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_NONE:
case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND:
case SDL_BLENDMODE_ADD:
case SDL_BLENDMODE_MOD:
return 0;
default:
SDL_Unsupported();
texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
texture->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}
......@@ -680,22 +679,22 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
if (texture->blendMode != data->blendMode) {
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
data->glDisable(GL_BLEND);
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND:
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
data->glEnable(GL_BLEND);
data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
data->glEnable(GL_BLEND);
data->glBlendFunc(GL_SRC_ALPHA, GL_ONE);
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
data->glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
data->glEnable(GL_BLEND);
data->glBlendFunc(GL_ZERO, GL_SRC_COLOR);
......
......@@ -59,8 +59,8 @@ static int SW_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty, void **pixels,
int *pitch);
static void SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect);
static int SW_SetDrawColor(SDL_Renderer * renderer);
static int SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
static int SW_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect);
static void SW_RenderPresent(SDL_Renderer * renderer);
......@@ -77,9 +77,8 @@ SDL_RenderDriver SW_RenderDriver = {
SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
(SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
SDL_TEXTUREBLENDMODE_MOD),
(SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
14,
{
......@@ -222,6 +221,13 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
}
renderer->ActivateRenderer = SW_ActivateRenderer;
renderer->DisplayModeChanged = SW_DisplayModeChanged;
renderer->SetDrawColor = SW_SetDrawColor;
/* FIXME : Implement
renderer->SetDrawBlendMode = GL_SetDrawBlendMode;
renderer->RenderLine = GL_RenderLine;
*/
renderer->RenderFill = SW_RenderFill;
renderer->RenderCopy = SW_RenderCopy;
renderer->RenderPresent = SW_RenderPresent;
......@@ -520,8 +526,13 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
static int
SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
const SDL_Rect * rect)
SW_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}
static int
SW_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
{
SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
Uint32 color;
......@@ -532,7 +543,8 @@ SW_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
SDL_AddDirtyRect(&data->dirty, rect);
}
color = SDL_MapRGBA(data->surface.format, r, g, b, a);
color = SDL_MapRGBA(data->surface.format,
renderer->r, renderer->g, renderer->b, renderer->a);
if (data->renderer->LockTexture(data->renderer,
data->texture[data->current_texture],
......
......@@ -140,7 +140,7 @@ SDL_CreateRGBSurface(Uint32 flags,
/* By default surface with an alpha mask are set up for blending */
if (Amask) {
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
}
/* The surface is ready to go */
......@@ -336,7 +336,7 @@ SDL_ConvertColorkeyToAlpha(SDL_Surface * surface)
SDL_UnlockSurface(surface);
SDL_SetColorKey(surface, 0, 0);
SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND);
}
int
......@@ -434,18 +434,18 @@ SDL_SetSurfaceBlendMode(SDL_Surface * surface, int blendMode)
surface->map->info.flags &=
~(SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD);
switch (blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_BLENDMODE_MASK:
surface->map->info.flags |= SDL_COPY_MASK;
break;
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_BLEND:
surface->map->info.flags |= SDL_COPY_BLEND;
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
surface->map->info.flags |= SDL_COPY_ADD;
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
surface->map->info.flags |= SDL_COPY_MOD;
break;
default:
......@@ -483,19 +483,19 @@ SDL_GetSurfaceBlendMode(SDL_Surface * surface, int *blendMode)
info.flags & (SDL_COPY_MASK | SDL_COPY_BLEND | SDL_COPY_ADD |
SDL_COPY_MOD)) {
case SDL_COPY_MASK:
*blendMode = SDL_TEXTUREBLENDMODE_MASK;
*blendMode = SDL_BLENDMODE_MASK;
break;
case SDL_COPY_BLEND:
*blendMode = SDL_TEXTUREBLENDMODE_BLEND;
*blendMode = SDL_BLENDMODE_BLEND;
break;
case SDL_COPY_ADD:
*blendMode = SDL_TEXTUREBLENDMODE_ADD;
*blendMode = SDL_BLENDMODE_ADD;
break;
case SDL_COPY_MOD:
*blendMode = SDL_TEXTUREBLENDMODE_MOD;
*blendMode = SDL_BLENDMODE_MOD;
break;
default:
*blendMode = SDL_TEXTUREBLENDMODE_NONE;
*blendMode = SDL_BLENDMODE_NONE;
break;
}
return 0;
......@@ -835,7 +835,7 @@ SDL_ConvertSurface(SDL_Surface * surface, SDL_PixelFormat * format,
* alpha channel or alpha modulation */
if ((surface->format->Amask && format->Amask) ||
(copy_flags & SDL_COPY_MODULATE_ALPHA)) {
SDL_SetSurfaceBlendMode(convert, SDL_TEXTUREBLENDMODE_BLEND);
SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
}
if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) {
SDL_SetSurfaceRLE(convert, SDL_RLEACCEL);
......
......@@ -88,8 +88,11 @@ struct SDL_Renderer
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
int (*RenderFill) (SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect);
int (*SetDrawColor) (SDL_Renderer * renderer);
int (*SetDrawBlendMode) (SDL_Renderer * renderer);
int (*RenderLine) (SDL_Renderer * renderer, int x1, int y1, int x2,
int y2);
int (*RenderFill) (SDL_Renderer * renderer, const SDL_Rect * rect);
int (*RenderCopy) (SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect);
void (*RenderPresent) (SDL_Renderer * renderer);
......@@ -103,6 +106,9 @@ struct SDL_Renderer
/* The window associated with the renderer */
SDL_WindowID window;
Uint8 r, g, b, a; /**< Color for drawing operations values */
int blendMode; /**< The drawing blend mode */
void *driverdata;
};
......
......@@ -1975,7 +1975,104 @@ SDL_DirtyTexture(SDL_TextureID textureID, int numrects,
}
int
SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{
SDL_Renderer *renderer;
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer) {
return -1;
}
if (!renderer->SetDrawColor) {
SDL_Unsupported();
return -1;
}
renderer->r = r;
renderer->g = g;
renderer->b = b;
renderer->a = a;
renderer->SetDrawColor(renderer);
return 0;
}
int
SDL_GetRenderDrawColor(Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
{
SDL_Renderer *renderer;
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer) {
return -1;
}
if (!renderer->SetDrawColor) {
SDL_Unsupported();
return -1;
}
if (r) {
*r = renderer->r;
}
if (g) {
*g = renderer->g;
}
if (b) {
*b = renderer->b;
}
if (a) {
*a = renderer->a;
}
return 0;
}
int
SDL_SetRenderDrawBlendMode(int blendMode)
{
SDL_Renderer *renderer;
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer) {
return -1;
}
if (!renderer->SetDrawBlendMode) {
SDL_Unsupported();
return -1;
}
renderer->blendMode = blendMode;
renderer->SetDrawBlendMode(renderer);
return 0;
}
int
SDL_GetRenderDrawBlendMode(int *blendMode)
{
SDL_Renderer *renderer;
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer) {
return -1;
}
*blendMode = renderer->blendMode;
return 0;
}
int
SDL_RenderFill(const SDL_Rect * rect)
{
SDL_Renderer *renderer;
SDL_Window *window;
......@@ -2003,7 +2100,42 @@ SDL_RenderFill(Uint8 r, Uint8 g, Uint8 b, Uint8 a, const SDL_Rect * rect)
return 0;
}
}
return renderer->RenderFill(renderer, r, g, b, a, &real_rect);
return renderer->RenderFill(renderer, &real_rect);
}
int
SDL_RenderLine(int x1, int y1, int x2, int y2)
{
SDL_Renderer *renderer;
SDL_Window *window;
SDL_Rect real_rect;
if (!_this) {
SDL_UninitializedVideo();
return -1;
}
renderer = SDL_CurrentDisplay.current_renderer;
if (!renderer) {
return -1;
}
if (!renderer->RenderLine) {
SDL_Unsupported();
return -1;
}
#if 0
//FIXME: Need line intersect routine
window = SDL_GetWindowFromID(renderer->window);
real_rect.x = 0;
real_rect.y = 0;
real_rect.w = window->w;
real_rect.h = window->h;
if (rect) {
if (!SDL_IntersectRect(rect, &real_rect, &real_rect)) {
return 0;
}
}
#endif
return renderer->RenderLine(renderer, x1, y1, x2, y2);
}
int
......
This diff is collapsed.
......@@ -31,8 +31,9 @@
static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window,
Uint32 flags);
static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g,
Uint8 b, Uint8 a, const SDL_Rect * rect);
static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer);
static int SDL_DUMMY_RenderFill(SDL_Renderer * renderer,
const SDL_Rect * rect);
static int SDL_DUMMY_RenderCopy(SDL_Renderer * renderer,
SDL_Texture * texture,
const SDL_Rect * srcrect,
......@@ -88,6 +89,7 @@ SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
}
SDL_zerop(data);
renderer->SetDrawColor = SDL_DUMMY_SetDrawColor;
renderer->RenderFill = SDL_DUMMY_RenderFill;
renderer->RenderCopy = SDL_DUMMY_RenderCopy;
renderer->RenderPresent = SDL_DUMMY_RenderPresent;
......@@ -124,8 +126,13 @@ SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
}
static int
SDL_DUMMY_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect)
SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}
static int
SDL_DUMMY_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
{
SDL_DUMMY_RenderData *data =
(SDL_DUMMY_RenderData *) renderer->driverdata;
......@@ -133,7 +140,8 @@ SDL_DUMMY_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint32 color;
SDL_Rect real_rect = *rect;
color = SDL_MapRGBA(target->format, r, g, b, a);
color = SDL_MapRGBA(target->format,
renderer->r, renderer->g, renderer->b, renderer->a);
return SDL_FillRect(target, &real_rect, color);
}
......
......@@ -140,7 +140,7 @@ SDL_RenderDriver NDS_RenderDriver = {
{"nds", /* char* name */
(SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */
(SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */
(SDL_TEXTUREBLENDMODE_MASK), /* u32 blend_modes */
(SDL_BLENDMODE_MASK), /* u32 blend_modes */
(SDL_TEXTURESCALEMODE_FAST), /* u32 scale_modes */
3, /* u32 num_texture_formats */
{
......
......@@ -82,9 +82,8 @@ SDL_RenderDriver D3D_RenderDriver = {
SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
(SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
SDL_TEXTUREBLENDMODE_BLEND | SDL_TEXTUREBLENDMODE_ADD |
SDL_TEXTUREBLENDMODE_MOD),
(SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK |
SDL_BLENDMODE_BLEND | SDL_BLENDMODE_ADD | SDL_BLENDMODE_MOD),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST |
SDL_TEXTURESCALEMODE_SLOW | SDL_TEXTURESCALEMODE_BEST),
12,
......@@ -525,15 +524,15 @@ static int
D3D_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
{
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_NONE:
case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND:
case SDL_BLENDMODE_ADD:
case SDL_BLENDMODE_MOD:
return 0;
default:
SDL_Unsupported();
texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
texture->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}
......@@ -798,12 +797,12 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
vertices[3].v = maxv;
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
FALSE);
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND:
IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
TRUE);
IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
......@@ -811,7 +810,7 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
D3DBLEND_INVSRCALPHA);
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
TRUE);
IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
......@@ -819,7 +818,7 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
D3DBLEND_ONE);
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
TRUE);
IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
......
......@@ -73,8 +73,7 @@ SDL_RenderDriver GDI_RenderDriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA),
(SDL_TEXTUREBLENDMODE_NONE | SDL_TEXTUREBLENDMODE_MASK |
SDL_TEXTUREBLENDMODE_BLEND),
(SDL_BLENDMODE_NONE | SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND),
(SDL_TEXTURESCALEMODE_NONE | SDL_TEXTURESCALEMODE_FAST),
14,
{
......@@ -459,13 +458,13 @@ static int
GDI_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
{
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_NONE:
case SDL_BLENDMODE_MASK:
case SDL_BLENDMODE_BLEND:
return 0;
default:
SDL_Unsupported();
texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
texture->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}
......@@ -617,8 +616,7 @@ GDI_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
SelectPalette(data->memory_hdc, texturedata->hpal, TRUE);
RealizePalette(data->memory_hdc);
}
if (texture->blendMode &
(SDL_TEXTUREBLENDMODE_MASK | SDL_TEXTUREBLENDMODE_BLEND)) {
if (texture->blendMode & (SDL_BLENDMODE_MASK | SDL_BLENDMODE_BLEND)) {
BLENDFUNCTION blendFunc = {
AC_SRC_OVER,
0,
......
......@@ -47,8 +47,11 @@ static int X11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty,
void **pixels, int *pitch);
static void X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int X11_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b,
Uint8 a, const SDL_Rect * rect);
static int X11_SetDrawColor(SDL_Renderer * renderer);
static int X11_SetDrawBlendMode(SDL_Renderer * renderer);
static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
int y2);
static int X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect);
static int X11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * srcrect, const SDL_Rect * dstrect);
static void X11_RenderPresent(SDL_Renderer * renderer);
......@@ -65,7 +68,7 @@ SDL_RenderDriver X11_RenderDriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_ACCELERATED),
SDL_TEXTUREMODULATE_NONE,
SDL_TEXTUREBLENDMODE_NONE,
SDL_BLENDMODE_NONE,
SDL_TEXTURESCALEMODE_NONE,
0,
{0},
......@@ -191,6 +194,9 @@ X11_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->UpdateTexture = X11_UpdateTexture;
renderer->LockTexture = X11_LockTexture;
renderer->UnlockTexture = X11_UnlockTexture;
renderer->SetDrawColor = X11_SetDrawColor;
renderer->SetDrawBlendMode = X11_SetDrawBlendMode;
renderer->RenderLine = X11_RenderLine;
renderer->RenderFill = X11_RenderFill;
renderer->RenderCopy = X11_RenderCopy;
renderer->RenderPresent = X11_RenderPresent;
......@@ -445,11 +451,11 @@ static int
X11_SetTextureBlendMode(SDL_Renderer * renderer, SDL_Texture * texture)
{
switch (texture->blendMode) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
return 0;
default:
SDL_Unsupported();
texture->blendMode = SDL_TEXTUREBLENDMODE_NONE;
texture->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}
......@@ -552,8 +558,73 @@ X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
static int
X11_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
const SDL_Rect * rect)
X11_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}
static int
X11_SetDrawBlendMode(SDL_Renderer * renderer)
{
switch (renderer->blendMode) {
case SDL_BLENDMODE_NONE:
return 0;
default:
SDL_Unsupported();
renderer->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}
static Uint32
renderdrawcolor(SDL_Renderer * renderer, int premult)
{
X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
Uint8 r = renderer->r;
Uint8 g = renderer->g;
Uint8 b = renderer->b;
Uint8 a = renderer->a;
if (premult)
return SDL_MapRGBA(data->format, ((int) r * (int) a) / 255,
((int) g * (int) a) / 255,
((int) b * (int) a) / 255, 255);
else
return SDL_MapRGBA(data->format, r, g, b, a);
}
static int
X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2, int y2)
{
X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
unsigned long foreground;
if (data->makedirty) {
SDL_Rect rect;
if (x1 < x2) {
rect.x = x1;
rect.w = (x2 - x1) + 1;
} else {
rect.x = x2;
rect.w = (x1 - x2) + 1;
}
if (y1 < y2) {
rect.y = y1;
rect.h = (y2 - y1) + 1;
} else {
rect.y = y2;
rect.h = (y1 - y2) + 1;
}
SDL_AddDirtyRect(&data->dirty, &rect);
}
foreground = renderdrawcolor(renderer, 1);
XSetForeground(data->display, data->gc, foreground);
XDrawLine(data->display, data->drawable, data->gc, x1, y1, x2, y2);
}
static int
X11_RenderFill(SDL_Renderer * renderer, const SDL_Rect * rect)
{
X11_RenderData *data = (X11_RenderData *) renderer->driverdata;
unsigned long foreground;
......@@ -562,9 +633,9 @@ X11_RenderFill(SDL_Renderer * renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a,
SDL_AddDirtyRect(&data->dirty, rect);
}
foreground = SDL_MapRGBA(data->format, r, g, b, a);
foreground = renderdrawcolor(renderer, 1);
XSetForeground(data->display, data->gc, foreground);
XDrawRectangle(data->display, data->drawable, data->gc, rect->x, rect->y,
XFillRectangle(data->display, data->drawable, data->gc, rect->x, rect->y,
rect->w, rect->h);
return 0;
}
......
......@@ -51,6 +51,7 @@ SDL_X11_SYM(int,XDeleteProperty,(Display* a,Window b,Atom c),(a,b,c),return)
SDL_X11_SYM(int,XDestroyWindow,(Display* a,Window b),(a,b),return)
SDL_X11_SYM(int,XDisplayKeycodes,(Display* a,int* b,int* c),(a,b,c),return)
SDL_X11_SYM(int,XDrawRectangle,(Display* a,Drawable b,GC c,int d, int e, unsigned int f, unsigned int g),(a,b,c,d,e,f,g),return)
SDL_X11_SYM(int,XFillRectangle,(Display* a,Drawable b,GC c,int d, int e, unsigned int f, unsigned int g),(a,b,c,d,e,f,g),return)
SDL_X11_SYM(char*,XDisplayName,(_Xconst char* a),(a),return)
SDL_X11_SYM(int,XEventsQueued,(Display* a,int b),(a,b),return)
SDL_X11_SYM(Bool,XFilterEvent,(XEvent *event,Window w),(event,w),return)
......@@ -94,6 +95,7 @@ SDL_X11_SYM(Display*,XOpenDisplay,(_Xconst char* a),(a),return)
SDL_X11_SYM(int,XPeekEvent,(Display* a,XEvent* b),(a,b),return)
SDL_X11_SYM(int,XPending,(Display* a),(a),return)
SDL_X11_SYM(int,XPutImage,(Display* a,Drawable b,GC c,XImage* d,int e,int f,int g,int h,unsigned int i,unsigned int j),(a,b,c,d,e,f,g,h,i,j),return)
SDL_X11_SYM(int,XDrawLine,(Display* a, Drawable b, GC c, int d, int e, int f, int g),(a,b,c,d,e,f,g),return)
SDL_X11_SYM(int,XQueryColors,(Display* a,Colormap b,XColor* c,int d),(a,b,c,d),return)
SDL_X11_SYM(int,XQueryKeymap,(Display* a,char *b),(a,b),return)
SDL_X11_SYM(Bool,XQueryPointer,(Display* a,Window b,Window* c,Window* d,int* e,int* f,int* g,int* h,unsigned int* i),(a,b,c,d,e,f,g,h,i),return)
......
......@@ -322,19 +322,19 @@ static void
PrintBlendMode(Uint32 flag)
{
switch (flag) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
fprintf(stderr, "None");
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_BLENDMODE_MASK:
fprintf(stderr, "Mask");
break;
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_BLEND:
fprintf(stderr, "Blend");
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
fprintf(stderr, "Add");
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
fprintf(stderr, "Mod");
break;
default:
......
......@@ -322,19 +322,19 @@ static void
PrintBlendMode(Uint32 flag)
{
switch (flag) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
fprintf(stderr, "None");
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_BLENDMODE_MASK:
fprintf(stderr, "Mask");
break;
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_BLEND:
fprintf(stderr, "Blend");
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
fprintf(stderr, "Add");
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
fprintf(stderr, "Mod");
break;
default:
......
......@@ -322,19 +322,19 @@ static void
PrintBlendMode(Uint32 flag)
{
switch (flag) {
case SDL_TEXTUREBLENDMODE_NONE:
case SDL_BLENDMODE_NONE:
fprintf(stderr, "None");
break;
case SDL_TEXTUREBLENDMODE_MASK:
case SDL_BLENDMODE_MASK:
fprintf(stderr, "Mask");
break;
case SDL_TEXTUREBLENDMODE_BLEND:
case SDL_BLENDMODE_BLEND:
fprintf(stderr, "Blend");
break;
case SDL_TEXTUREBLENDMODE_ADD:
case SDL_BLENDMODE_ADD:
fprintf(stderr, "Add");
break;
case SDL_TEXTUREBLENDMODE_MOD:
case SDL_BLENDMODE_MOD:
fprintf(stderr, "Mod");
break;
default:
......
......@@ -21,7 +21,7 @@ static int current_color = 0;
static SDL_Rect *positions;
static SDL_Rect *velocities;
static int sprite_w, sprite_h;
static SDL_TextureBlendMode blendMode = SDL_TEXTUREBLENDMODE_MASK;
static SDL_BlendMode blendMode = SDL_BLENDMODE_MASK;
static SDL_TextureScaleMode scaleMode = SDL_TEXTURESCALEMODE_NONE;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
......
......@@ -20,7 +20,7 @@ static int current_color = 0;
static SDL_Rect *positions;
static SDL_Rect *velocities;
static int sprite_w, sprite_h;
static SDL_TextureBlendMode blendMode = SDL_TEXTUREBLENDMODE_MASK;
static SDL_BlendMode blendMode = SDL_BLENDMODE_MASK;
static SDL_TextureScaleMode scaleMode = SDL_TEXTURESCALEMODE_NONE;
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
......@@ -119,7 +119,8 @@ MoveSprites(SDL_WindowID window, SDL_TextureID sprite)
/* Move the sprite, bounce at the wall, and draw */
n = 0;
SDL_RenderFill(0xA0, 0xA0, 0xA0, 0xFF, NULL);
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderFill(NULL);
for (i = 0; i < num_sprites; ++i) {
position = &positions[i];
velocity = &velocities[i];
......@@ -166,19 +167,19 @@ main(int argc, char *argv[])
if (SDL_strcasecmp(argv[i], "--blend") == 0) {
if (argv[i + 1]) {
if (SDL_strcasecmp(argv[i + 1], "none") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_NONE;
blendMode = SDL_BLENDMODE_NONE;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "mask") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_MASK;
blendMode = SDL_BLENDMODE_MASK;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "blend") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_BLEND;
blendMode = SDL_BLENDMODE_BLEND;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "add") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_ADD;
blendMode = SDL_BLENDMODE_ADD;
consumed = 2;
} else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) {
blendMode = SDL_TEXTUREBLENDMODE_MOD;
blendMode = SDL_BLENDMODE_MOD;
consumed = 2;
}
}
......@@ -230,7 +231,8 @@ main(int argc, char *argv[])
}
for (i = 0; i < state->num_windows; ++i) {
SDL_SelectRenderer(state->windows[i]);
SDL_RenderFill(0xA0, 0xA0, 0xA0, 0xFF, NULL);
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderFill(NULL);
}
if (LoadSprite("icon.bmp") < 0) {
quit(2);
......@@ -275,7 +277,8 @@ main(int argc, char *argv[])
switch (event.window.event) {
case SDL_WINDOWEVENT_EXPOSED:
SDL_SelectRenderer(event.window.windowID);
SDL_RenderFill(0xA0, 0xA0, 0xA0, 0xFF, NULL);
SDL_SetRenderDrawColor(0xA0, 0xA0, 0xA0, 0xFF);
SDL_RenderFill(NULL);
break;
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment