Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Track redrew with some color code #696

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/target/common/emu/fltk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,42 @@ void PWR_Sleep() {
void LCD_ForceUpdate() {
if (changed) {
changed = false;
#ifdef BUILDTYPE_DEV
for (int x = 0; x < LCD_WIDTH; x++)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably needs to be configurable rather than always on with dev builds

for (int y = 0; y < LCD_HEIGHT; y++) {
switch(gui.pixel_tracking[x][y]) {
case 0:
case 1:
break;

case 2:
// draw as blue
gui.image[3*(LCD_WIDTH*y+x)] >>= 3;
gui.image[3*(LCD_WIDTH*y+x)+1] >>= 3;
gui.image[3*(LCD_WIDTH*y+x)+2] |= 0xC0;

break;

case 3:
// draw as green
gui.image[3*(LCD_WIDTH*y+x)] >>= 3;
gui.image[3*(LCD_WIDTH*y+x)+1] |= 0xC0;
gui.image[3*(LCD_WIDTH*y+x)+2] >>= 3;
break;

default:
// draw as red
gui.image[3*(LCD_WIDTH*y+x)] |= 0xC0;
gui.image[3*(LCD_WIDTH*y+x)+1] >>= 3;
gui.image[3*(LCD_WIDTH*y+x)+2] >>= 3;
break;
}
}
#endif
image->redraw();
Fl::check();
}

memset(gui.pixel_tracking, 0, sizeof(gui.pixel_tracking));
}
} //extern "C"
1 change: 1 addition & 0 deletions src/target/common/emu/fltk.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct Gui {
Fl_Output *final[12];
u32 last_redraw;
u8 image[IMAGE_X*IMAGE_Y*3];
u8 pixel_tracking[IMAGE_X][IMAGE_Y];
#if SCREEN_RESIZE
u8 scaled_img[SCREEN_X*SCREEN_Y*3];
#endif
Expand Down
2 changes: 2 additions & 0 deletions src/target/emu_devo8/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void LCD_DrawPixel(unsigned int color)
gui.image[3*(LCD_WIDTH*gui.y+gui.x)] = r;
gui.image[3*(LCD_WIDTH*gui.y+gui.x)+1] = g;
gui.image[3*(LCD_WIDTH*gui.y+gui.x)+2] = b;

gui.pixel_tracking[gui.x][gui.y]++;
}
// this must be executed to continue drawing in the next row
gui.x++;
Expand Down