mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-22 14:52:48 +02:00
Update to v094r27 release.
byuu says: Added AWJ's fixes for alt/cpu (Tetris Attack framelines issue) and alt/dsp (Thread::clock reset) Added fix so that the taskbar entry appears when the application first starts on Windows. Fixed checkbox toggling inside of list views on Windows. Updated nall/image to properly protect variables that should not be written externally. New Object syntax for hiro is in. Fixed the backwards-typing on Windows with the state manager. NOTE: the list view isn't redrawing when you change the description text. It does so on the cheat editor because of the resizeColumns call; but that shouldn't be necessary. I'll try and fix this for the next WIP.
This commit is contained in:
@@ -3,18 +3,18 @@
|
||||
|
||||
namespace nall {
|
||||
|
||||
void image::scale(unsigned outputWidth, unsigned outputHeight, bool linear) {
|
||||
if(width == outputWidth && height == outputHeight) return; //no scaling necessary
|
||||
auto image::scale(unsigned outputWidth, unsigned outputHeight, bool linear) -> void {
|
||||
if(_width == outputWidth && _height == outputHeight) return; //no scaling necessary
|
||||
if(linear == false) return scaleNearest(outputWidth, outputHeight);
|
||||
|
||||
if(width == outputWidth ) return scaleLinearHeight(outputHeight);
|
||||
if(height == outputHeight) return scaleLinearWidth(outputWidth);
|
||||
if(_width == outputWidth ) return scaleLinearHeight(outputHeight);
|
||||
if(_height == outputHeight) return scaleLinearWidth(outputWidth);
|
||||
|
||||
//find fastest scaling method, based on number of interpolation operations required
|
||||
//magnification usually benefits from two-pass linear interpolation
|
||||
//minification usually benefits from one-pass bilinear interpolation
|
||||
unsigned d1wh = ((width * outputWidth ) + (outputWidth * outputHeight)) * 1;
|
||||
unsigned d1hw = ((height * outputHeight) + (outputWidth * outputHeight)) * 1;
|
||||
unsigned d1wh = ((_width * outputWidth ) + (outputWidth * outputHeight)) * 1;
|
||||
unsigned d1hw = ((_height * outputHeight) + (outputWidth * outputHeight)) * 1;
|
||||
unsigned d2wh = (outputWidth * outputHeight) * 3;
|
||||
|
||||
if(d1wh <= d1hw && d1wh <= d2wh) return scaleLinearWidth(outputWidth), scaleLinearHeight(outputHeight);
|
||||
@@ -22,32 +22,32 @@ void image::scale(unsigned outputWidth, unsigned outputHeight, bool linear) {
|
||||
return scaleLinear(outputWidth, outputHeight);
|
||||
}
|
||||
|
||||
void image::scaleLinearWidth(unsigned outputWidth) {
|
||||
uint8_t* outputData = allocate(outputWidth, height, stride);
|
||||
unsigned outputPitch = outputWidth * stride;
|
||||
uint64_t xstride = ((uint64_t)(width - 1) << 32) / max(1u, outputWidth - 1);
|
||||
auto image::scaleLinearWidth(unsigned outputWidth) -> void {
|
||||
uint8_t* outputData = allocate(outputWidth, _height, stride());
|
||||
unsigned outputPitch = outputWidth * stride();
|
||||
uint64_t xstride = ((uint64_t)(_width - 1) << 32) / max(1u, outputWidth - 1);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(unsigned y = 0; y < height; y++) {
|
||||
for(unsigned y = 0; y < _height; y++) {
|
||||
uint64_t xfraction = 0;
|
||||
|
||||
const uint8_t* sp = data + pitch * y;
|
||||
const uint8_t* sp = _data + pitch() * y;
|
||||
uint8_t* dp = outputData + outputPitch * y;
|
||||
|
||||
uint64_t a = read(sp);
|
||||
uint64_t b = read(sp + stride);
|
||||
sp += stride;
|
||||
uint64_t b = read(sp + stride());
|
||||
sp += stride();
|
||||
|
||||
unsigned x = 0;
|
||||
while(true) {
|
||||
while(xfraction < 0x100000000 && x++ < outputWidth) {
|
||||
write(dp, interpolate4i(a, b, xfraction));
|
||||
dp += stride;
|
||||
dp += stride();
|
||||
xfraction += xstride;
|
||||
}
|
||||
if(x >= outputWidth) break;
|
||||
|
||||
sp += stride;
|
||||
sp += stride();
|
||||
a = b;
|
||||
b = read(sp);
|
||||
xfraction -= 0x100000000;
|
||||
@@ -55,37 +55,35 @@ void image::scaleLinearWidth(unsigned outputWidth) {
|
||||
}
|
||||
|
||||
free();
|
||||
data = outputData;
|
||||
width = outputWidth;
|
||||
pitch = outputPitch;
|
||||
size = height * pitch;
|
||||
_data = outputData;
|
||||
_width = outputWidth;
|
||||
}
|
||||
|
||||
void image::scaleLinearHeight(unsigned outputHeight) {
|
||||
uint8_t* outputData = allocate(width, outputHeight, stride);
|
||||
uint64_t ystride = ((uint64_t)(height - 1) << 32) / max(1u, outputHeight - 1);
|
||||
auto image::scaleLinearHeight(unsigned outputHeight) -> void {
|
||||
uint8_t* outputData = allocate(_width, outputHeight, stride());
|
||||
uint64_t ystride = ((uint64_t)(_height - 1) << 32) / max(1u, outputHeight - 1);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(unsigned x = 0; x < width; x++) {
|
||||
for(unsigned x = 0; x < _width; x++) {
|
||||
uint64_t yfraction = 0;
|
||||
|
||||
const uint8_t* sp = data + stride * x;
|
||||
uint8_t* dp = outputData + stride * x;
|
||||
const uint8_t* sp = _data + stride() * x;
|
||||
uint8_t* dp = outputData + stride() * x;
|
||||
|
||||
uint64_t a = read(sp);
|
||||
uint64_t b = read(sp + pitch);
|
||||
sp += pitch;
|
||||
uint64_t b = read(sp + pitch());
|
||||
sp += pitch();
|
||||
|
||||
unsigned y = 0;
|
||||
while(true) {
|
||||
while(yfraction < 0x100000000 && y++ < outputHeight) {
|
||||
write(dp, interpolate4i(a, b, yfraction));
|
||||
dp += pitch;
|
||||
dp += pitch();
|
||||
yfraction += ystride;
|
||||
}
|
||||
if(y >= outputHeight) break;
|
||||
|
||||
sp += pitch;
|
||||
sp += pitch();
|
||||
a = b;
|
||||
b = read(sp);
|
||||
yfraction -= 0x100000000;
|
||||
@@ -93,71 +91,68 @@ void image::scaleLinearHeight(unsigned outputHeight) {
|
||||
}
|
||||
|
||||
free();
|
||||
data = outputData;
|
||||
height = outputHeight;
|
||||
size = height * pitch;
|
||||
_data = outputData;
|
||||
_height = outputHeight;
|
||||
}
|
||||
|
||||
void image::scaleLinear(unsigned outputWidth, unsigned outputHeight) {
|
||||
uint8_t* outputData = allocate(outputWidth, outputHeight, stride);
|
||||
unsigned outputPitch = outputWidth * stride;
|
||||
auto image::scaleLinear(unsigned outputWidth, unsigned outputHeight) -> void {
|
||||
uint8_t* outputData = allocate(outputWidth, outputHeight, stride());
|
||||
unsigned outputPitch = outputWidth * stride();
|
||||
|
||||
uint64_t xstride = ((uint64_t)(width - 1) << 32) / max(1u, outputWidth - 1);
|
||||
uint64_t ystride = ((uint64_t)(height - 1) << 32) / max(1u, outputHeight - 1);
|
||||
uint64_t xstride = ((uint64_t)(_width - 1) << 32) / max(1u, outputWidth - 1);
|
||||
uint64_t ystride = ((uint64_t)(_height - 1) << 32) / max(1u, outputHeight - 1);
|
||||
|
||||
#pragma omp parallel for
|
||||
for(unsigned y = 0; y < outputHeight; y++) {
|
||||
uint64_t yfraction = ystride * y;
|
||||
uint64_t xfraction = 0;
|
||||
|
||||
const uint8_t* sp = data + pitch * (yfraction >> 32);
|
||||
const uint8_t* sp = _data + pitch() * (yfraction >> 32);
|
||||
uint8_t* dp = outputData + outputPitch * y;
|
||||
|
||||
uint64_t a = read(sp);
|
||||
uint64_t b = read(sp + stride);
|
||||
uint64_t c = read(sp + pitch);
|
||||
uint64_t d = read(sp + pitch + stride);
|
||||
sp += stride;
|
||||
uint64_t b = read(sp + stride());
|
||||
uint64_t c = read(sp + pitch());
|
||||
uint64_t d = read(sp + pitch() + stride());
|
||||
sp += stride();
|
||||
|
||||
unsigned x = 0;
|
||||
while(true) {
|
||||
while(xfraction < 0x100000000 && x++ < outputWidth) {
|
||||
write(dp, interpolate4i(a, b, c, d, xfraction, yfraction));
|
||||
dp += stride;
|
||||
dp += stride();
|
||||
xfraction += xstride;
|
||||
}
|
||||
if(x >= outputWidth) break;
|
||||
|
||||
sp += stride;
|
||||
sp += stride();
|
||||
a = b;
|
||||
c = d;
|
||||
b = read(sp);
|
||||
d = read(sp + pitch);
|
||||
d = read(sp + pitch());
|
||||
xfraction -= 0x100000000;
|
||||
}
|
||||
}
|
||||
|
||||
free();
|
||||
data = outputData;
|
||||
width = outputWidth;
|
||||
height = outputHeight;
|
||||
pitch = outputPitch;
|
||||
size = height * pitch;
|
||||
_data = outputData;
|
||||
_width = outputWidth;
|
||||
_height = outputHeight;
|
||||
}
|
||||
|
||||
void image::scaleNearest(unsigned outputWidth, unsigned outputHeight) {
|
||||
uint8_t* outputData = allocate(outputWidth, outputHeight, stride);
|
||||
unsigned outputPitch = outputWidth * stride;
|
||||
auto image::scaleNearest(unsigned outputWidth, unsigned outputHeight) -> void {
|
||||
uint8_t* outputData = allocate(outputWidth, outputHeight, stride());
|
||||
unsigned outputPitch = outputWidth * stride();
|
||||
|
||||
uint64_t xstride = ((uint64_t)width << 32) / outputWidth;
|
||||
uint64_t ystride = ((uint64_t)height << 32) / outputHeight;
|
||||
uint64_t xstride = ((uint64_t)_width << 32) / outputWidth;
|
||||
uint64_t ystride = ((uint64_t)_height << 32) / outputHeight;
|
||||
|
||||
#pragma omp parallel for
|
||||
for(unsigned y = 0; y < outputHeight; y++) {
|
||||
uint64_t yfraction = ystride * y;
|
||||
uint64_t xfraction = 0;
|
||||
|
||||
const uint8_t* sp = data + pitch * (yfraction >> 32);
|
||||
const uint8_t* sp = _data + pitch() * (yfraction >> 32);
|
||||
uint8_t* dp = outputData + outputPitch * y;
|
||||
|
||||
uint64_t a = read(sp);
|
||||
@@ -166,23 +161,21 @@ void image::scaleNearest(unsigned outputWidth, unsigned outputHeight) {
|
||||
while(true) {
|
||||
while(xfraction < 0x100000000 && x++ < outputWidth) {
|
||||
write(dp, a);
|
||||
dp += stride;
|
||||
dp += stride();
|
||||
xfraction += xstride;
|
||||
}
|
||||
if(x >= outputWidth) break;
|
||||
|
||||
sp += stride;
|
||||
sp += stride();
|
||||
a = read(sp);
|
||||
xfraction -= 0x100000000;
|
||||
}
|
||||
}
|
||||
|
||||
free();
|
||||
data = outputData;
|
||||
width = outputWidth;
|
||||
height = outputHeight;
|
||||
pitch = outputPitch;
|
||||
size = height * pitch;
|
||||
_data = outputData;
|
||||
_width = outputWidth;
|
||||
_height = outputHeight;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user