made change to be able to use libopenui with lvgl as underlying lib

This commit is contained in:
gagarinlg
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent b624ffc631
commit e538138ade
2 changed files with 17 additions and 5 deletions
+4 -4
View File
@@ -36,7 +36,7 @@ constexpr uint8_t STASHED = 0x33;
#define APPLY_OFFSET() x += this->offsetX; y += this->offsetY
#define RESTORE_OFFSET() this->offsetX = offsetX, this->offsetY = offsetY
#if defined(LCD_VERTICAL_INVERT)
#if defined(LCD_VERTICAL_INVERT) && 0
#define MOVE_PIXEL_RIGHT(p, count) p -= count
#else
#define MOVE_PIXEL_RIGHT(p, count) p += count
@@ -156,7 +156,7 @@ class BitmapBufferBase
inline const pixel_t * getPixelPtrAbs(coord_t x, coord_t y) const
{
#if defined(LCD_VERTICAL_INVERT)
#if defined(LCD_VERTICAL_INVERT) && 0
x = _width - x - 1;
y = _height - y - 1;
#endif
@@ -401,7 +401,7 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
inline const pixel_t * getPixelPtrAbs(coord_t x, coord_t y) const
{
#if defined(LCD_VERTICAL_INVERT)
#if defined(LCD_VERTICAL_INVERT) && 0
x = _width - x - 1;
y = _height - y - 1;
#endif
@@ -410,7 +410,7 @@ class BitmapBuffer: public BitmapBufferBase<pixel_t>
inline pixel_t * getPixelPtrAbs(coord_t x, coord_t y)
{
#if defined(LCD_VERTICAL_INVERT)
#if defined(LCD_VERTICAL_INVERT) && 0
x = _width - x - 1;
y = _height - y - 1;
#endif
+13 -1
View File
@@ -186,9 +186,21 @@ void MainWindow::invalidate(const rect_t & rect)
invalidatedRect = rect;
}
}
#include "lvgl/lvgl.h"
extern lv_obj_t * canvas;
extern BitmapBuffer lcdBackup;
bool MainWindow::refresh()
{
if (invalidatedRect.w) {
lcdBackup.setOffset(0, 0);
lcdBackup.setClippingRect(0,LCD_W,0, LCD_H);
fullPaint(&lcdBackup);
lv_canvas_copy_buf(canvas, lcdBackup.getData(), 0, 0, LCD_W, LCD_H);
lv_img_cache_invalidate_src(lcdBackup.getData());
lv_obj_invalidate(canvas);
}
return false;
if (invalidatedRect.w) {
if (invalidatedRect.x > 0 || invalidatedRect.y > 0 || invalidatedRect.w < LCD_W || invalidatedRect.h < LCD_H) {
TRACE_WINDOWS("Refresh rect: left=%d top=%d width=%d height=%d", invalidatedRect.left(), invalidatedRect.top(), invalidatedRect.w, invalidatedRect.h);