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

Making the API simpler, the blend modes are "none, blend, add" and ar…

…e supported by all renderers.
  • Loading branch information
slouken committed Feb 1, 2011
1 parent 30fa16e commit a8fe50154f6f1a303f6fb327fedb2d1cd31eb999
@@ -43,12 +43,8 @@ extern "C" {
typedef enum
{
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_BLEND = 0x00000001, /**< dst = (src * A) + (dst * (1-A)) */
SDL_BLENDMODE_ADD = 0x00000002, /**< dst = (src * A) + dst */
} SDL_BlendMode;

/* Ends C function definitions when using C++ */
@@ -187,7 +187,6 @@ typedef struct SDL_RendererInfo
const char *name; /**< The name of the renderer */
Uint32 flags; /**< Supported ::SDL_RendererFlags */
Uint32 mod_modes; /**< A mask of supported channel modulation */
Uint32 blend_modes; /**< A mask of supported blend modes */
Uint32 num_texture_formats; /**< The number of available texture formats */
Uint32 texture_formats[50]; /**< The available texture formats */
int max_texture_width; /**< The maximimum texture width */
@@ -1423,7 +1423,7 @@ SDL_RLESurface(SDL_Surface * surface)
/* Pass on combinations not supported */
if ((flags & SDL_COPY_MODULATE_COLOR) ||
((flags & SDL_COPY_MODULATE_ALPHA) && surface->format->Amask) ||
(flags & (SDL_COPY_ADD | SDL_COPY_MOD)) ||
(flags & SDL_COPY_ADD) ||
(flags & SDL_COPY_NEAREST)) {
return -1;
}
@@ -37,9 +37,6 @@ SDL_BlendFillRect_RGB555(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB555);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB555);
break;
default:
FILLRECT(Uint16, DRAW_SETPIXEL_RGB555);
break;
@@ -60,9 +57,6 @@ SDL_BlendFillRect_RGB565(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB565);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB565);
break;
default:
FILLRECT(Uint16, DRAW_SETPIXEL_RGB565);
break;
@@ -83,9 +77,6 @@ SDL_BlendFillRect_RGB888(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB888);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB888);
break;
default:
FILLRECT(Uint32, DRAW_SETPIXEL_RGB888);
break;
@@ -106,9 +97,6 @@ SDL_BlendFillRect_ARGB8888(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_ARGB8888);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_ARGB8888);
break;
default:
FILLRECT(Uint32, DRAW_SETPIXEL_ARGB8888);
break;
@@ -132,9 +120,6 @@ SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint16, DRAW_SETPIXEL_ADD_RGB);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint16, DRAW_SETPIXEL_MOD_RGB);
break;
default:
FILLRECT(Uint16, DRAW_SETPIXEL_RGB);
break;
@@ -148,9 +133,6 @@ SDL_BlendFillRect_RGB(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGB);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGB);
break;
default:
FILLRECT(Uint32, DRAW_SETPIXEL_RGB);
break;
@@ -178,9 +160,6 @@ SDL_BlendFillRect_RGBA(SDL_Surface * dst, const SDL_Rect * rect,
case SDL_BLENDMODE_ADD:
FILLRECT(Uint32, DRAW_SETPIXEL_ADD_RGBA);
break;
case SDL_BLENDMODE_MOD:
FILLRECT(Uint32, DRAW_SETPIXEL_MOD_RGBA);
break;
default:
FILLRECT(Uint32, DRAW_SETPIXEL_RGBA);
break;
@@ -53,9 +53,6 @@ SDL_BlendLine_RGB2(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
HLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -68,9 +65,6 @@ SDL_BlendLine_RGB2(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
VLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -83,9 +77,6 @@ SDL_BlendLine_RGB2(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
DLINE(Uint16, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -102,11 +93,6 @@ SDL_BlendLine_RGB2(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY2_ADD_RGB, DRAW_SETPIXELXY2_ADD_RGB,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY2_MOD_RGB, DRAW_SETPIXELXY2_MOD_RGB,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY2_RGB, DRAW_SETPIXELXY2_BLEND_RGB,
@@ -145,9 +131,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
break;
default:
HLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
break;
@@ -160,9 +143,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
break;
default:
VLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
break;
@@ -175,9 +155,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB555, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB555, draw_end);
break;
default:
DLINE(Uint16, DRAW_SETPIXEL_RGB555, draw_end);
break;
@@ -194,11 +171,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY_ADD_RGB555, DRAW_SETPIXELXY_ADD_RGB555,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_MOD_RGB555, DRAW_SETPIXELXY_MOD_RGB555,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_RGB555, DRAW_SETPIXELXY_BLEND_RGB555,
@@ -237,9 +209,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
break;
default:
HLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
break;
@@ -252,9 +221,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
break;
default:
VLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
break;
@@ -267,9 +233,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint16, DRAW_SETPIXEL_ADD_RGB565, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint16, DRAW_SETPIXEL_MOD_RGB565, draw_end);
break;
default:
DLINE(Uint16, DRAW_SETPIXEL_RGB565, draw_end);
break;
@@ -286,11 +249,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY_ADD_RGB565, DRAW_SETPIXELXY_ADD_RGB565,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_MOD_RGB565, DRAW_SETPIXELXY_MOD_RGB565,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_RGB565, DRAW_SETPIXELXY_BLEND_RGB565,
@@ -329,9 +287,6 @@ SDL_BlendLine_RGB4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
HLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -344,9 +299,6 @@ SDL_BlendLine_RGB4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
VLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -359,9 +311,6 @@ SDL_BlendLine_RGB4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint32, DRAW_SETPIXEL_ADD_RGB, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint32, DRAW_SETPIXEL_MOD_RGB, draw_end);
break;
default:
DLINE(Uint32, DRAW_SETPIXEL_RGB, draw_end);
break;
@@ -378,11 +327,6 @@ SDL_BlendLine_RGB4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY4_ADD_RGB, DRAW_SETPIXELXY4_ADD_RGB,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY4_MOD_RGB, DRAW_SETPIXELXY4_MOD_RGB,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY4_RGB, DRAW_SETPIXELXY4_BLEND_RGB,
@@ -421,9 +365,6 @@ SDL_BlendLine_RGBA4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
break;
default:
HLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
break;
@@ -436,9 +377,6 @@ SDL_BlendLine_RGBA4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
break;
default:
VLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
break;
@@ -451,9 +389,6 @@ SDL_BlendLine_RGBA4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint32, DRAW_SETPIXEL_ADD_RGBA, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint32, DRAW_SETPIXEL_MOD_RGBA, draw_end);
break;
default:
DLINE(Uint32, DRAW_SETPIXEL_RGBA, draw_end);
break;
@@ -470,11 +405,6 @@ SDL_BlendLine_RGBA4(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY4_ADD_RGBA, DRAW_SETPIXELXY4_ADD_RGBA,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY4_MOD_RGBA, DRAW_SETPIXELXY4_MOD_RGBA,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY4_RGBA, DRAW_SETPIXELXY4_BLEND_RGBA,
@@ -513,9 +443,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
break;
default:
HLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
break;
@@ -528,9 +455,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
break;
default:
VLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
break;
@@ -543,9 +467,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint32, DRAW_SETPIXEL_ADD_RGB888, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint32, DRAW_SETPIXEL_MOD_RGB888, draw_end);
break;
default:
DLINE(Uint32, DRAW_SETPIXEL_RGB888, draw_end);
break;
@@ -562,11 +483,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY_ADD_RGB888, DRAW_SETPIXELXY_ADD_RGB888,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_MOD_RGB888, DRAW_SETPIXELXY_MOD_RGB888,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_RGB888, DRAW_SETPIXELXY_BLEND_RGB888,
@@ -605,9 +521,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
HLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
break;
case SDL_BLENDMODE_MOD:
HLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
break;
default:
HLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
break;
@@ -620,9 +533,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
VLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
break;
case SDL_BLENDMODE_MOD:
VLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
break;
default:
VLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
break;
@@ -635,9 +545,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
case SDL_BLENDMODE_ADD:
DLINE(Uint32, DRAW_SETPIXEL_ADD_ARGB8888, draw_end);
break;
case SDL_BLENDMODE_MOD:
DLINE(Uint32, DRAW_SETPIXEL_MOD_ARGB8888, draw_end);
break;
default:
DLINE(Uint32, DRAW_SETPIXEL_ARGB8888, draw_end);
break;
@@ -654,11 +561,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
DRAW_SETPIXELXY_ADD_ARGB8888, DRAW_SETPIXELXY_ADD_ARGB8888,
draw_end);
break;
case SDL_BLENDMODE_MOD:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_MOD_ARGB8888, DRAW_SETPIXELXY_MOD_ARGB8888,
draw_end);
break;
default:
AALINE(x1, y1, x2, y2,
DRAW_SETPIXELXY_ARGB8888, DRAW_SETPIXELXY_BLEND_ARGB8888,

0 comments on commit a8fe501

Please sign in to comment.