Mercurial > sdl-ios-xcode
diff src/video/SDL_surface.c @ 2884:9dde605c7540
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.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 20 Dec 2008 12:00:00 +0000 |
parents | 99210400e8b9 |
children | 8f4ed5ec2b06 |
line wrap: on
line diff
--- a/src/video/SDL_surface.c Sat Dec 20 08:41:05 2008 +0000 +++ b/src/video/SDL_surface.c Sat Dec 20 12:00:00 2008 +0000 @@ -140,7 +140,7 @@ /* 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_UnlockSurface(surface); SDL_SetColorKey(surface, 0, 0); - SDL_SetSurfaceBlendMode(surface, SDL_TEXTUREBLENDMODE_BLEND); + SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_BLEND); } int @@ -434,18 +434,18 @@ 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 @@ 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 @@ * 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);