Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

SetDrawColor() and SetDrawBlendMode() are optional

  • Loading branch information
slouken committed Dec 30, 2008
1 parent 0426621 commit f695328144603f58a31380a1d336cfdae096b659
@@ -96,8 +96,6 @@ static int GL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
static void GL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static void GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects);
static int GL_SetDrawColor(SDL_Renderer * renderer);
static int GL_SetDrawBlendMode(SDL_Renderer * renderer);
static int GL_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int GL_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
int y2);
@@ -312,8 +310,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->LockTexture = GL_LockTexture;
renderer->UnlockTexture = GL_UnlockTexture;
renderer->DirtyTexture = GL_DirtyTexture;
renderer->SetDrawColor = GL_SetDrawColor;
renderer->SetDrawBlendMode = GL_SetDrawBlendMode;
renderer->RenderPoint = GL_RenderPoint;
renderer->RenderLine = GL_RenderLine;
renderer->RenderFill = GL_RenderFill;
@@ -1070,18 +1066,6 @@ GL_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture, int numrects,
}
}

static int
GL_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}

static int
GL_SetDrawBlendMode(SDL_Renderer * renderer)
{
return 0;
}

static int
GL_RenderPoint(SDL_Renderer * renderer, int x, int y)
{
@@ -59,8 +59,6 @@ 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_SetDrawColor(SDL_Renderer * renderer);
static int SW_SetDrawBlendMode(SDL_Renderer * renderer);
static int SW_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int SW_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
int y2);
@@ -226,8 +224,6 @@ SW_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->ActivateRenderer = SW_ActivateRenderer;
renderer->DisplayModeChanged = SW_DisplayModeChanged;

renderer->SetDrawColor = SW_SetDrawColor;
renderer->SetDrawBlendMode = SW_SetDrawBlendMode;
renderer->RenderPoint = SW_RenderPoint;
renderer->RenderLine = SW_RenderLine;
renderer->RenderFill = SW_RenderFill;
@@ -528,18 +524,6 @@ SW_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static int
SW_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}

static int
SW_SetDrawBlendMode(SDL_Renderer * renderer)
{
return 0;
}

static int
SW_RenderPoint(SDL_Renderer * renderer, int x, int y)
{
@@ -1987,16 +1987,15 @@ SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
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;
if (renderer->SetDrawColor) {
return renderer->SetDrawColor(renderer);
} else {
return 0;
}
}

int
@@ -2012,10 +2011,6 @@ SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
if (!renderer) {
return -1;
}
if (!renderer->SetDrawColor) {
SDL_Unsupported();
return -1;
}
if (r) {
*r = renderer->r;
}
@@ -2028,7 +2023,6 @@ SDL_GetRenderDrawColor(Uint8 * r, Uint8 * g, Uint8 * b, Uint8 * a)
if (a) {
*a = renderer->a;
}
return 0;
}

int
@@ -2044,13 +2038,12 @@ SDL_SetRenderDrawBlendMode(int blendMode)
if (!renderer) {
return -1;
}
if (!renderer->SetDrawBlendMode) {
SDL_Unsupported();
return -1;
}
renderer->blendMode = blendMode;
renderer->SetDrawBlendMode(renderer);
return 0;
if (renderer->SetDrawBlendMode) {
return renderer->SetDrawBlendMode(renderer);
} else {
return 0;
}
}

int
@@ -71,8 +71,6 @@ static void DirectFB_UnlockTexture(SDL_Renderer * renderer,
static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
SDL_Texture * texture, int numrects,
const SDL_Rect * rects);
static int DirectFB_SetDrawColor(SDL_Renderer * renderer);
static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
static int DirectFB_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int DirectFB_RenderLine(SDL_Renderer * renderer, int x1, int y1,
int x2, int y2);
@@ -294,8 +292,6 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->LockTexture = DirectFB_LockTexture;
renderer->UnlockTexture = DirectFB_UnlockTexture;
renderer->DirtyTexture = DirectFB_DirtyTexture;
renderer->SetDrawColor = DirectFB_SetDrawColor;
renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
renderer->RenderPoint = DirectFB_RenderPoint;
renderer->RenderLine = DirectFB_RenderLine;
renderer->RenderFill = DirectFB_RenderFill;
@@ -797,18 +793,6 @@ DirectFB_DirtyTexture(SDL_Renderer * renderer, SDL_Texture * texture,
}
}

static int
DirectFB_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}

static int
DirectFB_SetDrawBlendMode(SDL_Renderer * renderer)
{
return 0;
}

static int
PrepareDraw(SDL_Renderer * renderer)
{
@@ -31,8 +31,6 @@

static SDL_Renderer *SDL_DUMMY_CreateRenderer(SDL_Window * window,
Uint32 flags);
static int SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer);
static int SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer);
static int SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int SDL_DUMMY_RenderLine(SDL_Renderer * renderer, int x1, int y1,
int x2, int y2);
@@ -93,8 +91,6 @@ SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
}
SDL_zerop(data);

renderer->SetDrawColor = SDL_DUMMY_SetDrawColor;
renderer->SetDrawBlendMode = SDL_DUMMY_SetDrawBlendMode;
renderer->RenderPoint = SDL_DUMMY_RenderPoint;
renderer->RenderLine = SDL_DUMMY_RenderLine;
renderer->RenderFill = SDL_DUMMY_RenderFill;
@@ -132,18 +128,6 @@ SDL_DUMMY_CreateRenderer(SDL_Window * window, Uint32 flags)
return renderer;
}

static int
SDL_DUMMY_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}

static int
SDL_DUMMY_SetDrawBlendMode(SDL_Renderer * renderer)
{
return 0;
}

static int
SDL_DUMMY_RenderPoint(SDL_Renderer * renderer, int x, int y)
{
@@ -55,6 +55,7 @@ static int GDI_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, int markDirty,
void **pixels, int *pitch);
static void GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture);
static int GDI_SetDrawBlendMode(SDL_Renderer * renderer);
static int GDI_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int GDI_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
int y2);
@@ -175,6 +176,7 @@ GDI_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->UpdateTexture = GDI_UpdateTexture;
renderer->LockTexture = GDI_LockTexture;
renderer->UnlockTexture = GDI_UnlockTexture;
renderer->SetDrawBlendMode = GDI_SetDrawBlendMode;
renderer->RenderPoint = GDI_RenderPoint;
renderer->RenderLine = GDI_RenderLine;
renderer->RenderFill = GDI_RenderFill;
@@ -573,6 +575,19 @@ GDI_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static int
GDI_SetDrawBlendMode(SDL_Renderer * renderer)
{
switch (renderer->blendMode) {
case SDL_BLENDMODE_NONE:
return 0;
default:
SDL_Unsupported();
renderer->blendMode = SDL_BLENDMODE_NONE;
return -1;
}
}

static int
GDI_RenderPoint(SDL_Renderer * renderer, int x, int y)
{
@@ -47,7 +47,6 @@ 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_SetDrawColor(SDL_Renderer * renderer);
static int X11_SetDrawBlendMode(SDL_Renderer * renderer);
static int X11_RenderPoint(SDL_Renderer * renderer, int x, int y);
static int X11_RenderLine(SDL_Renderer * renderer, int x1, int y1, int x2,
@@ -197,7 +196,6 @@ 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->RenderPoint = X11_RenderPoint;
renderer->RenderLine = X11_RenderLine;
@@ -563,12 +561,6 @@ X11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
}

static int
X11_SetDrawColor(SDL_Renderer * renderer)
{
return 0;
}

static int
X11_SetDrawBlendMode(SDL_Renderer * renderer)
{

0 comments on commit f695328

Please sign in to comment.