libjade: use existing frame buffer rectangle drawing
What changed, and why it matters
This commit removes a custom bitmap-drawing function used only in the libjade build and makes that build use the same drawing path as other configurations. It is a code cleanup with no visible security relevance.
No security action required; treat as routine refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change deletes display_libjade_draw_bitmap() and its declaration, and removes the CONFIG_LIBJADE branch in display.c that called it. The libjade build now falls through to display_hw_draw_bitmap(), the same function used by the non-libjade build. The removed function copied pixel rows into the frame buffer using jmemcpy, but there is no evidence in the commit that it had bounds-checking bugs or that the replacement fixes a security defect.
Changed components
main/display.cmain/display_hw.cmain/display_hw.hInspect captured patch +0 / −25
diff --git a/main/display.c b/main/display.c
index bb0d10c..5912556 100644
--- a/main/display.c
+++ b/main/display.c
@@ -55,8 +55,6 @@ static inline void draw_bitmap(int x, int y, int w, int h, const uint16_t* color
#if defined(CONFIG_HAS_CAMERA)
qemu_draw_bitmap(x, y, w, h, color_data);
#endif
-#elif defined(CONFIG_LIBJADE)
- display_libjade_draw_bitmap(x, y, w, h, color_data);
#else
display_hw_draw_bitmap(x, y, w, h, color_data);
#if BUF_N > 1
diff --git a/main/display_hw.c b/main/display_hw.c
index 2fbb4c1..dec0c68 100644
--- a/main/display_hw.c
+++ b/main/display_hw.c
@@ -318,26 +318,6 @@ inline void display_hw_draw_bitmap(int x, int y, int w, int h, const uint16_t* c
#endif
}
-#ifdef CONFIG_LIBJADE
-inline void display_libjade_draw_bitmap(int x, int y, int w, int h, const uint16_t* color_data)
-{
- JADE_ASSERT(color_data);
- const int calculatedx = x - CONFIG_DISPLAY_OFFSET_X;
- const int calculatedy = y - CONFIG_DISPLAY_OFFSET_Y;
-
- // copy one line at the time
- const int data_stride = w * sizeof(uint16_t);
- uint16_t* screen_ptr = &disp_buf[calculatedx + calculatedy * CONFIG_DISPLAY_WIDTH];
- const uint16_t* data_ptr = color_data;
-
- for (int k = 0; k < h; ++k) {
- jmemcpy(screen_ptr, data_ptr, data_stride);
- screen_ptr += CONFIG_DISPLAY_WIDTH;
- data_ptr += w;
- }
-}
-#endif
-
#ifdef CONFIG_DISPLAY_FULL_FRAME_BUFFER
inline void display_hw_draw_rect(int x, int y, int w, int h, const uint16_t color)
{
diff --git a/main/display_hw.h b/main/display_hw.h
index bf86e8d..55d0d8a 100644
--- a/main/display_hw.h
+++ b/main/display_hw.h
@@ -5,9 +5,6 @@
void display_hw_init(TaskHandle_t* gui_handle);
bool display_hw_flip_orientation(bool flipped_orientation);
void display_hw_draw_bitmap(int x, int y, int w, int h, const uint16_t* color_data);
-#ifdef CONFIG_LIBJADE
-void display_libjade_draw_bitmap(int x, int y, int w, int h, const uint16_t* color_data);
-#endif
#ifdef CONFIG_DISPLAY_FULL_FRAME_BUFFER
void display_hw_flush(void);
void display_hw_draw_rect(int x, int y, int w, int h, const uint16_t color_data);
Why this scored 12/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.