summaryrefslogtreecommitdiff
path: root/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2013-04-13 23:54:02 -0400
committerLioncash <mathew1800@gmail.com>2013-04-13 23:54:02 -0400
commit7ab0cca6455830a838b1b1e38e2c3f265e4e5d0b (patch)
treec0e29f86306e35d624cf60bfbeb3b9a1a200d4a1 /Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp
parent48927c17d252223ffdaa5cfb34aa850eb6ee6ee1 (diff)
Clean up most (99.99%) of the tab/space mismatches in the VideoSoftware project.
Got rid of trailing spaces that were unnecessary too. Also update the license header for this project. We don't use SVN anymore.
Diffstat (limited to 'Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp')
-rw-r--r--Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp
index 56101dc69d..322c09f8db 100644
--- a/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp
+++ b/Source/Plugins/Plugin_VideoSoftware/Src/TextureSampler.cpp
@@ -11,7 +11,7 @@
// A copy of the GPL 2.0 should have been included with the program.
// If not, see http://www.gnu.org/licenses/
-// Official SVN repository and contact information can be found at
+// Official Git repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/
@@ -30,51 +30,51 @@ namespace TextureSampler
inline void WrapCoord(int &coord, int wrapMode, int imageSize)
{
- switch (wrapMode)
- {
- case 0: // clamp
- coord = (coord>imageSize)?imageSize:(coord<0)?0:coord;
- break;
- case 1: // wrap
- coord = coord % (imageSize + 1);
- coord = (coord<0)?imageSize+coord:coord;
- break;
- case 2: // mirror
- {
- int sizePlus1 = imageSize + 1;
- int div = coord / sizePlus1;
- coord = coord - (div * sizePlus1);
- coord = (coord<0)?-coord:coord;
- coord = (div&1)?imageSize - coord:coord;
- }
- break;
- }
+ switch (wrapMode)
+ {
+ case 0: // clamp
+ coord = (coord>imageSize)?imageSize:(coord<0)?0:coord;
+ break;
+ case 1: // wrap
+ coord = coord % (imageSize + 1);
+ coord = (coord<0)?imageSize+coord:coord;
+ break;
+ case 2: // mirror
+ {
+ int sizePlus1 = imageSize + 1;
+ int div = coord / sizePlus1;
+ coord = coord - (div * sizePlus1);
+ coord = (coord<0)?-coord:coord;
+ coord = (div&1)?imageSize - coord:coord;
+ }
+ break;
+ }
}
inline void SetTexel(u8 *inTexel, u32 *outTexel, u32 fract)
{
- outTexel[0] = inTexel[0] * fract;
- outTexel[1] = inTexel[1] * fract;
- outTexel[2] = inTexel[2] * fract;
- outTexel[3] = inTexel[3] * fract;
+ outTexel[0] = inTexel[0] * fract;
+ outTexel[1] = inTexel[1] * fract;
+ outTexel[2] = inTexel[2] * fract;
+ outTexel[3] = inTexel[3] * fract;
}
inline void AddTexel(u8 *inTexel, u32 *outTexel, u32 fract)
{
- outTexel[0] += inTexel[0] * fract;
- outTexel[1] += inTexel[1] * fract;
- outTexel[2] += inTexel[2] * fract;
- outTexel[3] += inTexel[3] * fract;
+ outTexel[0] += inTexel[0] * fract;
+ outTexel[1] += inTexel[1] * fract;
+ outTexel[2] += inTexel[2] * fract;
+ outTexel[3] += inTexel[3] * fract;
}
void Sample(s32 s, s32 t, s32 lod, bool linear, u8 texmap, u8 *sample)
{
- int baseMip = 0;
+ int baseMip = 0;
bool mipLinear = false;
#if (ALLOW_MIPMAP)
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
- TexMode0& tm0 = texUnit.texMode0[texmap & 3];
+ TexMode0& tm0 = texUnit.texMode0[texmap & 3];
s32 lodFract = lod & 0xf;
@@ -91,7 +91,7 @@ void Sample(s32 s, s32 t, s32 lod, bool linear, u8 texmap, u8 *sample)
if (mipLinear)
{
u8 sampledTex[4];
- u32 texel[4];
+ u32 texel[4];
SampleMip(s, t, baseMip, linear, texmap, sampledTex);
SetTexel(sampledTex, texel, (16 - lodFract));
@@ -100,25 +100,25 @@ void Sample(s32 s, s32 t, s32 lod, bool linear, u8 texmap, u8 *sample)
AddTexel(sampledTex, texel, lodFract);
sample[0] = (u8)(texel[0] >> 4);
- sample[1] = (u8)(texel[1] >> 4);
- sample[2] = (u8)(texel[2] >> 4);
- sample[3] = (u8)(texel[3] >> 4);
+ sample[1] = (u8)(texel[1] >> 4);
+ sample[2] = (u8)(texel[2] >> 4);
+ sample[3] = (u8)(texel[3] >> 4);
}
else
#endif
{
SampleMip(s, t, baseMip, linear, texmap, sample);
- }
+ }
}
void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
{
FourTexUnits& texUnit = bpmem.tex[(texmap >> 2) & 1];
- u8 subTexmap = texmap & 3;
+ u8 subTexmap = texmap & 3;
- TexMode0& tm0 = texUnit.texMode0[subTexmap];
- TexImage0& ti0 = texUnit.texImage0[subTexmap];
- TexTLUT& texTlut = texUnit.texTlut[subTexmap];
+ TexMode0& tm0 = texUnit.texMode0[subTexmap];
+ TexImage0& ti0 = texUnit.texImage0[subTexmap];
+ TexTLUT& texTlut = texUnit.texTlut[subTexmap];
u8 *imageSrc, *imageSrcOdd = NULL;
if (texUnit.texImage1[subTexmap].image_type)
@@ -129,7 +129,7 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
}
else
{
- u32 imageBase = texUnit.texImage3[subTexmap].image_base << 5;
+ u32 imageBase = texUnit.texImage3[subTexmap].image_base << 5;
imageSrc = Memory::GetPointer(imageBase);
}
@@ -167,8 +167,8 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
}
}
- if (linear)
- {
+ if (linear)
+ {
// offset linear sampling
s -= 64;
t -= 64;
@@ -179,18 +179,18 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
// linear sampling
int imageSPlus1 = imageS + 1;
- int fractS = s & 0x7f;
-
- int imageTPlus1 = imageT + 1;
- int fractT = t & 0x7f;
+ int fractS = s & 0x7f;
- u8 sampledTex[4];
- u32 texel[4];
+ int imageTPlus1 = imageT + 1;
+ int fractT = t & 0x7f;
- WrapCoord(imageS, tm0.wrap_s, imageWidth);
- WrapCoord(imageT, tm0.wrap_t, imageHeight);
- WrapCoord(imageSPlus1, tm0.wrap_s, imageWidth);
- WrapCoord(imageTPlus1, tm0.wrap_t, imageHeight);
+ u8 sampledTex[4];
+ u32 texel[4];
+
+ WrapCoord(imageS, tm0.wrap_s, imageWidth);
+ WrapCoord(imageT, tm0.wrap_t, imageHeight);
+ WrapCoord(imageSPlus1, tm0.wrap_s, imageWidth);
+ WrapCoord(imageTPlus1, tm0.wrap_t, imageHeight);
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
{
@@ -221,26 +221,26 @@ void SampleMip(s32 s, s32 t, s32 mip, bool linear, u8 texmap, u8 *sample)
AddTexel(sampledTex, texel, (fractS) * (fractT));
}
- sample[0] = (u8)(texel[0] >> 14);
- sample[1] = (u8)(texel[1] >> 14);
- sample[2] = (u8)(texel[2] >> 14);
- sample[3] = (u8)(texel[3] >> 14);
- }
- else
- {
+ sample[0] = (u8)(texel[0] >> 14);
+ sample[1] = (u8)(texel[1] >> 14);
+ sample[2] = (u8)(texel[2] >> 14);
+ sample[3] = (u8)(texel[3] >> 14);
+ }
+ else
+ {
// integer part of sample location
int imageS = s >> 7;
int imageT = t >> 7;
- // nearest neighbor sampling
+ // nearest neighbor sampling
WrapCoord(imageS, tm0.wrap_s, imageWidth);
- WrapCoord(imageT, tm0.wrap_t, imageHeight);
+ WrapCoord(imageT, tm0.wrap_t, imageHeight);
if (!(ti0.format == GX_TF_RGBA8 && texUnit.texImage1[subTexmap].image_type))
- TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
+ TexDecoder_DecodeTexel(sample, imageSrc, imageS, imageT, imageWidth, ti0.format, tlutAddress, texTlut.tlut_format);
else
- TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT, imageWidth);
- }
+ TexDecoder_DecodeTexelRGBA8FromTmem(sample, imageSrc, imageSrcOdd, imageS, imageT, imageWidth);
+ }
}
}