Commit 4c06e581 authored by Sam Lantinga's avatar Sam Lantinga

Making the API simpler, texture color and alpha modulation are supported by all renderers.

--HG--
extra : rebase_source : 880752438aae8f6526503d220bad91aabc3a7d1c
parent 825e1da5
...@@ -186,7 +186,6 @@ typedef struct SDL_RendererInfo ...@@ -186,7 +186,6 @@ typedef struct SDL_RendererInfo
{ {
const char *name; /**< The name of the renderer */ const char *name; /**< The name of the renderer */
Uint32 flags; /**< Supported ::SDL_RendererFlags */ Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 mod_modes; /**< A mask of supported channel modulation */
Uint32 num_texture_formats; /**< The number of available texture formats */ Uint32 num_texture_formats; /**< The number of available texture formats */
Uint32 texture_formats[50]; /**< The available texture formats */ Uint32 texture_formats[50]; /**< The available texture formats */
int max_texture_width; /**< The maximimum texture width */ int max_texture_width; /**< The maximimum texture width */
......
...@@ -79,10 +79,6 @@ static int GL_SetTexturePalette(SDL_Renderer * renderer, ...@@ -79,10 +79,6 @@ static int GL_SetTexturePalette(SDL_Renderer * renderer,
static int GL_GetTexturePalette(SDL_Renderer * renderer, static int GL_GetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int GL_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int GL_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -118,8 +114,6 @@ SDL_RenderDriver GL_RenderDriver = { ...@@ -118,8 +114,6 @@ SDL_RenderDriver GL_RenderDriver = {
"opengl", "opengl",
(SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD | (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
15, 15,
{ {
SDL_PIXELFORMAT_INDEX1LSB, SDL_PIXELFORMAT_INDEX1LSB,
...@@ -291,8 +285,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -291,8 +285,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = GL_QueryTexturePixels; renderer->QueryTexturePixels = GL_QueryTexturePixels;
renderer->SetTexturePalette = GL_SetTexturePalette; renderer->SetTexturePalette = GL_SetTexturePalette;
renderer->GetTexturePalette = GL_GetTexturePalette; renderer->GetTexturePalette = GL_GetTexturePalette;
renderer->SetTextureColorMod = GL_SetTextureColorMod;
renderer->SetTextureAlphaMod = GL_SetTextureAlphaMod;
renderer->UpdateTexture = GL_UpdateTexture; renderer->UpdateTexture = GL_UpdateTexture;
renderer->LockTexture = GL_LockTexture; renderer->LockTexture = GL_LockTexture;
renderer->UnlockTexture = GL_UnlockTexture; renderer->UnlockTexture = GL_UnlockTexture;
...@@ -947,18 +939,6 @@ SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture, ...@@ -947,18 +939,6 @@ SetupTextureUpdate(GL_RenderData * renderdata, SDL_Texture * texture,
HACK_RYAN_FIXME); HACK_RYAN_FIXME);
} }
static int
GL_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int
GL_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int static int
GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
......
...@@ -67,10 +67,6 @@ static int GLES_SetTexturePalette(SDL_Renderer * renderer, ...@@ -67,10 +67,6 @@ static int GLES_SetTexturePalette(SDL_Renderer * renderer,
static int GLES_GetTexturePalette(SDL_Renderer * renderer, static int GLES_GetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int GLES_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int GLES_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -104,8 +100,6 @@ SDL_RenderDriver GL_ES_RenderDriver = { ...@@ -104,8 +100,6 @@ SDL_RenderDriver GL_ES_RenderDriver = {
"opengl_es", "opengl_es",
(SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD | (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD |
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED), SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
{ {
/* OpenGL ES 1.x supported formats list */ /* OpenGL ES 1.x supported formats list */
SDL_PIXELFORMAT_RGBA4444, SDL_PIXELFORMAT_RGBA4444,
...@@ -231,8 +225,6 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -231,8 +225,6 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = GLES_QueryTexturePixels; renderer->QueryTexturePixels = GLES_QueryTexturePixels;
renderer->SetTexturePalette = GLES_SetTexturePalette; renderer->SetTexturePalette = GLES_SetTexturePalette;
renderer->GetTexturePalette = GLES_GetTexturePalette; renderer->GetTexturePalette = GLES_GetTexturePalette;
renderer->SetTextureColorMod = GLES_SetTextureColorMod;
renderer->SetTextureAlphaMod = GLES_SetTextureAlphaMod;
renderer->UpdateTexture = GLES_UpdateTexture; renderer->UpdateTexture = GLES_UpdateTexture;
renderer->LockTexture = GLES_LockTexture; renderer->LockTexture = GLES_LockTexture;
renderer->UnlockTexture = GLES_UnlockTexture; renderer->UnlockTexture = GLES_UnlockTexture;
...@@ -496,18 +488,6 @@ SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture, ...@@ -496,18 +488,6 @@ SetupTextureUpdate(GLES_RenderData * renderdata, SDL_Texture * texture,
renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); renderdata->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
} }
static int
GLES_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int
GLES_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int static int
GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
......
...@@ -49,6 +49,8 @@ static int SW_SetTextureColorMod(SDL_Renderer * renderer, ...@@ -49,6 +49,8 @@ static int SW_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture); SDL_Texture * texture);
static int SW_SetTextureAlphaMod(SDL_Renderer * renderer, static int SW_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture); SDL_Texture * texture);
static int SW_SetTextureBlendMode(SDL_Renderer * renderer,
SDL_Texture * texture);
static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int SW_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -82,8 +84,6 @@ SDL_RenderDriver SW_RenderDriver = { ...@@ -82,8 +84,6 @@ SDL_RenderDriver SW_RenderDriver = {
(SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY | (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTCOPY |
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
14, 14,
{ {
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
...@@ -172,12 +172,12 @@ Setup_SoftwareRenderer(SDL_Renderer * renderer) ...@@ -172,12 +172,12 @@ Setup_SoftwareRenderer(SDL_Renderer * renderer)
renderer->GetTexturePalette = SW_GetTexturePalette; renderer->GetTexturePalette = SW_GetTexturePalette;
renderer->SetTextureColorMod = SW_SetTextureColorMod; renderer->SetTextureColorMod = SW_SetTextureColorMod;
renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod; renderer->SetTextureAlphaMod = SW_SetTextureAlphaMod;
renderer->SetTextureBlendMode = SW_SetTextureBlendMode;
renderer->UpdateTexture = SW_UpdateTexture; renderer->UpdateTexture = SW_UpdateTexture;
renderer->LockTexture = SW_LockTexture; renderer->LockTexture = SW_LockTexture;
renderer->UnlockTexture = SW_UnlockTexture; renderer->UnlockTexture = SW_UnlockTexture;
renderer->DestroyTexture = SW_DestroyTexture; renderer->DestroyTexture = SW_DestroyTexture;
renderer->info.mod_modes = SW_RenderDriver.info.mod_modes;
renderer->info.num_texture_formats = renderer->info.num_texture_formats =
SW_RenderDriver.info.num_texture_formats; SW_RenderDriver.info.num_texture_formats;
SDL_memcpy(renderer->info.texture_formats, SDL_memcpy(renderer->info.texture_formats,
......
...@@ -86,8 +86,6 @@ struct SDL_Renderer ...@@ -86,8 +86,6 @@ struct SDL_Renderer
void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture); void (*UnlockTexture) (SDL_Renderer * renderer, SDL_Texture * texture);
void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture, void (*DirtyTexture) (SDL_Renderer * renderer, SDL_Texture * texture,
int numrects, const SDL_Rect * rects); int numrects, const SDL_Rect * rects);
int (*SetDrawColor) (SDL_Renderer * renderer);
int (*SetDrawBlendMode) (SDL_Renderer * renderer);
int (*RenderClear) (SDL_Renderer * renderer); int (*RenderClear) (SDL_Renderer * renderer);
int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points, int (*RenderDrawPoints) (SDL_Renderer * renderer, const SDL_Point * points,
int count); int count);
......
...@@ -2074,7 +2074,11 @@ SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b) ...@@ -2074,7 +2074,11 @@ SDL_SetTextureColorMod(SDL_Texture * texture, Uint8 r, Uint8 g, Uint8 b)
texture->r = r; texture->r = r;
texture->g = g; texture->g = g;
texture->b = b; texture->b = b;
if (renderer->SetTextureColorMod) {
return renderer->SetTextureColorMod(renderer, texture); return renderer->SetTextureColorMod(renderer, texture);
} else {
return 0;
}
} }
int int
...@@ -2116,7 +2120,11 @@ SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha) ...@@ -2116,7 +2120,11 @@ SDL_SetTextureAlphaMod(SDL_Texture * texture, Uint8 alpha)
texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA; texture->modMode &= ~SDL_TEXTUREMODULATE_ALPHA;
} }
texture->a = alpha; texture->a = alpha;
if (renderer->SetTextureAlphaMod) {
return renderer->SetTextureAlphaMod(renderer, texture); return renderer->SetTextureAlphaMod(renderer, texture);
} else {
return 0;
}
} }
int int
...@@ -2143,7 +2151,11 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode) ...@@ -2143,7 +2151,11 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode)
return -1; return -1;
} }
texture->blendMode = blendMode; texture->blendMode = blendMode;
if (renderer->SetTextureBlendMode) {
return renderer->SetTextureBlendMode(renderer, texture); return renderer->SetTextureBlendMode(renderer, texture);
} else {
return 0;
}
} }
int int
...@@ -2258,11 +2270,7 @@ SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a) ...@@ -2258,11 +2270,7 @@ SDL_SetRenderDrawColor(Uint8 r, Uint8 g, Uint8 b, Uint8 a)
renderer->g = g; renderer->g = g;
renderer->b = b; renderer->b = b;
renderer->a = a; renderer->a = a;
if (renderer->SetDrawColor) {
return renderer->SetDrawColor(renderer);
} else {
return 0; return 0;
}
} }
int int
...@@ -2299,11 +2307,7 @@ SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode) ...@@ -2299,11 +2307,7 @@ SDL_SetRenderDrawBlendMode(SDL_BlendMode blendMode)
return -1; return -1;
} }
renderer->blendMode = blendMode; renderer->blendMode = blendMode;
if (renderer->SetDrawBlendMode) {
return renderer->SetDrawBlendMode(renderer);
} else {
return 0; return 0;
}
} }
int int
......
...@@ -51,10 +51,6 @@ static int DirectFB_GetTexturePalette(SDL_Renderer * renderer, ...@@ -51,10 +51,6 @@ static int DirectFB_GetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Texture * texture,
SDL_Color * colors, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int DirectFB_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int DirectFB_UpdateTexture(SDL_Renderer * renderer, static int DirectFB_UpdateTexture(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Texture * texture,
const SDL_Rect * rect, const SDL_Rect * rect,
...@@ -68,7 +64,6 @@ static void DirectFB_UnlockTexture(SDL_Renderer * renderer, ...@@ -68,7 +64,6 @@ static void DirectFB_UnlockTexture(SDL_Renderer * renderer,
static void DirectFB_DirtyTexture(SDL_Renderer * renderer, static void DirectFB_DirtyTexture(SDL_Renderer * renderer,
SDL_Texture * texture, int numrects, SDL_Texture * texture, int numrects,
const SDL_Rect * rects); const SDL_Rect * rects);
static int DirectFB_SetDrawBlendMode(SDL_Renderer * renderer);
static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer, static int DirectFB_RenderDrawPoints(SDL_Renderer * renderer,
const SDL_Point * points, int count); const SDL_Point * points, int count);
static int DirectFB_RenderDrawLines(SDL_Renderer * renderer, static int DirectFB_RenderDrawLines(SDL_Renderer * renderer,
...@@ -96,8 +91,6 @@ SDL_RenderDriver DirectFB_RenderDriver = { ...@@ -96,8 +91,6 @@ SDL_RenderDriver DirectFB_RenderDriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
SDL_RENDERER_ACCELERATED), SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
14, 14,
{ {
SDL_PIXELFORMAT_INDEX4LSB, SDL_PIXELFORMAT_INDEX4LSB,
...@@ -275,16 +268,12 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -275,16 +268,12 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = DirectFB_QueryTexturePixels; renderer->QueryTexturePixels = DirectFB_QueryTexturePixels;
renderer->SetTexturePalette = DirectFB_SetTexturePalette; renderer->SetTexturePalette = DirectFB_SetTexturePalette;
renderer->GetTexturePalette = DirectFB_GetTexturePalette; renderer->GetTexturePalette = DirectFB_GetTexturePalette;
renderer->SetTextureAlphaMod = DirectFB_SetTextureAlphaMod;
renderer->SetTextureColorMod = DirectFB_SetTextureColorMod;
renderer->UpdateTexture = DirectFB_UpdateTexture; renderer->UpdateTexture = DirectFB_UpdateTexture;
renderer->LockTexture = DirectFB_LockTexture; renderer->LockTexture = DirectFB_LockTexture;
renderer->UnlockTexture = DirectFB_UnlockTexture; renderer->UnlockTexture = DirectFB_UnlockTexture;
renderer->DirtyTexture = DirectFB_DirtyTexture; renderer->DirtyTexture = DirectFB_DirtyTexture;
renderer->RenderDrawPoints = DirectFB_RenderDrawPoints; renderer->RenderDrawPoints = DirectFB_RenderDrawPoints;
renderer->RenderDrawLines = DirectFB_RenderDrawLines; renderer->RenderDrawLines = DirectFB_RenderDrawLines;
/* SetDrawColor - no needed */
renderer->SetDrawBlendMode = DirectFB_SetDrawBlendMode;
renderer->RenderFillRects = DirectFB_RenderFillRects; renderer->RenderFillRects = DirectFB_RenderFillRects;
renderer->RenderDrawRects = DirectFB_RenderDrawRects; renderer->RenderDrawRects = DirectFB_RenderDrawRects;
/* RenderDrawEllipse - no reference implementation yet */ /* RenderDrawEllipse - no reference implementation yet */
...@@ -635,18 +624,6 @@ DirectFB_GetTexturePalette(SDL_Renderer * renderer, ...@@ -635,18 +624,6 @@ DirectFB_GetTexturePalette(SDL_Renderer * renderer,
return -1; return -1;
} }
static int
DirectFB_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int
DirectFB_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int static int
DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture) DirectFB_SetTextureScaleMode(SDL_Renderer * renderer, SDL_Texture * texture)
{ {
......
...@@ -50,10 +50,6 @@ static int NDS_SetTexturePalette(SDL_Renderer * renderer, ...@@ -50,10 +50,6 @@ static int NDS_SetTexturePalette(SDL_Renderer * renderer,
static int NDS_GetTexturePalette(SDL_Renderer * renderer, static int NDS_GetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int NDS_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int NDS_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int NDS_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -76,7 +72,6 @@ SDL_RenderDriver NDS_RenderDriver = { ...@@ -76,7 +72,6 @@ SDL_RenderDriver NDS_RenderDriver = {
NDS_CreateRenderer, NDS_CreateRenderer,
{"nds", /* char* name */ {"nds", /* char* name */
(SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */ (SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC), /* u32 flags */
(SDL_TEXTUREMODULATE_NONE), /* u32 mod_modes */
3, /* u32 num_texture_formats */ 3, /* u32 num_texture_formats */
{ {
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
...@@ -175,14 +170,11 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -175,14 +170,11 @@ NDS_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = NDS_QueryTexturePixels; renderer->QueryTexturePixels = NDS_QueryTexturePixels;
renderer->SetTexturePalette = NDS_SetTexturePalette; renderer->SetTexturePalette = NDS_SetTexturePalette;
renderer->GetTexturePalette = NDS_GetTexturePalette; renderer->GetTexturePalette = NDS_GetTexturePalette;
renderer->SetTextureColorMod = NDS_SetTextureColorMod;
renderer->SetTextureAlphaMod = NDS_SetTextureAlphaMod;
renderer->UpdateTexture = NDS_UpdateTexture; renderer->UpdateTexture = NDS_UpdateTexture;
renderer->LockTexture = NDS_LockTexture; renderer->LockTexture = NDS_LockTexture;
renderer->UnlockTexture = NDS_UnlockTexture; renderer->UnlockTexture = NDS_UnlockTexture;
renderer->DestroyTexture = NDS_DestroyTexture; renderer->DestroyTexture = NDS_DestroyTexture;
renderer->info.mod_modes = NDS_RenderDriver.info.mod_modes;
renderer->info.num_texture_formats = renderer->info.num_texture_formats =
NDS_RenderDriver.info.num_texture_formats; NDS_RenderDriver.info.num_texture_formats;
SDL_memcpy(renderer->info.texture_formats, SDL_memcpy(renderer->info.texture_formats,
...@@ -557,18 +549,4 @@ NDS_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -557,18 +549,4 @@ NDS_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
return 0; return 0;
} }
static int
NDS_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
/* stub! */
return 0;
}
static int
NDS_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
/* stub! */
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */ /* vi: set ts=4 sw=4 expandtab: */
...@@ -54,12 +54,6 @@ static int photon_settexturepalette(SDL_Renderer * renderer, ...@@ -54,12 +54,6 @@ static int photon_settexturepalette(SDL_Renderer * renderer,
static int photon_gettexturepalette(SDL_Renderer * renderer, static int photon_gettexturepalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int photon_settexturecolormod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int photon_settexturealphamod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int photon_settexturescalemode(SDL_Renderer * renderer,
SDL_Texture * texture);
static int photon_updatetexture(SDL_Renderer * renderer, static int photon_updatetexture(SDL_Renderer * renderer,
SDL_Texture * texture, const SDL_Rect * rect, SDL_Texture * texture, const SDL_Rect * rect,
const void *pixels, int pitch); const void *pixels, int pitch);
...@@ -71,7 +65,6 @@ static void photon_unlocktexture(SDL_Renderer * renderer, ...@@ -71,7 +65,6 @@ static void photon_unlocktexture(SDL_Renderer * renderer,
static void photon_dirtytexture(SDL_Renderer * renderer, static void photon_dirtytexture(SDL_Renderer * renderer,
SDL_Texture * texture, int numrects, SDL_Texture * texture, int numrects,
const SDL_Rect * rects); const SDL_Rect * rects);
static int photon_setdrawcolor(SDL_Renderer * renderer);
static int photon_renderpoint(SDL_Renderer * renderer, int x, int y); static int photon_renderpoint(SDL_Renderer * renderer, int x, int y);
static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2, static int photon_renderline(SDL_Renderer * renderer, int x1, int y1, int x2,
int y2); int y2);
...@@ -98,7 +91,6 @@ SDL_RenderDriver photon_renderdriver = { ...@@ -98,7 +91,6 @@ SDL_RenderDriver photon_renderdriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
SDL_RENDERER_ACCELERATED), SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_ALPHA),
10, 10,
{SDL_PIXELFORMAT_INDEX8, {SDL_PIXELFORMAT_INDEX8,
SDL_PIXELFORMAT_RGB555, SDL_PIXELFORMAT_RGB555,
...@@ -144,13 +136,10 @@ photon_createrenderer(SDL_Window * window, Uint32 flags) ...@@ -144,13 +136,10 @@ photon_createrenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = photon_querytexturepixels; renderer->QueryTexturePixels = photon_querytexturepixels;
renderer->SetTexturePalette = photon_settexturepalette; renderer->SetTexturePalette = photon_settexturepalette;
renderer->GetTexturePalette = photon_gettexturepalette; renderer->GetTexturePalette = photon_gettexturepalette;
renderer->SetTextureAlphaMod = photon_settexturealphamod;
renderer->SetTextureColorMod = photon_settexturecolormod;
renderer->UpdateTexture = photon_updatetexture; renderer->UpdateTexture = photon_updatetexture;
renderer->LockTexture = photon_locktexture; renderer->LockTexture = photon_locktexture;
renderer->UnlockTexture = photon_unlocktexture; renderer->UnlockTexture = photon_unlocktexture;
renderer->DirtyTexture = photon_dirtytexture; renderer->DirtyTexture = photon_dirtytexture;
renderer->SetDrawColor = photon_setdrawcolor;
renderer->RenderPoint = photon_renderpoint; renderer->RenderPoint = photon_renderpoint;
renderer->RenderLine = photon_renderline; renderer->RenderLine = photon_renderline;
renderer->RenderFill = photon_renderfill; renderer->RenderFill = photon_renderfill;
...@@ -871,35 +860,6 @@ photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -871,35 +860,6 @@ photon_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
return -1; return -1;
} }
static int
photon_settexturecolormod(SDL_Renderer * renderer, SDL_Texture * texture)
{
SDL_Unsupported();
return -1;
}
static int
photon_settexturealphamod(SDL_Renderer * renderer, SDL_Texture * texture)
{
SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
/* Check, if it is not initialized */
if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN)
{
SDL_SetError("Photon: can't set texture blend mode for OpenGL ES window");
return -1;
}
/* Check if current renderer instance supports alpha modulation */
if ((renderer->info.mod_modes & SDL_TEXTUREMODULATE_ALPHA)!=SDL_TEXTUREMODULATE_ALPHA)
{
SDL_Unsupported();
return -1;
}
return 0;
}
static int static int
photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, photon_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
...@@ -1024,33 +984,6 @@ photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -1024,33 +984,6 @@ photon_dirtytexture(SDL_Renderer * renderer, SDL_Texture * texture,
} }
} }
static int
photon_setdrawcolor(SDL_Renderer * renderer)
{
SDL_RenderData *rdata = (SDL_RenderData *) renderer->driverdata;
/* Check, if it is not initialized */
if (rdata->surfaces_type==SDL_PHOTON_SURFTYPE_UNKNOWN)
{
SDL_SetError("Photon: can't set draw color for OpenGL ES window");
return -1;
}
switch (rdata->surfaces_type)
{
case SDL_PHOTON_SURFTYPE_OFFSCREEN:
case SDL_PHOTON_SURFTYPE_PHIMAGE:
PgSetFillColorCx(rdata->gc, PgRGB(renderer->r, renderer->g, renderer->b));
PgSetStrokeColorCx(rdata->gc, PgRGB(renderer->r, renderer->g, renderer->b));
break;
case SDL_PHOTON_SURFTYPE_UNKNOWN:
default:
break;
}
return 0;
}
static int static int
photon_renderpoint(SDL_Renderer * renderer, int x, int y) photon_renderpoint(SDL_Renderer * renderer, int x, int y)
{ {
......
...@@ -48,12 +48,6 @@ static int gf_settexturepalette(SDL_Renderer * renderer, ...@@ -48,12 +48,6 @@ static int gf_settexturepalette(SDL_Renderer * renderer,
static int gf_gettexturepalette(SDL_Renderer * renderer, static int gf_gettexturepalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int gf_settexturecolormod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int gf_settexturealphamod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int gf_settexturescalemode(SDL_Renderer * renderer,
SDL_Texture * texture);
static int gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, static int gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -81,8 +75,6 @@ SDL_RenderDriver gf_renderdriver = { ...@@ -81,8 +75,6 @@ SDL_RenderDriver gf_renderdriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD |
SDL_RENDERER_ACCELERATED), SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
13, 13,
{ {
SDL_PIXELFORMAT_INDEX8, SDL_PIXELFORMAT_INDEX8,
...@@ -141,8 +133,6 @@ gf_createrenderer(SDL_Window * window, Uint32 flags) ...@@ -141,8 +133,6 @@ gf_createrenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = gf_querytexturepixels; renderer->QueryTexturePixels = gf_querytexturepixels;
renderer->SetTexturePalette = gf_settexturepalette; renderer->SetTexturePalette = gf_settexturepalette;
renderer->GetTexturePalette = gf_gettexturepalette; renderer->GetTexturePalette = gf_gettexturepalette;
renderer->SetTextureAlphaMod = gf_settexturealphamod;
renderer->SetTextureColorMod = gf_settexturecolormod;
renderer->UpdateTexture = gf_updatetexture; renderer->UpdateTexture = gf_updatetexture;
renderer->LockTexture = gf_locktexture; renderer->LockTexture = gf_locktexture;
renderer->UnlockTexture = gf_unlocktexture; renderer->UnlockTexture = gf_unlocktexture;
...@@ -327,16 +317,6 @@ gf_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -327,16 +317,6 @@ gf_gettexturepalette(SDL_Renderer * renderer, SDL_Texture * texture,
{ {
} }
static int
gf_settexturecolormod(SDL_Renderer * renderer, SDL_Texture * texture)
{
}
static int
gf_settexturealphamod(SDL_Renderer * renderer, SDL_Texture * texture)
{
}
static int static int
gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture, gf_updatetexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
......
...@@ -101,12 +101,6 @@ static int D3D_SetTexturePalette(SDL_Renderer * renderer, ...@@ -101,12 +101,6 @@ static int D3D_SetTexturePalette(SDL_Renderer * renderer,
static int D3D_GetTexturePalette(SDL_Renderer * renderer, static int D3D_GetTexturePalette(SDL_Renderer * renderer,
SDL_Texture * texture, SDL_Color * colors, SDL_Texture * texture, SDL_Color * colors,
int firstcolor, int ncolors); int firstcolor, int ncolors);
static int D3D_SetTextureColorMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int D3D_SetTextureAlphaMod(SDL_Renderer * renderer,
SDL_Texture * texture);
static int D3D_SetTextureBlendMode(SDL_Renderer * renderer,
SDL_Texture * texture);
static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, const SDL_Rect * rect, const void *pixels,
int pitch); int pitch);
...@@ -144,8 +138,6 @@ SDL_RenderDriver D3D_RenderDriver = { ...@@ -144,8 +138,6 @@ SDL_RenderDriver D3D_RenderDriver = {
SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 | SDL_RENDERER_PRESENTFLIP2 | SDL_RENDERER_PRESENTFLIP3 |
SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_PRESENTDISCARD | SDL_RENDERER_PRESENTVSYNC |
SDL_RENDERER_ACCELERATED), SDL_RENDERER_ACCELERATED),
(SDL_TEXTUREMODULATE_NONE | SDL_TEXTUREMODULATE_COLOR |
SDL_TEXTUREMODULATE_ALPHA),
0, 0,
{0}, {0},
0, 0,
...@@ -451,9 +443,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) ...@@ -451,9 +443,6 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->QueryTexturePixels = D3D_QueryTexturePixels; renderer->QueryTexturePixels = D3D_QueryTexturePixels;
renderer->SetTexturePalette = D3D_SetTexturePalette; renderer->SetTexturePalette = D3D_SetTexturePalette;
renderer->GetTexturePalette = D3D_GetTexturePalette; renderer->GetTexturePalette = D3D_GetTexturePalette;
renderer->SetTextureColorMod = D3D_SetTextureColorMod;
renderer->SetTextureAlphaMod = D3D_SetTextureAlphaMod;
renderer->SetTextureBlendMode = D3D_SetTextureBlendMode;
renderer->UpdateTexture = D3D_UpdateTexture; renderer->UpdateTexture = D3D_UpdateTexture;
renderer->LockTexture = D3D_LockTexture; renderer->LockTexture = D3D_LockTexture;
renderer->UnlockTexture = D3D_UnlockTexture; renderer->UnlockTexture = D3D_UnlockTexture;
...@@ -727,18 +716,6 @@ D3D_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture, ...@@ -727,18 +716,6 @@ D3D_GetTexturePalette(SDL_Renderer * renderer, SDL_Texture * texture,
return 0; return 0;
} }
static int
D3D_SetTextureColorMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int
D3D_SetTextureAlphaMod(SDL_Renderer * renderer, SDL_Texture * texture)
{
return 0;
}
static int static int
D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
const SDL_Rect * rect, const void *pixels, int pitch) const SDL_Rect * rect, const void *pixels, int pitch)
......
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