rotation bug fix

This commit is contained in:
nitko12 2020-07-30 15:07:18 +02:00
parent 1e534c3bd8
commit c40339c267
1 changed files with 3 additions and 3 deletions

View File

@ -87,12 +87,12 @@ void Inkplate::begin(void) {
//Draw function, used by Adafruit GFX. //Draw function, used by Adafruit GFX.
void Inkplate::drawPixel(int16_t x0, int16_t y0, uint16_t color) { void Inkplate::drawPixel(int16_t x0, int16_t y0, uint16_t color) {
if (x0 > 799 || y0 > 599 || x0 < 0 || y0 < 0) return; if (x0 > _width - 1 || y0 > _height - 1 || x0 < 0 || y0 < 0) return;
switch (_rotation) { switch (_rotation) {
case 1: case 1:
_swap_int16_t(x0, y0); _swap_int16_t(x0, y0);
x0 = _width - x0 - 1; x0 = _height - x0 - 1;
break; break;
case 2: case 2:
x0 = _width - x0 - 1; x0 = _width - x0 - 1;
@ -237,7 +237,7 @@ void Inkplate::drawBitmap3Bit(int16_t _x, int16_t _y, const unsigned char* _p, i
void Inkplate::setRotation(uint8_t r) { void Inkplate::setRotation(uint8_t r) {
_rotation = r % 4; _rotation = r % 4;
switch (rotation) { switch (_rotation) {
case 0: case 0:
_width = E_INK_WIDTH; _width = E_INK_WIDTH;
_height = E_INK_HEIGHT; _height = E_INK_HEIGHT;