Skip to content

Commit 43e0dca

Browse files
committed
Fix AtomGL PR review feedback
1 parent 0f7fc29 commit 43e0dca

5 files changed

Lines changed: 20 additions & 19 deletions

File tree

dcs_lcd_color.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,16 @@ static inline uint8_t rgba8888_get_alpha(uint32_t color)
4343

4444
static inline uint16_t rgba8888_color_to_rgb565(uint32_t color)
4545
{
46-
uint8_t r = (color >> 24) & 0xFF;
47-
uint8_t g = (color >> 16) & 0xFF;
48-
uint8_t b = (color >> 8) & 0xFF;
46+
uint8_t r = color >> 24;
47+
uint8_t g = color >> 16;
48+
uint8_t b = color >> 8;
4949

5050
return (((uint16_t) (r >> 3)) << 11) | (((uint16_t) (g >> 2)) << 5) | ((uint16_t) b >> 3);
5151
}
5252

5353
static inline uint16_t display_color_to_rgb565(uint32_t color)
5454
{
55-
uint8_t r = (color >> 24) & 0xFF;
56-
uint8_t g = (color >> 16) & 0xFF;
57-
uint8_t b = (color >> 8) & 0xFF;
58-
59-
return (((uint16_t) (r >> 3)) << 11) | (((uint16_t) (g >> 2)) << 5) | ((uint16_t) b >> 3);
55+
return rgba8888_color_to_rgb565(color);
6056
}
6157

6258
static inline uint16_t rgb565_color_to_surface(uint16_t color16)

display_items.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ struct Surface
3535
int width;
3636
int height;
3737
void *buffer;
38-
uint32_t fg_color; // RGBA8888 little-endian byte order with the
39-
// alpha byte cleared; ORed with the per-pixel
40-
// alpha in epd_draw_pixel.
38+
uint32_t fg_color; // RGB bytes in 0x00BBGGRR order; alpha is cleared
39+
// so epd_draw_pixel can append per-pixel alpha.
4140
};
4241

4342
#define BPP 4

display_task.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ static bool try_pre_ack_render_cmd(Message *message, Context *ctx)
4949
if (cmd != globalcontext_make_atom(ctx->global, "\x6" "update")
5050
&& cmd != globalcontext_make_atom(ctx->global, "\xD" "update_region")
5151
&& cmd != globalcontext_make_atom(ctx->global, "\xF" "draw_rgb565_raw")
52+
&& cmd != globalcontext_make_atom(ctx->global, "\x16" "draw_rgb565_rle_base64")
53+
&& cmd != globalcontext_make_atom(ctx->global, "\x1D" "draw_rgb565_rle_base64_scaled")
5254
&& cmd != globalcontext_make_atom(ctx->global,
5355
"\xB" "draw_buffer")) {
5456
return false;

docs/display-drivers.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ supported drivers:
386386
### update_region
387387

388388
Partially updates a rectangular region of the display without redrawing the entire
389-
screen. Useful for incremental UI updates like progress bars or dynamic text fields
390-
where a full-screen redraw is unnecessary.
389+
screen. This is a compatibility workaround for partial refreshes until a richer
390+
display-list damage tracker is available. It is useful for incremental UI updates
391+
like progress bars or dynamic text fields where a full-screen redraw is unnecessary.
391392

392393
```elixir
393394
# Update only a 200×100 region at (50, 40)
@@ -398,7 +399,8 @@ where a full-screen redraw is unnecessary.
398399

399400
Draws raw RGB565 binary pixel data directly to the display. Each pixel is 2 bytes
400401
in little-endian RGB565 format. The binary must contain exactly `width × height × 2`
401-
bytes.
402+
bytes. This is a low-level direct-buffer path for preformatted RGB565 data; the
403+
regular image tuple API remains the preferred route for encoded image assets.
402404

403405
```elixir
404406
# Draw a 100×100 pre-formatted RGB565 image at (10, 10)

rgb_lcd_display_driver.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* This file is part of AtomGL.
33
*
44
* Copyright 2026 AtomGL contributors
5+
* Copyright 2026 Ibrahim YILMAZ <ibrahim@drlinux.org>
56
*
67
* Licensed under the Apache License, Version 2.0 (the "License");
78
* you may not use this file except in compliance with the License.
@@ -528,11 +529,12 @@ static void do_update_region(Context *ctx, int x0, int y0, int width, int height
528529
memcpy(driver->framebuffers[work_fb], active_fb, fb_bytes);
529530
}
530531
if (render_items_to_framebuffer(driver, work_fb, x0, y0, width, height, items, len)) {
531-
esp_err_t err = switch_to_framebuffer(driver, work_fb);
532-
if (err != ESP_OK) {
533-
ESP_LOGE(TAG, "region framebuffer switch failed: %s", esp_err_to_name(err));
534-
} else {
535-
mirror_region_from_active_to_inactive_framebuffers(driver, x0, y0, width, height);
532+
esp_err_t err = switch_to_framebuffer(driver, work_fb);
533+
if (err != ESP_OK) {
534+
ESP_LOGE(TAG, "region framebuffer switch failed: %s", esp_err_to_name(err));
535+
} else {
536+
mirror_region_from_active_to_inactive_framebuffers(driver, x0, y0, width, height);
537+
}
536538
}
537539
}
538540
display_items_delete(items, len);

0 commit comments

Comments
 (0)