32 return (((
size_t)y * presentation->
composite_width) + x) *
sizeof(uint16_t);
57 const uint16_t* pixels,
60 for (uint16_t row = 0U; row < destination->
height; row++) {
64 &pixels[(
size_t)row * destination->
width],
65 (
size_t)destination->
width *
sizeof(uint16_t))) {
94 tile_destination_t destination = {.x = source_x, .y = source_y, .width = width, .height = height};
97 destination.
width = height;
98 destination.
height = width;
101 destination.
x = (uint16_t)(presentation->
panel_height - source_y - height);
102 destination.
y = source_x;
104 destination.
x = (uint16_t)(presentation->
panel_width - source_x - width);
105 destination.
y = (uint16_t)(presentation->
panel_height - source_y - height);
107 destination.
x = source_y;
108 destination.
y = (uint16_t)(presentation->
panel_width - source_x - width);
128 const uint16_t* source,
132 uint16_t output_width)
134 for (uint16_t y = 0U; y < height; y++) {
135 for (uint16_t x = 0U; x < width; x++) {
137 uint16_t destination_x = y;
138 uint16_t destination_y = (uint16_t)(width - 1U - x);
140 destination_x = (uint16_t)(height - 1U - y);
143 destination_x = (uint16_t)(width - 1U - x);
144 destination_y = (uint16_t)(height - 1U - y);
148 rotated[((size_t)destination_y * output_width) + destination_x] =
149 source[((
size_t)y * width) + x];
155 const uint16_t* source,
161 if ((presentation ==
nullptr) || (source ==
nullptr) || (width == 0U) || (height == 0U) ||
162 ((
size_t)source_x + width > presentation->
panel_width) ||
163 ((
size_t)source_y + height > presentation->
panel_height)) {
183 uint16_t*
const pixels = presentation->
scratch;
184 if (pixels ==
nullptr) {
187 uint16_t*
const rotated = &pixels[max_tile_width * max_tile_height];
bool emu_presentation_write(emu_presentation_workspace_t *workspace, size_t offset, const void *bytes, size_t count)
Write exact RGB565 bytes at a checked surface offset.
@ k_emu_presentation_tile_px
Square rotation tile side.
Board-view presentation: frames, composition, input routing, panels.
@ k_rotate_90
90 deg clockwise (-> portrait).
@ k_rotate_270
90 deg counter-clockwise.
@ k_rotate_180
Upside down.
bool priv_emu_view_tile_write(emu_presentation_workspace_t *presentation, const uint16_t *source, uint16_t source_x, uint16_t source_y, uint16_t width, uint16_t height)
Rotate and write one native-panel tile into its exact display location.
static RA8_INTERNAL tile_destination_t internal_tile_destination(const emu_presentation_workspace_t *presentation, uint16_t source_x, uint16_t source_y, uint16_t width, uint16_t height)
Resolve one source tile's placement after panel rotation.
static RA8_INTERNAL size_t internal_row_offset(const emu_presentation_workspace_t *presentation, uint16_t x, uint16_t y)
Return the raw-surface byte offset of one display row.
static RA8_INTERNAL bool internal_write_rows(emu_presentation_workspace_t *presentation, const uint16_t *pixels, const tile_destination_t *destination)
Write one contiguous tile into checked raw-surface rows.
static RA8_INTERNAL void internal_rotate_tile(const emu_presentation_workspace_t *presentation, const uint16_t *source, uint16_t *rotated, uint16_t width, uint16_t height, uint16_t output_width)
Rotate one bounded RGB565 tile into caller scratch.
Internal bounded RGB565 tile rotation/writer.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
One independent owned surface plus non-owning bounded scratch.
uint16_t panel_height
Native panel height.
uint16_t composite_width
Display plus sidebar width.
uint16_t * scratch
Borrowed RGB565 scratch, or nullptr.
uint32_t rotate_deg
Bound display rotation.
uint16_t panel_width
Native panel width.
Rotated tile placement and dimensions.
uint16_t height
Rotated tile height.
uint16_t y
Composite destination row.
uint16_t x
Composite destination column.
uint16_t width
Rotated tile width.