Skip to content

Commit 8422923

Browse files
committed
Resolve paint corrupting screen scrolling
1 parent 0881edd commit 8422923

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/displayapp/LittleVgl.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ void LittleVgl::SetFullRefresh(FullRefreshDirections direction) {
149149
fullRefresh = true;
150150
}
151151

152+
bool LittleVgl::IsScrolling() {
153+
return scrollDirection != LittleVgl::FullRefreshDirections::None;
154+
}
155+
152156
void LittleVgl::FlushDisplay(const lv_area_t* area, lv_color_t* color_p) {
153157
uint16_t y1, y2, width, height = 0;
154158

src/displayapp/LittleVgl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ namespace Pinetime {
2727
void SetNewTouchPoint(int16_t x, int16_t y, bool contact);
2828
void CancelTap();
2929
void ClearTouchState();
30+
bool IsScrolling();
3031

3132
bool GetFullRefresh() {
3233
bool returnValue = fullRefresh;

src/displayapp/screens/InfiniPaint.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,17 @@ bool InfiniPaint::OnTouchEvent(Pinetime::Applications::TouchEvents event) {
6161
}
6262

6363
bool InfiniPaint::OnTouchEvent(uint16_t x, uint16_t y) {
64+
// If currently scrolling in or out of InfiniPaint, don't paint anything!
65+
// Since InfiniPaint writes directly to the display bypassing LVGL, painting
66+
// while scrolling is happening causes bad behaviour
67+
if (lvgl.IsScrolling()) {
68+
return false;
69+
}
6470
lv_area_t area;
6571
area.x1 = x - (width / 2);
6672
area.y1 = y - (height / 2);
6773
area.x2 = x + (width / 2) - 1;
6874
area.y2 = y + (height / 2) - 1;
69-
lvgl.SetFullRefresh(Components::LittleVgl::FullRefreshDirections::None);
7075
lvgl.FlushDisplay(&area, b);
7176
return true;
7277
}

0 commit comments

Comments
 (0)