Mercurial > sdl-ios-xcode
changeset 2927:2133d2d300fd
SetDrawColor() and SetDrawBlendMode() are optional
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 30 Dec 2008 07:14:11 +0000 |
parents | 27f2b5e7e899 |
children | e171ce9bdbad |
files | src/video/SDL_renderer_gl.c src/video/SDL_renderer_sw.c src/video/SDL_video.c src/video/directfb/SDL_DirectFB_render.c src/video/dummy/SDL_nullrender.c src/video/win32/SDL_gdirender.c src/video/x11/SDL_x11render.c |
diffstat | 7 files changed, 25 insertions(+), 89 deletions(-) [+] |
line wrap: on
line diff
--- a/src/video/SDL_renderer_gl.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/SDL_renderer_gl.c Tue Dec 30 07:14:11 2008 +0000 @@ -96,8 +96,6 @@ 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 @@ 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; @@ -1071,18 +1067,6 @@ } 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) { GL_RenderData *data = (GL_RenderData *) renderer->driverdata;
--- a/src/video/SDL_renderer_sw.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/SDL_renderer_sw.c Tue Dec 30 07:14:11 2008 +0000 @@ -59,8 +59,6 @@ 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 @@ 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; @@ -529,18 +525,6 @@ } 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) { SW_RenderData *data = (SW_RenderData *) renderer->driverdata;
--- a/src/video/SDL_video.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/SDL_video.c Tue Dec 30 07:14:11 2008 +0000 @@ -1987,16 +1987,15 @@ 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 @@ if (!renderer) { return -1; } - if (!renderer->SetDrawColor) { - SDL_Unsupported(); - return -1; - } if (r) { *r = renderer->r; } @@ -2028,7 +2023,6 @@ if (a) { *a = renderer->a; } - return 0; } int @@ -2044,13 +2038,12 @@ if (!renderer) { return -1; } - if (!renderer->SetDrawBlendMode) { - SDL_Unsupported(); - return -1; + renderer->blendMode = blendMode; + if (renderer->SetDrawBlendMode) { + return renderer->SetDrawBlendMode(renderer); + } else { + return 0; } - renderer->blendMode = blendMode; - renderer->SetDrawBlendMode(renderer); - return 0; } int
--- a/src/video/directfb/SDL_DirectFB_render.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/directfb/SDL_DirectFB_render.c Tue Dec 30 07:14:11 2008 +0000 @@ -71,8 +71,6 @@ 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 @@ 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; @@ -798,18 +794,6 @@ } static int -DirectFB_SetDrawColor(SDL_Renderer * renderer) -{ - return 0; -} - -static int -DirectFB_SetDrawBlendMode(SDL_Renderer * renderer) -{ - return 0; -} - -static int PrepareDraw(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata;
--- a/src/video/dummy/SDL_nullrender.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/dummy/SDL_nullrender.c Tue Dec 30 07:14:11 2008 +0000 @@ -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_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; @@ -133,18 +129,6 @@ } 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) { SDL_DUMMY_RenderData *data =
--- a/src/video/win32/SDL_gdirender.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/win32/SDL_gdirender.c Tue Dec 30 07:14:11 2008 +0000 @@ -55,6 +55,7 @@ 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 @@ 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; @@ -574,6 +576,19 @@ } 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) { GDI_RenderData *data = (GDI_RenderData *) renderer->driverdata;
--- a/src/video/x11/SDL_x11render.c Tue Dec 30 04:38:39 2008 +0000 +++ b/src/video/x11/SDL_x11render.c Tue Dec 30 07:14:11 2008 +0000 @@ -47,7 +47,6 @@ 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 @@ 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; @@ -564,12 +562,6 @@ } static int -X11_SetDrawColor(SDL_Renderer * renderer) -{ - return 0; -} - -static int X11_SetDrawBlendMode(SDL_Renderer * renderer) { switch (renderer->blendMode) {