Commit 277040d9 authored by Alexandre Julliard's avatar Alexandre Julliard

d3dx9: Fix some incorrect const typecasts.

parent 1905e93b
...@@ -529,13 +529,11 @@ static void make_argb_color(CONST struct argb_conversion_info *info, CONST DWORD ...@@ -529,13 +529,11 @@ static void make_argb_color(CONST struct argb_conversion_info *info, CONST DWORD
* Works only for ARGB formats with 1 - 4 bytes per pixel. * Works only for ARGB formats with 1 - 4 bytes per pixel.
*/ */
static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, CONST PixelFormatDesc *srcformat, static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, CONST PixelFormatDesc *srcformat,
CONST BYTE *dest, UINT destpitch, POINT destsize, CONST PixelFormatDesc *destformat) BYTE *dest, UINT destpitch, POINT destsize, CONST PixelFormatDesc *destformat)
{ {
struct argb_conversion_info conv_info; struct argb_conversion_info conv_info;
DWORD channels[4]; DWORD channels[4];
UINT minwidth, minheight; UINT minwidth, minheight;
BYTE *srcptr, *destptr;
UINT x, y; UINT x, y;
ZeroMemory(channels, sizeof(channels)); ZeroMemory(channels, sizeof(channels));
...@@ -545,11 +543,11 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, C ...@@ -545,11 +543,11 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, C
minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y; minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y;
for(y = 0;y < minheight;y++) { for(y = 0;y < minheight;y++) {
srcptr = (BYTE*)( src + y * srcpitch); const BYTE *srcptr = src + y * srcpitch;
destptr = (BYTE*)(dest + y * destpitch); BYTE *destptr = dest + y * destpitch;
for(x = 0;x < minwidth;x++) { for(x = 0;x < minwidth;x++) {
/* extract source color components */ /* extract source color components */
if(srcformat->type == FORMAT_ARGB) get_relevant_argb_components(&conv_info, *(DWORD*)srcptr, channels); if(srcformat->type == FORMAT_ARGB) get_relevant_argb_components(&conv_info, *(const DWORD*)srcptr, channels);
/* recombine the components */ /* recombine the components */
if(destformat->type == FORMAT_ARGB) make_argb_color(&conv_info, channels, (DWORD*)destptr); if(destformat->type == FORMAT_ARGB) make_argb_color(&conv_info, channels, (DWORD*)destptr);
...@@ -570,13 +568,12 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, C ...@@ -570,13 +568,12 @@ static void copy_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, C
* Works only for ARGB formats with 1 - 4 bytes per pixel. * Works only for ARGB formats with 1 - 4 bytes per pixel.
*/ */
static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, CONST PixelFormatDesc *srcformat, static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT srcsize, CONST PixelFormatDesc *srcformat,
CONST BYTE *dest, UINT destpitch, POINT destsize, CONST PixelFormatDesc *destformat) BYTE *dest, UINT destpitch, POINT destsize, CONST PixelFormatDesc *destformat)
{ {
struct argb_conversion_info conv_info; struct argb_conversion_info conv_info;
DWORD channels[4]; DWORD channels[4];
UINT minwidth, minheight; UINT minwidth, minheight;
BYTE *srcptr, *destptr, *bufptr;
UINT x, y; UINT x, y;
ZeroMemory(channels, sizeof(channels)); ZeroMemory(channels, sizeof(channels));
...@@ -586,13 +583,13 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT sr ...@@ -586,13 +583,13 @@ static void point_filter_simple_data(CONST BYTE *src, UINT srcpitch, POINT sr
minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y; minheight = (srcsize.y < destsize.y) ? srcsize.y : destsize.y;
for(y = 0;y < destsize.y;y++) { for(y = 0;y < destsize.y;y++) {
destptr = (BYTE*)dest + y * destpitch; BYTE *destptr = dest + y * destpitch;
bufptr = (BYTE*)src + srcpitch * (y * srcsize.y / destsize.y); const BYTE *bufptr = src + srcpitch * (y * srcsize.y / destsize.y);
srcptr = bufptr; const BYTE *srcptr = bufptr;
for(x = 0;x < destsize.x;x++) { for(x = 0;x < destsize.x;x++) {
/* extract source color components */ /* extract source color components */
if(srcformat->type == FORMAT_ARGB) get_relevant_argb_components(&conv_info, *(DWORD*)srcptr, channels); if(srcformat->type == FORMAT_ARGB) get_relevant_argb_components(&conv_info, *(const DWORD*)srcptr, channels);
/* recombine the components */ /* recombine the components */
if(destformat->type == FORMAT_ARGB) make_argb_color(&conv_info, channels, (DWORD*)destptr); if(destformat->type == FORMAT_ARGB) make_argb_color(&conv_info, channels, (DWORD*)destptr);
...@@ -685,12 +682,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface, ...@@ -685,12 +682,12 @@ HRESULT WINAPI D3DXLoadSurfaceFromMemory(LPDIRECT3DSURFACE9 pDestSurface,
if(FAILED(hr)) return D3DXERR_INVALIDDATA; if(FAILED(hr)) return D3DXERR_INVALIDDATA;
if((dwFilter & 0xF) == D3DX_FILTER_NONE) { if((dwFilter & 0xF) == D3DX_FILTER_NONE) {
copy_simple_data((CONST BYTE*)pSrcMemory, SrcPitch, srcsize, srcformatdesc, copy_simple_data(pSrcMemory, SrcPitch, srcsize, srcformatdesc,
(CONST BYTE*)lockrect.pBits, lockrect.Pitch, destsize, destformatdesc); lockrect.pBits, lockrect.Pitch, destsize, destformatdesc);
} else /*if((dwFilter & 0xF) == D3DX_FILTER_POINT) */ { } else /*if((dwFilter & 0xF) == D3DX_FILTER_POINT) */ {
/* always apply a point filter until D3DX_FILTER_LINEAR, D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented */ /* always apply a point filter until D3DX_FILTER_LINEAR, D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented */
point_filter_simple_data((CONST BYTE*)pSrcMemory, SrcPitch, srcsize, srcformatdesc, point_filter_simple_data(pSrcMemory, SrcPitch, srcsize, srcformatdesc,
(CONST BYTE*)lockrect.pBits, lockrect.Pitch, destsize, destformatdesc); lockrect.pBits, lockrect.Pitch, destsize, destformatdesc);
} }
IDirect3DSurface9_UnlockRect(pDestSurface); IDirect3DSurface9_UnlockRect(pDestSurface);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment