summaryrefslogtreecommitdiff
path: root/glcddrivers/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'glcddrivers/image.c')
-rw-r--r--glcddrivers/image.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/glcddrivers/image.c b/glcddrivers/image.c
index 6a89ffa..a3d123f 100644
--- a/glcddrivers/image.c
+++ b/glcddrivers/image.c
@@ -136,18 +136,20 @@ void cDriverImage::SetPixel(int x, int y, uint32_t data)
if (x >= width || y >= height)
return;
+ int cols = (width + 7 ) >> 3;
int pos = x % 8;
if (config->upsideDown)
{
x = width - 1 - x;
y = height - 1 - y;
+ } else {
pos = 7 - pos; // reverse bit position
}
if (data == GRAPHLCD_White)
- newLCD[y * x] |= ( 1 << pos );
+ newLCD[y * cols + (x >> 3)] |= ( 1 << pos );
else
- newLCD[y * x] &= ( 0xFF ^ ( 1 << pos) );
+ newLCD[y * cols + (x >> 3)] &= ( 0xFF ^ ( 1 << pos) );
}
void cDriverImage::Refresh(bool refreshAll)