mirror of https://github.com/MLXXXp/Arduboy2.git
Merge 8db5f35a4e into bc460a2cff
This commit is contained in:
commit
f23f770d84
|
|
@ -547,12 +547,34 @@ void Arduboy2Base::drawRect
|
||||||
void Arduboy2Base::drawFastVLine
|
void Arduboy2Base::drawFastVLine
|
||||||
(int16_t x, int16_t y, uint8_t h, uint8_t color)
|
(int16_t x, int16_t y, uint8_t h, uint8_t color)
|
||||||
{
|
{
|
||||||
int end = y+h;
|
if (x < 0 || x >= WIDTH || y >= HEIGHT) return;
|
||||||
for (int a = max(0,y); a < min(end,HEIGHT); a++)
|
|
||||||
|
color = (color == WHITE ? ~0 : 0);
|
||||||
|
|
||||||
|
if (y < 0)
|
||||||
{
|
{
|
||||||
drawPixel(x,a,color);
|
h += y;
|
||||||
|
y = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
int16_t end = y + h;
|
||||||
|
uint8_t data, colorUp = 0xff << (y - (y & 0xf8)),
|
||||||
|
colorDown = 0xff >> (8 - (min(end, HEIGHT - 1) & 7));
|
||||||
|
|
||||||
|
data = sBuffer[(y & 0xf8) * WIDTH / 8 + x] | colorUp;
|
||||||
|
if (!color) data ^= colorUp;
|
||||||
|
sBuffer[(y & 0xf8) * WIDTH / 8 + x] = data;
|
||||||
|
|
||||||
|
for (uint8_t i = max(y + 7, 0) & 0xf8; i <= min(end, HEIGHT - 1) - 7; i += 8)
|
||||||
|
{
|
||||||
|
sBuffer[i * WIDTH / 8 + x] = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = sBuffer[(min(end, HEIGHT - 1) & 0xf8) * WIDTH / 8 + x] | colorDown;
|
||||||
|
if (!color) data ^= colorDown;
|
||||||
|
sBuffer[(min(end, HEIGHT - 1) & 0xf8) * WIDTH / 8 + x] = data;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void Arduboy2Base::drawFastHLine
|
void Arduboy2Base::drawFastHLine
|
||||||
(int16_t x, int16_t y, uint8_t w, uint8_t color)
|
(int16_t x, int16_t y, uint8_t w, uint8_t color)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue