summaryrefslogtreecommitdiff
path: root/shared-module/displayio/Display.h
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2019-06-06 15:11:02 -0700
committerScott Shawcroft <scott@tannewt.org>2019-06-12 11:32:39 -0700
commiteb21fc3e31790cee094d5c11811b55a57625340a (patch)
treee45c5dac67e7369dbff9c56c444d4c50984e7c27 /shared-module/displayio/Display.h
parenta06a97e2cba36233d229ba44c3acd9007affe1c9 (diff)
Add partial display update support.
Different operations to the display tree have different costs. Be aware of these costs when optimizing your code. * Changing tiles indices in a TileGrid will update an area covering them all. * Changing a palette will refresh every object that references it. * Moving a TileGrid will update both where it was and where it moved to. * Adding something to a Group will refresh each individual area it covers. * Removing things from a Group will refresh one area that covers all previous locations. (Not separate areas like add.) * Setting a new top level Group will refresh the entire display. Only TileGrid moves are optimized for overlap. All other overlaps cause sending of duplicate pixels. This also adds flip_x, flip_y and transpose_xy to TileGrid. They change the direction of the pixels but not the location. Fixes #1169. Fixes #1705. Fixes #1923.
Diffstat (limited to 'shared-module/displayio/Display.h')
-rw-r--r--shared-module/displayio/Display.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/shared-module/displayio/Display.h b/shared-module/displayio/Display.h
index 52f98a252..687e412c2 100644
--- a/shared-module/displayio/Display.h
+++ b/shared-module/displayio/Display.h
@@ -31,6 +31,8 @@
#include "shared-bindings/displayio/Group.h"
#include "shared-bindings/pulseio/PWMOut.h"
+#include "shared-module/displayio/area.h"
+
typedef bool (*display_bus_begin_transaction)(mp_obj_t bus);
typedef void (*display_bus_send)(mp_obj_t bus, bool command, uint8_t *data, uint32_t data_length);
typedef void (*display_bus_end_transaction)(mp_obj_t bus);
@@ -61,12 +63,16 @@ typedef struct {
uint64_t last_backlight_refresh;
bool auto_brightness:1;
bool updating_backlight:1;
- bool mirror_x;
- bool mirror_y;
- bool transpose_xy;
+ bool full_refresh; // New group means we need to refresh the whole display.
+ displayio_buffer_transform_t transform;
+ displayio_area_t area;
} displayio_display_obj_t;
+void displayio_display_start_refresh(displayio_display_obj_t* self);
+const displayio_area_t* displayio_display_get_refresh_areas(displayio_display_obj_t *self);
+bool displayio_display_fill_area(displayio_display_obj_t *self, displayio_area_t* area, uint32_t* mask, uint32_t *buffer);
void displayio_display_update_backlight(displayio_display_obj_t* self);
+bool displayio_display_clip_area(displayio_display_obj_t *self, const displayio_area_t* area, displayio_area_t* clipped);
void release_display(displayio_display_obj_t* self);
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_DISPLAY_H