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:
Tim Allen
2015-06-18 20:48:53 +10:00
parent a21ff570ee
commit 20cc6148cb
62 changed files with 1580 additions and 1569 deletions

View File

@@ -3,91 +3,93 @@
namespace nall {
bool image::crop(unsigned outputX, unsigned outputY, unsigned outputWidth, unsigned outputHeight) {
if(outputX + outputWidth > width) return false;
if(outputY + outputHeight > height) return false;
auto image::crop(unsigned outputX, unsigned outputY, unsigned outputWidth, unsigned outputHeight) -> bool {
if(outputX + outputWidth > _width) return false;
if(outputY + outputHeight > _height) return false;
uint8_t* outputData = allocate(outputWidth, outputHeight, stride);
unsigned outputPitch = outputWidth * stride;
uint8_t* outputData = allocate(outputWidth, outputHeight, stride());
unsigned outputPitch = outputWidth * stride();
#pragma omp parallel for
for(unsigned y = 0; y < outputHeight; y++) {
const uint8_t* sp = data + pitch * (outputY + y) + stride * outputX;
const uint8_t* sp = _data + pitch() * (outputY + y) + stride() * outputX;
uint8_t* dp = outputData + outputPitch * y;
for(unsigned x = 0; x < outputWidth; x++) {
write(dp, read(sp));
sp += stride;
dp += stride;
sp += stride();
dp += stride();
}
}
delete[] data;
data = outputData;
width = outputWidth;
height = outputHeight;
pitch = outputPitch;
size = width * pitch;
delete[] _data;
_data = outputData;
_width = outputWidth;
_height = outputHeight;
return true;
}
void image::alphaBlend(uint64_t alphaColor) {
uint64_t alphaR = (alphaColor & red.mask ) >> red.shift;
uint64_t alphaG = (alphaColor & green.mask) >> green.shift;
uint64_t alphaB = (alphaColor & blue.mask ) >> blue.shift;
auto image::alphaBlend(uint64_t alphaColor) -> void {
uint64_t alphaR = (alphaColor & _red.mask() ) >> _red.shift();
uint64_t alphaG = (alphaColor & _green.mask()) >> _green.shift();
uint64_t alphaB = (alphaColor & _blue.mask() ) >> _blue.shift();
#pragma omp parallel for
for(unsigned y = 0; y < height; y++) {
uint8_t* dp = data + pitch * y;
for(unsigned x = 0; x < width; x++) {
for(unsigned y = 0; y < _height; y++) {
uint8_t* dp = _data + pitch() * y;
for(unsigned x = 0; x < _width; x++) {
uint64_t color = read(dp);
uint64_t colorA = (color & alpha.mask) >> alpha.shift;
uint64_t colorR = (color & red.mask ) >> red.shift;
uint64_t colorG = (color & green.mask) >> green.shift;
uint64_t colorB = (color & blue.mask ) >> blue.shift;
double alphaScale = (double)colorA / (double)((1 << alpha.depth) - 1);
uint64_t colorA = (color & _alpha.mask()) >> _alpha.shift();
uint64_t colorR = (color & _red.mask() ) >> _red.shift();
uint64_t colorG = (color & _green.mask()) >> _green.shift();
uint64_t colorB = (color & _blue.mask() ) >> _blue.shift();
double alphaScale = (double)colorA / (double)((1 << _alpha.depth()) - 1);
colorA = (1 << alpha.depth) - 1;
colorA = (1 << _alpha.depth()) - 1;
colorR = (colorR * alphaScale) + (alphaR * (1.0 - alphaScale));
colorG = (colorG * alphaScale) + (alphaG * (1.0 - alphaScale));
colorB = (colorB * alphaScale) + (alphaB * (1.0 - alphaScale));
write(dp, (colorA << alpha.shift) | (colorR << red.shift) | (colorG << green.shift) | (colorB << blue.shift));
dp += stride;
write(dp, (colorA << _alpha.shift()) | (colorR << _red.shift()) | (colorG << _green.shift()) | (colorB << _blue.shift()));
dp += stride();
}
}
}
void image::transform(bool outputEndian, unsigned outputDepth, uint64_t outputAlphaMask, uint64_t outputRedMask, uint64_t outputGreenMask, uint64_t outputBlueMask) {
if(endian == outputEndian && depth == outputDepth && alpha.mask == outputAlphaMask && red.mask == outputRedMask && green.mask == outputGreenMask && blue.mask == outputBlueMask) return;
auto image::transform(const image& source) -> void {
return transform(source._endian, source._depth, source._alpha.mask(), source._red.mask(), source._green.mask(), source._blue.mask());
}
auto image::transform(bool outputEndian, unsigned outputDepth, uint64_t outputAlphaMask, uint64_t outputRedMask, uint64_t outputGreenMask, uint64_t outputBlueMask) -> void {
if(_endian == outputEndian && _depth == outputDepth && _alpha.mask() == outputAlphaMask && _red.mask() == outputRedMask && _green.mask() == outputGreenMask && _blue.mask() == outputBlueMask) return;
image output(outputEndian, outputDepth, outputAlphaMask, outputRedMask, outputGreenMask, outputBlueMask);
output.allocate(width, height);
output.allocate(_width, _height);
#pragma omp parallel for
for(unsigned y = 0; y < height; y++) {
const uint8_t* sp = data + pitch * y;
uint8_t* dp = output.data + output.pitch * y;
for(unsigned x = 0; x < width; x++) {
for(unsigned y = 0; y < _height; y++) {
const uint8_t* sp = _data + pitch() * y;
uint8_t* dp = output._data + output.pitch() * y;
for(unsigned x = 0; x < _width; x++) {
uint64_t color = read(sp);
sp += stride;
sp += stride();
uint64_t a = (color & alpha.mask) >> alpha.shift;
uint64_t r = (color & red.mask) >> red.shift;
uint64_t g = (color & green.mask) >> green.shift;
uint64_t b = (color & blue.mask) >> blue.shift;
uint64_t a = (color & _alpha.mask()) >> _alpha.shift();
uint64_t r = (color & _red.mask() ) >> _red.shift();
uint64_t g = (color & _green.mask()) >> _green.shift();
uint64_t b = (color & _blue.mask() ) >> _blue.shift();
a = normalize(a, alpha.depth, output.alpha.depth);
r = normalize(r, red.depth, output.red.depth);
g = normalize(g, green.depth, output.green.depth);
b = normalize(b, blue.depth, output.blue.depth);
a = normalize(a, _alpha.depth(), output._alpha.depth());
r = normalize(r, _red.depth(), output._red.depth());
g = normalize(g, _green.depth(), output._green.depth());
b = normalize(b, _blue.depth(), output._blue.depth());
output.write(dp, (a << output.alpha.shift) | (r << output.red.shift) | (g << output.green.shift) | (b << output.blue.shift));
dp += output.stride;
output.write(dp, (a << output._alpha.shift()) | (r << output._red.shift()) | (g << output._green.shift()) | (b << output._blue.shift()));
dp += output.stride();
}
}
operator=(std::move(output));
operator=(move(output));
}
}