~ TwoColor mode no longer needs a perfect white
This commit is contained in:
parent
34388786e6
commit
6b49774838
|
@ -71,7 +71,7 @@ namespace vkvm {
|
|||
case TwoColors: {
|
||||
int pixelIndex = (y * getWidth() + x);
|
||||
unsigned char *ptr = reinterpret_cast<unsigned char *>(getPixelArea()) + (pixelIndex / bitsPerPixel);
|
||||
if (color == reg->foreground_color) {
|
||||
if (color.getRed() > 127 || color.getGreen() > 127 || color.getBlue() > 127) {
|
||||
//set bit to 1
|
||||
ptr[0] |= (1 << (pixelIndex % bitsPerPixel));
|
||||
} else {
|
||||
|
|
|
@ -31,9 +31,9 @@ TEST_CASE("Colors") {
|
|||
vkvm::setMode(vkvm::TwoColors);
|
||||
REQUIRE(vkvm::getPixel(10, 10) == vkvm::black);
|
||||
REQUIRE(vkvm::getPixel(11, 11) == vkvm::white);
|
||||
REQUIRE(vkvm::getPixel(12, 12) == vkvm::black);
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::black);
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::black);
|
||||
REQUIRE(vkvm::getPixel(12, 12) == vkvm::white);
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::white);
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::white);
|
||||
REQUIRE(vkvm::getPixel(15, 15) == vkvm::black);
|
||||
REQUIRE(vkvm::getPixel(16, 16) == vkvm::white);
|
||||
REQUIRE(vkvm::getPixel(17, 17) == vkvm::white);
|
||||
|
@ -49,9 +49,9 @@ TEST_CASE("Colors") {
|
|||
|
||||
REQUIRE(vkvm::getPixel(10, 10) == vkvm::blue);
|
||||
REQUIRE(vkvm::getPixel(11, 11) == vkvm::red);
|
||||
REQUIRE(vkvm::getPixel(12, 12) == vkvm::blue);
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::blue);
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::blue);
|
||||
REQUIRE(vkvm::getPixel(12, 12) == vkvm::red);
|
||||
REQUIRE(vkvm::getPixel(13, 13) == vkvm::red);
|
||||
REQUIRE(vkvm::getPixel(14, 14) == vkvm::red);
|
||||
REQUIRE(vkvm::getPixel(15, 15) == vkvm::blue);
|
||||
REQUIRE(vkvm::getPixel(16, 16) == vkvm::red);
|
||||
REQUIRE(vkvm::getPixel(17, 17) == vkvm::red);
|
||||
|
|
Loading…
Reference in New Issue