mirror of https://github.com/MLXXXp/Arduboy2.git
Add C++ equivalent code for drawPixel()
This commit is contained in:
parent
2941ed100f
commit
195d3e5cde
|
@ -364,6 +364,27 @@ void Arduboy2Base::drawPixel(int16_t x, int16_t y, uint8_t color)
|
|||
if (!(color & _BV(0))) data ^= bit;
|
||||
sBuffer[row_offset] = data;
|
||||
}
|
||||
#if 0
|
||||
// For reference, this is the C++ equivalent
|
||||
void Arduboy2Base::drawPixel(int16_t x, int16_t y, uint8_t color)
|
||||
{
|
||||
#ifdef PIXEL_SAFE_MODE
|
||||
if (x < 0 || x > (WIDTH-1) || y < 0 || y > (HEIGHT-1))
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint16_t row_offset;
|
||||
uint8_t bit;
|
||||
|
||||
bit = 1 << (y & 7);
|
||||
row_offset = (y & 0xF8) * WIDTH / 8 + x;
|
||||
uint8_t data = sBuffer[row_offset] | bit;
|
||||
if (!color) data ^= bit;
|
||||
sBuffer[row_offset] = data;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t Arduboy2Base::getPixel(uint8_t x, uint8_t y)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue