mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-07-15 07:07:24 +00:00
Get rid of some redundant code =)
This commit is contained in:
parent
f502e2bd0e
commit
9911d5edc5
|
@ -146,15 +146,7 @@ namespace PVRTCC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pixel result;
|
Pixel result = (pa * (8 - lerpVal) + pb * lerpVal) / 8;
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
|
||||||
uint16 va = static_cast<uint16>(pa.Component(c));
|
|
||||||
uint16 vb = static_cast<uint16>(pb.Component(c));
|
|
||||||
|
|
||||||
uint16 res = (va * (8 - lerpVal) + vb * lerpVal) / 8;
|
|
||||||
result.Component(c) = static_cast<uint8>(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(punchThrough) {
|
if(punchThrough) {
|
||||||
result.A() = 0;
|
result.A() = 0;
|
||||||
}
|
}
|
||||||
|
@ -259,15 +251,7 @@ namespace PVRTCC {
|
||||||
const Pixel &pa = imgA(i, j);
|
const Pixel &pa = imgA(i, j);
|
||||||
const Pixel &pb = imgB(i, j);
|
const Pixel &pb = imgB(i, j);
|
||||||
|
|
||||||
Pixel result;
|
Pixel result = (pa * (8 - lerpVal) + pb * lerpVal) / 8;
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
|
||||||
uint16 va = static_cast<uint16>(pa.Component(c));
|
|
||||||
uint16 vb = static_cast<uint16>(pb.Component(c));
|
|
||||||
|
|
||||||
uint16 res = (va * (8 - lerpVal) + vb * lerpVal) / 8;
|
|
||||||
result.Component(c) = static_cast<uint8>(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32 *outPixels = reinterpret_cast<uint32 *>(outBuf);
|
uint32 *outPixels = reinterpret_cast<uint32 *>(outBuf);
|
||||||
outPixels[(j * w) + i] = result.Pack();
|
outPixels[(j * w) + i] = result.Pack();
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,15 +196,17 @@ void Image::BilinearUpscale(uint32 xtimes, uint32 ytimes,
|
||||||
for(uint32 c = 0; c < 4; c++) fpDepths[c] = xtimes + ytimes;
|
for(uint32 c = 0; c < 4; c++) fpDepths[c] = xtimes + ytimes;
|
||||||
fp.ChangeBitDepth(fpDepths);
|
fp.ChangeBitDepth(fpDepths);
|
||||||
|
|
||||||
|
const FasTC::Pixel tl = topLeft * topLeftWeight;
|
||||||
|
const FasTC::Pixel tr = topRight * topRightWeight;
|
||||||
|
const FasTC::Pixel bl = bottomLeft * bottomLeftWeight;
|
||||||
|
const FasTC::Pixel br = bottomRight * bottomRightWeight;
|
||||||
|
const FasTC::Pixel sum = tl + tr + bl + br;
|
||||||
|
|
||||||
for(uint32 c = 0; c < 4; c++) {
|
for(uint32 c = 0; c < 4; c++) {
|
||||||
const uint32 tl = topLeft.Component(c) * topLeftWeight;
|
fp.Component(c) = sum.Component(c) & scaleMask;
|
||||||
const uint32 tr = topRight.Component(c) * topRightWeight;
|
|
||||||
const uint32 bl = bottomLeft.Component(c) * bottomLeftWeight;
|
|
||||||
const uint32 br = bottomRight.Component(c) * bottomRightWeight;
|
|
||||||
const uint32 sum = tl + tr + bl + br;
|
|
||||||
fp.Component(c) = sum & scaleMask;
|
|
||||||
p.Component(c) = sum / (xscale * yscale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p = sum / (xscale * yscale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue