parent
6e810ef559
commit
d7a19c265f
|
@ -39,6 +39,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Glide64", "Source\Glide64\G
|
||||||
{25A25249-C284-4C5A-8DC2-26FC3EB13703} = {25A25249-C284-4C5A-8DC2-26FC3EB13703}
|
{25A25249-C284-4C5A-8DC2-26FC3EB13703} = {25A25249-C284-4C5A-8DC2-26FC3EB13703}
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421}
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421} = {B4A4B994-9111-42B1-93C2-6F1CA8BC4421}
|
||||||
{2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {2DADDAA5-0F57-46ED-A974-747908DDC7F3}
|
{2DADDAA5-0F57-46ED-A974-747908DDC7F3} = {2DADDAA5-0F57-46ED-A974-747908DDC7F3}
|
||||||
|
{81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68} = {81CE8DAF-EBB2-4761-8E45-B71ABCCA8C68}
|
||||||
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D} = {8B9961B1-88D9-4EA3-A752-507A00DD9F3D}
|
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D} = {8B9961B1-88D9-4EA3-A752-507A00DD9F3D}
|
||||||
{427F1DCD-3BED-4010-9322-077A4C06D871} = {427F1DCD-3BED-4010-9322-077A4C06D871}
|
{427F1DCD-3BED-4010-9322-077A4C06D871} = {427F1DCD-3BED-4010-9322-077A4C06D871}
|
||||||
{93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}
|
{93CFEDF3-9A75-4484-B169-D9D8074F5AC2} = {93CFEDF3-9A75-4484-B169-D9D8074F5AC2}
|
||||||
|
|
|
@ -53,6 +53,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
|
AdditionalDependencies="version.lib imm32.lib winmm.lib"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
|
|
@ -451,7 +451,7 @@ SDL_GetPlatform()
|
||||||
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
|
#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL))
|
||||||
/* Need to include DllMain() on Watcom C for some reason.. */
|
/* Need to include DllMain() on Watcom C for some reason.. */
|
||||||
|
|
||||||
BOOL APIENTRY
|
/*BOOL APIENTRY
|
||||||
_DllMainCRTStartup(HANDLE hModule,
|
_DllMainCRTStartup(HANDLE hModule,
|
||||||
DWORD ul_reason_for_call, LPVOID lpReserved)
|
DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||||
{
|
{
|
||||||
|
@ -463,7 +463,7 @@ _DllMainCRTStartup(HANDLE hModule,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}*/
|
||||||
#endif /* building DLL with Watcom C */
|
#endif /* building DLL with Watcom C */
|
||||||
|
|
||||||
#endif /* __WIN32__ */
|
#endif /* __WIN32__ */
|
||||||
|
|
|
@ -240,7 +240,7 @@ int SDL_tolower(int x) { return ((x) >= 'A') && ((x) <= 'Z') ? ('a'+((x)-'A')) :
|
||||||
|
|
||||||
#ifndef __FLTUSED__
|
#ifndef __FLTUSED__
|
||||||
#define __FLTUSED__
|
#define __FLTUSED__
|
||||||
__declspec(selectany) int _fltused = 1;
|
//__declspec(selectany) int _fltused = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The optimizer on Visual Studio 2010/2012 generates memcpy() calls */
|
/* The optimizer on Visual Studio 2010/2012 generates memcpy() calls */
|
||||||
|
@ -334,11 +334,11 @@ localexit:
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
/*void
|
||||||
_ftol2_sse()
|
_ftol2_sse()
|
||||||
{
|
{
|
||||||
_ftol();
|
_ftol();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* 64-bit math operators for 32-bit systems */
|
/* 64-bit math operators for 32-bit systems */
|
||||||
void
|
void
|
||||||
|
|
|
@ -15599,7 +15599,7 @@ void Combine ()
|
||||||
wxUint32 actual_combine, current_combine, color_combine, alpha_combine;
|
wxUint32 actual_combine, current_combine, color_combine, alpha_combine;
|
||||||
int left, right;
|
int left, right;
|
||||||
|
|
||||||
actual_combine = cmb_mode_c;
|
actual_combine = current_combine = cmb_mode_c;
|
||||||
color_combine = actual_combine;
|
color_combine = actual_combine;
|
||||||
if ((rdp.cycle2 & 0xFFFF) == 0x1FFF)
|
if ((rdp.cycle2 & 0xFFFF) == 0x1FFF)
|
||||||
actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF);
|
actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF);
|
||||||
|
@ -16021,12 +16021,14 @@ void ColorCombinerToExtension ()
|
||||||
ext_local = GR_CMBX_ITRGB;
|
ext_local = GR_CMBX_ITRGB;
|
||||||
ext_local_a = GR_CMBX_ITALPHA;
|
ext_local_a = GR_CMBX_ITALPHA;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner locality %u.\n", cmb.c_loc);
|
|
||||||
case GR_COMBINE_LOCAL_CONSTANT:
|
case GR_COMBINE_LOCAL_CONSTANT:
|
||||||
ext_local = GR_CMBX_CONSTANT_COLOR;
|
ext_local = GR_CMBX_CONSTANT_COLOR;
|
||||||
ext_local_a = GR_CMBX_CONSTANT_ALPHA;
|
ext_local_a = GR_CMBX_CONSTANT_ALPHA;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner locality %u.\n", cmb.c_loc);
|
||||||
|
ext_local = GR_CMBX_ZERO;
|
||||||
|
ext_local_a = GR_CMBX_ZERO;
|
||||||
};
|
};
|
||||||
switch (cmb.c_oth)
|
switch (cmb.c_oth)
|
||||||
{
|
{
|
||||||
|
@ -16038,12 +16040,14 @@ void ColorCombinerToExtension ()
|
||||||
ext_other = GR_CMBX_TEXTURE_RGB;
|
ext_other = GR_CMBX_TEXTURE_RGB;
|
||||||
ext_other_a = GR_CMBX_TEXTURE_ALPHA;
|
ext_other_a = GR_CMBX_TEXTURE_ALPHA;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner flag %u.\n", cmb.c_oth);
|
|
||||||
case GR_COMBINE_OTHER_CONSTANT:
|
case GR_COMBINE_OTHER_CONSTANT:
|
||||||
ext_other = GR_CMBX_CONSTANT_COLOR;
|
ext_other = GR_CMBX_CONSTANT_COLOR;
|
||||||
ext_other_a = GR_CMBX_CONSTANT_ALPHA;
|
ext_other_a = GR_CMBX_CONSTANT_ALPHA;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner flag %u.\n", cmb.c_oth);
|
||||||
|
ext_other = GR_CMBX_ZERO;
|
||||||
|
ext_other_a = GR_CMBX_ZERO;
|
||||||
};
|
};
|
||||||
switch (cmb.c_fac)
|
switch (cmb.c_fac)
|
||||||
{
|
{
|
||||||
|
@ -16091,6 +16095,9 @@ void ColorCombinerToExtension ()
|
||||||
cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
|
cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
|
||||||
cmb.c_ext_c_invert = 1;
|
cmb.c_ext_c_invert = 1;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
cmb.c_ext_c = GR_CMBX_ZERO;
|
||||||
|
cmb.c_ext_c_invert = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (cmb.c_fnc)
|
switch (cmb.c_fnc)
|
||||||
|
@ -16182,6 +16189,7 @@ void ColorCombinerToExtension ()
|
||||||
cmb.c_ext_d_invert = 0;
|
cmb.c_ext_d_invert = 0;
|
||||||
break;
|
break;
|
||||||
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
||||||
|
default:
|
||||||
cmb.c_ext_a = GR_CMBX_ZERO;
|
cmb.c_ext_a = GR_CMBX_ZERO;
|
||||||
cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
|
cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
|
||||||
cmb.c_ext_b = ext_local;
|
cmb.c_ext_b = ext_local;
|
||||||
|
@ -16385,12 +16393,15 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
|
||||||
tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
|
tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
|
||||||
tc_ext_c_invert = 1;
|
tc_ext_c_invert = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner TMU factor %u.\n", tmu_fac);
|
|
||||||
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
|
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
|
||||||
tc_ext_c = GR_CMBX_DETAIL_FACTOR;
|
tc_ext_c = GR_CMBX_DETAIL_FACTOR;
|
||||||
tc_ext_c_invert = 1;
|
tc_ext_c_invert = 1;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner TMU factor %u.\n", tmu_fac);
|
||||||
|
tc_ext_c = GR_CMBX_ZERO;
|
||||||
|
tc_ext_c_invert = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tmu_func)
|
switch (tmu_func)
|
||||||
|
@ -16481,8 +16492,6 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
|
||||||
tc_ext_d = GR_CMBX_B;
|
tc_ext_d = GR_CMBX_B;
|
||||||
tc_ext_d_invert = 0;
|
tc_ext_d_invert = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner TMU function %u.\n", tmu_func);
|
|
||||||
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
||||||
tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
|
tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
|
||||||
tc_ext_a_mode = GR_FUNC_MODE_ZERO;
|
tc_ext_a_mode = GR_FUNC_MODE_ZERO;
|
||||||
|
@ -16491,6 +16500,17 @@ void TexColorCombinerToExtension (GrChipID_t tmu)
|
||||||
tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||||
tc_ext_d_invert = 0;
|
tc_ext_d_invert = 0;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner TMU function %u.\n", tmu_func);
|
||||||
|
tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
|
||||||
|
tc_ext_a_mode = GR_FUNC_MODE_ZERO;
|
||||||
|
tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
|
||||||
|
tc_ext_b_mode = GR_FUNC_MODE_ZERO;
|
||||||
|
tc_ext_c = GR_CMBX_ZERO;
|
||||||
|
tc_ext_c_invert = 0;
|
||||||
|
tc_ext_d = GR_CMBX_ZERO;
|
||||||
|
tc_ext_d_invert = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmu == GR_TMU0)
|
if (tmu == GR_TMU0)
|
||||||
|
@ -16566,12 +16586,15 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu)
|
||||||
ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
|
ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
|
||||||
ta_ext_c_invert = 1;
|
ta_ext_c_invert = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner alpha factor %u.\n", tmu_a_fac);
|
|
||||||
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
|
case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
|
||||||
ta_ext_c = GR_CMBX_DETAIL_FACTOR;
|
ta_ext_c = GR_CMBX_DETAIL_FACTOR;
|
||||||
ta_ext_c_invert = 1;
|
ta_ext_c_invert = 1;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner alpha factor %u.\n", tmu_a_fac);
|
||||||
|
ta_ext_c = GR_CMBX_ZERO;
|
||||||
|
ta_ext_c_invert = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tmu_a_func)
|
switch (tmu_a_func)
|
||||||
|
@ -16631,8 +16654,6 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu)
|
||||||
ta_ext_d = GR_CMBX_B;
|
ta_ext_d = GR_CMBX_B;
|
||||||
ta_ext_d_invert = 0;
|
ta_ext_d_invert = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
FRDP_E("Invalid combiner alpha coverage function %u.\n", tmu_a_func);
|
|
||||||
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
|
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
|
||||||
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
|
||||||
ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||||
|
@ -16642,6 +16663,17 @@ void TexAlphaCombinerToExtension (GrChipID_t tmu)
|
||||||
ta_ext_d = GR_CMBX_B;
|
ta_ext_d = GR_CMBX_B;
|
||||||
ta_ext_d_invert = 0;
|
ta_ext_d_invert = 0;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Invalid combiner alpha coverage function %u.\n", tmu_a_func);
|
||||||
|
ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||||
|
ta_ext_a_mode = GR_FUNC_MODE_ZERO;
|
||||||
|
ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
|
||||||
|
ta_ext_b_mode = GR_FUNC_MODE_ZERO;
|
||||||
|
ta_ext_c = GR_CMBX_ZERO;
|
||||||
|
ta_ext_c_invert = 0;
|
||||||
|
ta_ext_d = GR_CMBX_ZERO;
|
||||||
|
ta_ext_d_invert = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmu == GR_TMU0)
|
if (tmu == GR_TMU0)
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories=""$(Root)Source/3rd Party/wx/include";"$(Root)Source/3rd Party/wx/include/msvc";"$(Root)Source/Glitch64/inc";inc"
|
AdditionalIncludeDirectories=""$(Root)Source\3rd Party\sdl\include";"$(Root)Source/3rd Party/wx/include";"$(Root)Source/3rd Party/wx/include/msvc";"$(Root)Source/Glitch64/inc";inc"
|
||||||
PreprocessorDefinitions="__MSC__;RDP_LOGGING;RDP_ERROR_LOG;"
|
PreprocessorDefinitions="__MSC__;RDP_LOGGING;RDP_ERROR_LOG;"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
//
|
//
|
||||||
//****************************************************************
|
//****************************************************************
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
#include "Gfx_1.3.h"
|
#include "Gfx_1.3.h"
|
||||||
#include "TexCache.h"
|
#include "TexCache.h"
|
||||||
#include "Combine.h"
|
#include "Combine.h"
|
||||||
|
@ -518,10 +519,10 @@ void TexCache ()
|
||||||
if (ghq_dmptex_toggle_key) {
|
if (ghq_dmptex_toggle_key) {
|
||||||
DisplayLoadProgress(L"Texture dump - ON\n");
|
DisplayLoadProgress(L"Texture dump - ON\n");
|
||||||
ClearCache();
|
ClearCache();
|
||||||
wxThread::Sleep(1000);
|
SDL_Delay(1000);
|
||||||
} else {
|
} else {
|
||||||
DisplayLoadProgress(L"Texture dump - OFF\n");
|
DisplayLoadProgress(L"Texture dump - OFF\n");
|
||||||
wxThread::Sleep(1000);
|
SDL_Delay(1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,8 +99,6 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
|
||||||
{
|
{
|
||||||
wxUint32 textured, vnum, vsize;
|
wxUint32 textured, vnum, vsize;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
default: /* added to fix uninitialized variable warnings + debugging */
|
|
||||||
FRDP_E("Unknown geometric primitive type %u.\n", type);
|
|
||||||
case 0: //null
|
case 0: //null
|
||||||
textured = vnum = vsize = 0;
|
textured = vnum = vsize = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -124,6 +122,10 @@ static void uc9_draw_object (wxUint8 * addr, wxUint32 type)
|
||||||
vnum = 4;
|
vnum = 4;
|
||||||
vsize = 16;
|
vsize = 16;
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
FRDP_E("Unknown geometric primitive type %u.\n", type);
|
||||||
|
textured = vnum = vsize = 0;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
VERTEX vtx[4];
|
VERTEX vtx[4];
|
||||||
for (wxUint32 i = 0; i < vnum; i++)
|
for (wxUint32 i = 0; i < vnum; i++)
|
||||||
|
@ -255,7 +257,7 @@ static void uc9_fmlight ()
|
||||||
wxUint32 a = -1024 + (rdp.cmd1&0xFFF);
|
wxUint32 a = -1024 + (rdp.cmd1&0xFFF);
|
||||||
FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
|
FRDP ("uc9:fmlight matrix: %d, num: %d, dmem: %04lx\n", mid, rdp.num_lights, a);
|
||||||
|
|
||||||
M44 *m;
|
M44 *m = NULL;
|
||||||
switch (mid) {
|
switch (mid) {
|
||||||
case 4:
|
case 4:
|
||||||
m = (M44*)rdp.model;
|
m = (M44*)rdp.model;
|
||||||
|
@ -388,8 +390,8 @@ static void uc9_mtxtrnsp ()
|
||||||
static void uc9_mtxcat ()
|
static void uc9_mtxcat ()
|
||||||
{
|
{
|
||||||
LRDP("uc9:mtxcat ");
|
LRDP("uc9:mtxcat ");
|
||||||
M44 *s;
|
M44 *s = NULL;
|
||||||
M44 *t;
|
M44 *t = NULL;
|
||||||
wxUint32 S = rdp.cmd0&0xF;
|
wxUint32 S = rdp.cmd0&0xF;
|
||||||
wxUint32 T = (rdp.cmd1>>16)&0xF;
|
wxUint32 T = (rdp.cmd1>>16)&0xF;
|
||||||
wxUint32 D = rdp.cmd1&0xF;
|
wxUint32 D = rdp.cmd1&0xF;
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
AdditionalIncludeDirectories=""$(Root)Source/3rd Party/wx/src""
|
AdditionalIncludeDirectories=""$(Root)Source/3rd Party/wx/include/msvc";"$(Root)Source/3rd Party/wx/include";"$(Root)Source/3rd Party/wx/src""
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -74,70 +74,57 @@ void Texture2x_32(uint8 *srcPtr, uint32 srcPitch, uint8 *dstPtr, uint32 dstPitch
|
||||||
r1 = (pSrc[xSrc]>>16)&0xFF;
|
r1 = (pSrc[xSrc]>>16)&0xFF;
|
||||||
a1 = (pSrc[xSrc]>>24)&0xFF;
|
a1 = (pSrc[xSrc]>>24)&0xFF;
|
||||||
|
|
||||||
if( xSrc<nWidth-1 )
|
|
||||||
{
|
|
||||||
b2 = (pSrc[xSrc+1]>>0)&0xFF;
|
|
||||||
g2 = (pSrc[xSrc+1]>>8)&0xFF;
|
|
||||||
r2 = (pSrc[xSrc+1]>>16)&0xFF;
|
|
||||||
a2 = (pSrc[xSrc+1]>>24)&0xFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ySrc<nHeight-1 )
|
|
||||||
{
|
|
||||||
b3 = (pSrc2[xSrc]>>0)&0xFF;
|
|
||||||
g3 = (pSrc2[xSrc]>>8)&0xFF;
|
|
||||||
r3 = (pSrc2[xSrc]>>16)&0xFF;
|
|
||||||
a3 = (pSrc2[xSrc]>>24)&0xFF;
|
|
||||||
if( xSrc<nWidth-1 )
|
|
||||||
{
|
|
||||||
b4 = (pSrc2[xSrc+1]>>0)&0xFF;
|
|
||||||
g4 = (pSrc2[xSrc+1]>>8)&0xFF;
|
|
||||||
r4 = (pSrc2[xSrc+1]>>16)&0xFF;
|
|
||||||
a4 = (pSrc2[xSrc+1]>>24)&0xFF;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Pixel 1
|
// Pixel 1
|
||||||
pDst1[xSrc*2] = pSrc[xSrc];
|
pDst1[xSrc*2] = pSrc[xSrc];
|
||||||
|
|
||||||
// Pixel 2
|
// Pixel 2
|
||||||
if( xSrc<nWidth-1 )
|
if( xSrc<nWidth-1 )
|
||||||
{
|
{
|
||||||
|
b2 = (pSrc[xSrc+1]>>0)&0xFF;
|
||||||
|
g2 = (pSrc[xSrc+1]>>8)&0xFF;
|
||||||
|
r2 = (pSrc[xSrc+1]>>16)&0xFF;
|
||||||
|
a2 = (pSrc[xSrc+1]>>24)&0xFF;
|
||||||
pDst1[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
|
pDst1[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pDst1[xSrc*2+1] = pSrc[xSrc];
|
pDst1[xSrc*2+1] = pSrc[xSrc];
|
||||||
|
|
||||||
|
|
||||||
// Pixel 3
|
// Pixel 3
|
||||||
if( ySrc<nHeight-1 )
|
if( ySrc<nHeight-1 )
|
||||||
{
|
{
|
||||||
|
b3 = (pSrc2[xSrc]>>0)&0xFF;
|
||||||
|
g3 = (pSrc2[xSrc]>>8)&0xFF;
|
||||||
|
r3 = (pSrc2[xSrc]>>16)&0xFF;
|
||||||
|
a3 = (pSrc2[xSrc]>>24)&0xFF;
|
||||||
pDst2[xSrc*2] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
|
pDst2[xSrc*2] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
|
||||||
}
|
if( xSrc<nWidth-1 )
|
||||||
else
|
|
||||||
pDst2[xSrc*2] = pSrc[xSrc];
|
|
||||||
|
|
||||||
// Pixel 4
|
|
||||||
if( xSrc<nWidth-1 )
|
|
||||||
{
|
|
||||||
if( ySrc<nHeight-1 )
|
|
||||||
{
|
{
|
||||||
|
b4 = (pSrc2[xSrc+1]>>0)&0xFF;
|
||||||
|
g4 = (pSrc2[xSrc+1]>>8)&0xFF;
|
||||||
|
r4 = (pSrc2[xSrc+1]>>16)&0xFF;
|
||||||
|
a4 = (pSrc2[xSrc+1]>>24)&0xFF;
|
||||||
|
// Pixel 4
|
||||||
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2+r3+r4)/4, (g1+g2+g3+g4)/4, (b1+b2+b3+b4)/4, (a1+a2+a3+a4)/4);
|
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2+r3+r4)/4, (g1+g2+g3+g4)/4, (b1+b2+b3+b4)/4, (a1+a2+a3+a4)/4);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
|
// Pixel 4
|
||||||
|
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( ySrc<nHeight-1 )
|
// Pixel 3
|
||||||
|
pDst2[xSrc*2] = pSrc[xSrc];
|
||||||
|
// Pixel 4
|
||||||
|
if( xSrc<nWidth-1 )
|
||||||
{
|
{
|
||||||
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r3)/2, (g1+g3)/2, (b1+b3)/2, (a1+a3)/2);
|
pDst2[xSrc*2+1] = DWORD_MAKE((r1+r2)/2, (g1+g2)/2, (b1+b2)/2, (a1+a2)/2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
pDst2[xSrc*2+1] = pSrc[xSrc];
|
pDst2[xSrc*2+1] = pSrc[xSrc];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue