Module: wine
Branch: master
Commit: 1feb1c052b531557cb33ea1de8ec848fb28dd690
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1feb1c052b531557cb33ea1de…
Author: David Adam <David.Adam(a)math.cnrs.fr>
Date: Fri Oct 5 20:03:41 2007 +0200
include: Skeleton header for D3DX8.
---
include/Makefile.in | 2 +
include/d3dx8.h | 28 ++++++++++++++++++++++
include/d3dx8math.h | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 94 insertions(+), 0 deletions(-)
diff --git a/include/Makefile.in b/include/Makefile.in
index 60b916a..de8b86a 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -104,7 +104,9 @@ SRCDIR_INCLUDES = \
d3drmdef.h \
d3dtypes.h \
d3dvec.inl \
+ d3dx8.h \
d3dx8core.h \
+ d3dx8math.h \
dbghelp.h \
dbinit.idl \
dbprop.idl \
diff --git a/include/d3dx8.h b/include/d3dx8.h
new file mode 100644
index 0000000..52ddaf3
--- /dev/null
+++ b/include/d3dx8.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2007 David Adam
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __D3DX8_H__
+#define __D3DX8_H__
+
+#include <d3d8.h>
+#include <limits.h>
+
+#include <d3dx8math.h>
+#include <d3dx8core.h>
+
+#endif
diff --git a/include/d3dx8math.h b/include/d3dx8math.h
new file mode 100644
index 0000000..452eb05
--- /dev/null
+++ b/include/d3dx8math.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2007 David Adam
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <d3dx8.h>
+
+#ifndef __D3DX8MATH_H__
+#define __D3DX8MATH_H__
+
+#include <math.h>
+
+#define D3DX_PI ((FLOAT)3.141592654)
+#define D3DX_1BYPI ((FLOAT)0.318309886)
+
+#define D3DXToRadian(degree) ((degree) * (D3DX_PI / 180.0f))
+#define D3DXToDegree(radian) ((radian) * (180.0f / D3DX_PI))
+
+typedef struct D3DXVECTOR2
+{
+ FLOAT x, y;
+} D3DXVECTOR2, *LPD3DXVECTOR2;
+
+typedef struct D3DXVECTOR3
+{
+ FLOAT x, y, z;
+} D3DXVECTOR3, *LPD3DXVECTOR3;
+
+typedef struct D3DXVECTOR4
+{
+ FLOAT x, y, z, w;
+} D3DXVECTOR4, *LPD3DXVECTOR4;
+
+typedef struct _D3DMATRIX D3DXMATRIX, *LPD3DXMATRIX;
+
+typedef struct D3DXQUATERNION
+{
+ FLOAT x, y, z, w;
+} D3DXQUATERNION, *LPD3DXQUATERNION;
+
+typedef struct D3DXPLANE
+{
+ FLOAT a, b, c, d;
+} D3DXPLANE, *LPD3DXPLANE;
+
+typedef struct D3DXCOLOR
+{
+ FLOAT r, g, b, a;
+} D3DXCOLOR, *LPD3DXCOLOR;
+
+#endif /* __D3DX8MATH_H__ */
Module: wine
Branch: master
Commit: 8e64d870b15d93b7c9b3595e93480f9f0778a8fe
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e64d870b15d93b7c9b3595e9…
Author: Roderick Colenbrander <thunderbird2k(a)gmx.net>
Date: Mon Oct 8 22:11:06 2007 +0200
wined3d: Merge p8 palette initialization code.
---
dlls/wined3d/surface.c | 67 +++++++++++------------------------------------
1 files changed, 16 insertions(+), 51 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index ee086e3..938df0d 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UINT height, UINT outpitch, CONVERT_TYPES convert, IWineD3DSurfaceImpl *surf);
+static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE (*table)[4], BOOL colorkey);
static void surface_download_data(IWineD3DSurfaceImpl *This) {
if (!(This->resource.allocatedMemory || This->Flags & SFLAG_PBO)) This->resource.allocatedMemory = HeapAlloc(GetProcessHeap(), 0, This->resource.size + 4);
@@ -1589,54 +1590,13 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
{
IWineD3DPaletteImpl* pal = This->palette;
BYTE table[256][4];
- unsigned int i;
unsigned int x, y;
if( pal == NULL) {
/* TODO: If we are a sublevel, try to get the palette from level 0 */
}
- if (pal == NULL) {
- /* Still no palette? Use the device's palette */
- /* Get the surface's palette */
- for (i = 0; i < 256; i++) {
- IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
-
- table[i][0] = device->palettes[device->currentPalette][i].peRed;
- table[i][1] = device->palettes[device->currentPalette][i].peGreen;
- table[i][2] = device->palettes[device->currentPalette][i].peBlue;
- if ((convert == CONVERT_PALETTED_CK) &&
- (i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
- (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
- /* We should maybe here put a more 'neutral' color than the standard bright purple
- one often used by application to prevent the nice purple borders when bi-linear
- filtering is on */
- table[i][3] = 0x00;
- } else {
- table[i][3] = 0xFF;
- }
- }
- } else {
- TRACE("Using surface palette %p\n", pal);
- /* Get the surface's palette */
- for (i = 0; i < 256; i++) {
- table[i][0] = pal->palents[i].peRed;
- table[i][1] = pal->palents[i].peGreen;
- table[i][2] = pal->palents[i].peBlue;
- if ((convert == CONVERT_PALETTED_CK) &&
- (i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
- (i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
- /* We should maybe here put a more 'neutral' color than the standard bright purple
- one often used by application to prevent the nice purple borders when bi-linear
- filtering is on */
- table[i][3] = 0x00;
- } else if(pal->Flags & WINEDDPCAPS_ALPHA) {
- table[i][3] = pal->palents[i].peFlags;
- } else {
- table[i][3] = 0xFF;
- }
- }
- }
+ d3dfmt_p8_init_palette(This, table, (convert == CONVERT_PALETTED_CK));
for (y = 0; y < height; y++)
{
@@ -1930,14 +1890,8 @@ HRESULT d3dfmt_convert_surface(BYTE *src, BYTE *dst, UINT pitch, UINT width, UIN
return WINED3D_OK;
}
-/* This function is used in case of 8bit paletted textures to upload the palette.
- For now it only supports GL_EXT_paletted_texture extension but support for other
- extensions like ARB_fragment_program and ATI_fragment_shaders will be added as well.
-*/
-static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES convert) {
- IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
+static void d3dfmt_p8_init_palette(IWineD3DSurfaceImpl *This, BYTE (*table)[4], BOOL colorkey) {
IWineD3DPaletteImpl* pal = This->palette;
- BYTE table[256][4];
int i;
if (pal == NULL) {
@@ -1949,7 +1903,7 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
table[i][0] = device->palettes[device->currentPalette][i].peRed;
table[i][1] = device->palettes[device->currentPalette][i].peGreen;
table[i][2] = device->palettes[device->currentPalette][i].peBlue;
- if ((convert == CONVERT_PALETTED_CK) &&
+ if (colorkey &&
(i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
(i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
/* We should maybe here put a more 'neutral' color than the standard bright purple
@@ -1967,7 +1921,7 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
table[i][0] = pal->palents[i].peRed;
table[i][1] = pal->palents[i].peGreen;
table[i][2] = pal->palents[i].peBlue;
- if ((convert == CONVERT_PALETTED_CK) &&
+ if (colorkey &&
(i >= This->SrcBltCKey.dwColorSpaceLowValue) &&
(i <= This->SrcBltCKey.dwColorSpaceHighValue)) {
/* We should maybe here put a more 'neutral' color than the standard bright purple
@@ -1981,6 +1935,17 @@ static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES conve
}
}
}
+}
+
+/* This function is used in case of 8bit paletted textures to upload the palette.
+ For now it only supports GL_EXT_paletted_texture extension but support for other
+ extensions like ARB_fragment_program and ATI_fragment_shaders will be added as well.
+*/
+static void d3dfmt_p8_upload_palette(IWineD3DSurface *iface, CONVERT_TYPES convert) {
+ IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
+ BYTE table[256][4];
+
+ d3dfmt_p8_init_palette(This, table, (convert == CONVERT_PALETTED_CK));
GL_EXTCALL(glColorTableEXT(GL_TEXTURE_2D,GL_RGBA,256,GL_RGBA,GL_UNSIGNED_BYTE, table));
}