mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Makes endian aware.
This commit is contained in:
parent
d2324e413d
commit
45375fb5d0
@ -302,8 +302,13 @@ void Video::shift_out(int length) {
|
|||||||
output_shifter_ <<= pixels;
|
output_shifter_ <<= pixels;
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case OutputBpp::Two:
|
case OutputBpp::Two: {
|
||||||
pixel_buffer_.pixels_output += length;
|
pixel_buffer_.pixels_output += length;
|
||||||
|
#if TARGET_RT_BIG_ENDIAN
|
||||||
|
const int upper = 0;
|
||||||
|
#else
|
||||||
|
const int upper = 1;
|
||||||
|
#endif
|
||||||
if(pixel_buffer_.pixel_pointer) {
|
if(pixel_buffer_.pixel_pointer) {
|
||||||
while(length--) {
|
while(length--) {
|
||||||
*pixel_buffer_.pixel_pointer = palette_[
|
*pixel_buffer_.pixel_pointer = palette_[
|
||||||
@ -313,20 +318,20 @@ void Video::shift_out(int length) {
|
|||||||
// This ensures that the top two words shift one to the left;
|
// This ensures that the top two words shift one to the left;
|
||||||
// their least significant bits are fed from the most significant bits
|
// their least significant bits are fed from the most significant bits
|
||||||
// of the bottom two words, respectively.
|
// of the bottom two words, respectively.
|
||||||
shifter_halves_[1] = (shifter_halves_[1] << 1) & 0xfffefffe;
|
shifter_halves_[upper] = (shifter_halves_[upper] << 1) & 0xfffefffe;
|
||||||
shifter_halves_[1] |= (shifter_halves_[0] & 0x80008000) >> 15;
|
shifter_halves_[upper] |= (shifter_halves_[upper^1] & 0x80008000) >> 15;
|
||||||
shifter_halves_[0] = (shifter_halves_[0] << 1) & 0xfffefffe;
|
shifter_halves_[upper^1] = (shifter_halves_[upper^1] << 1) & 0xfffefffe;
|
||||||
|
|
||||||
++pixel_buffer_.pixel_pointer;
|
++pixel_buffer_.pixel_pointer;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while(length--) {
|
while(length--) {
|
||||||
shifter_halves_[1] = (shifter_halves_[1] << 1) & 0xfffefffe;
|
shifter_halves_[upper] = (shifter_halves_[upper] << 1) & 0xfffefffe;
|
||||||
shifter_halves_[1] |= (shifter_halves_[0] & 0x80008000) >> 15;
|
shifter_halves_[upper] |= (shifter_halves_[upper^1] & 0x80008000) >> 15;
|
||||||
shifter_halves_[0] = (shifter_halves_[0] << 1) & 0xfffefffe;
|
shifter_halves_[upper^1] = (shifter_halves_[upper^1] << 1) & 0xfffefffe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
} break;
|
||||||
default:
|
default:
|
||||||
case OutputBpp::Four:
|
case OutputBpp::Four:
|
||||||
pixel_buffer_.pixels_output += length >> 1;
|
pixel_buffer_.pixels_output += length >> 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user