Arduino_GFX
Arduino_GFX copied to clipboard
Column and row offsets do not work properly with rotation
This is done in Arduino_RGB_Display::writePixelPreclipped and Arduino_RGB_Display::draw16bitRGBBitmap BEFORE rotating the coordinates:
x += COL_OFFSET1;
y += ROW_OFFSET1;
Because of this, these operations render incorrectly when the display is rotated.
Replacing the contents of Arduino_RGB_Display::writePixelPreclipped with this:
int16_t t = x;
if (_rotation == 1) {
x = WIDTH - 1 - y;
y = t;
} else if (_rotation == 2) {
x = WIDTH - 1 - x;
y = HEIGHT - 1 - y;
} else if (_rotation == 3) {
x = y;
y = HEIGHT - 1 - t;
}
x += COL_OFFSET1;
y += ROW_OFFSET1;
uint16_t *fb = _framebuffer + (int32_t)y * _fb_width + x;
*fb = color;
if (_auto_flush)
Cache_WriteBack_Addr((uint32_t)fb, 2);
does solve the issue for that function. I have not tried rendering bitmaps, so I have not explored a resolution for Arduino_RGB_Display::draw16bitRGBBitmap.
Updated, please get update and test is it ok.
Compiling .pio/build/waveshare-esp32s3-touch-amoled-164/lib336/GFX Library for Arduino/display/Arduino_ST7789.cpp.o
.pio/libdeps/waveshare-esp32s3-touch-amoled-164/GFX Library for Arduino/src/display/Arduino_RGB_Display.cpp: In member function 'virtual void Arduino_RGB_Display::writePixelPreclipped(int16_t, int16_t, uint16_t)':
.pio/libdeps/waveshare-esp32s3-touch-amoled-164/GFX Library for Arduino/src/display/Arduino_RGB_Display.cpp:98:3: error: expected primary-expression before '}' token
98 | }
| ^
Compiling .pio/build/waveshare-esp32s3-touch-amoled-164/lib336/GFX Library for Arduino/display/Arduino_ST77916.cpp.o
*** [.pio/build/waveshare-esp32s3-touch-amoled-164/lib336/GFX Library for Arduino/display/Arduino_RGB_Display.cpp.o] Error 1
This commit broke my local project