Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
moononournation committed Feb 8, 2024
1 parent 5258ba9 commit e4d554d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
1 change: 1 addition & 0 deletions src/canvas/Arduino_Canvas_3bit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Arduino_Canvas_3bit::Arduino_Canvas_3bit(int16_t w, int16_t h, Arduino_G *output, int16_t output_x, int16_t output_y)
: Arduino_GFX(w, h), _output(output), _output_x(output_x), _output_y(output_y)
{
setRotation(0);
}

Arduino_Canvas_3bit::~Arduino_Canvas_3bit()
Expand Down
27 changes: 2 additions & 25 deletions src/canvas/Arduino_Canvas_Mono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Arduino_Canvas_Mono::Arduino_Canvas_Mono(int16_t w, int16_t h, Arduino_G *output
: Arduino_GFX(w, h), _output(output), _output_x(output_x), _output_y(output_y), _verticalByte(verticalByte),
_canvas_width(w), _canvas_height(h)
{
setRotation(0);
}

Arduino_Canvas_Mono::~Arduino_Canvas_Mono()
Expand Down Expand Up @@ -68,30 +69,6 @@ bool Arduino_Canvas_Mono::begin(int32_t speed)

void Arduino_Canvas_Mono::writePixelPreclipped(int16_t x, int16_t y, uint16_t color)
{
// rotate to the orientation in the bitmap buffer
if (_rotation)
{
int16_t tmp;

switch (_rotation)
{
case 1: // 90° right
tmp = y;
y = x;
x = _canvas_width - 1 - tmp;
break;
case 2: // 180°
x = _canvas_width - 1 - x;
y = _canvas_height - 1 - y;
break;
case 3: // 270° right == 90° left
tmp = y;
y = _canvas_height - 1 - x;
x = tmp;
break;
}
}

// change the pixel in the original orientation of the bitmap buffer
if (_verticalByte)
{
Expand All @@ -111,7 +88,7 @@ void Arduino_Canvas_Mono::writePixelPreclipped(int16_t x, int16_t y, uint16_t co
{
// horizontal buffer layout: 1 byte in the buffer contains 8 horizontal pixels
int16_t w = (_canvas_width + 7) / 8;
int32_t pos = y * w + x / 8;
int32_t pos = (y * w) + (x / 8);

if (color & 0b1000010000010000)
{
Expand Down

0 comments on commit e4d554d

Please sign in to comment.