src/video/win32/SDL_d3drender.c
changeset 1916 c773b0c0ac89
parent 1913 83420da906a5
child 1917 3f54b3ec5a07
--- a/src/video/win32/SDL_d3drender.c	Wed Jul 19 04:24:41 2006 +0000
+++ b/src/video/win32/SDL_d3drender.c	Wed Jul 19 05:03:21 2006 +0000
@@ -359,12 +359,6 @@
     IDirect3DDevice9_SetRenderState(data->device, D3DRS_CULLMODE,
                                     D3DCULL_NONE);
     IDirect3DDevice9_SetRenderState(data->device, D3DRS_LIGHTING, FALSE);
-    IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
-                                    TRUE);
-    IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
-                                    D3DBLEND_SRCALPHA);
-    IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
-                                    D3DBLEND_INVSRCALPHA);
 
     return renderer;
 }
@@ -627,6 +621,38 @@
     vertices[3].u = minu;
     vertices[3].v = maxv;
 
+    switch (blendMode) {
+    case SDL_TextureBlendMode_None:
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
+                                        FALSE);
+        break;
+    case SDL_TextureBlendMode_Mask:
+    case SDL_TextureBlendMode_Blend:
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
+                                        TRUE);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
+                                        D3DBLEND_SRCALPHA);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
+                                        D3DBLEND_INVSRCALPHA);
+        break;
+    case SDL_TextureBlendMode_Add:
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
+                                        TRUE);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
+                                        D3DBLEND_SRCALPHA);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
+                                        D3DBLEND_ONE);
+        break;
+    case SDL_TextureBlendMode_Mod:
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE,
+                                        TRUE);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND,
+                                        D3DBLEND_ZERO);
+        IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND,
+                                        D3DBLEND_SRCCOLOR);
+        break;
+    }
+
     result =
         IDirect3DDevice9_SetTexture(data->device, 0,
                                     (IDirect3DBaseTexture9 *) texturedata->