55static const char*
const s_tag =
"zoom_render";
79typedef enum : uint8_t {
111 const int32_t scale = (int32_t)v->
scale;
116 const int32_t base = (int32_t)ax->
s0;
117 for (int32_t d = ax->
d0; d < ax->d1; ++d) {
118 const int32_t si = ((v->
anchor_x + d) / scale) - base;
160 const int32_t scale = (int32_t)v->
scale;
161 const int32_t height = (int32_t)v->
src.
height;
162 const int32_t sy = (plane_y >= 0) ? (plane_y / scale) : -1;
168 const bool covered = (sy >= 0) && (sy < height);
172 if (sy != *cached_sy) {
225 const size_t stride = (size_t)v->
dst.
w;
227 if (ax->
count == 0U) {
232 for (int32_t r = 0; r < rows; ++r) {
276 uint32_t packed_len = 0U;
346 const int32_t rows_max = (int32_t)v->
strip_rows;
347 int32_t cached_sy = -1;
348 for (int32_t top = 0; top < v->
dst.
h; top += rows_max) {
349 int32_t rows = v->
dst.
h - top;
350 if (rows > rows_max) {
static const char * s_tag
Logging / check tag.
Annotation-attribute framework macros for ra8-firmware.
#define RA8_INTERNAL
Marker that a function is intended to be static (file-local).
Validation and Error-Checking Macros for ra8-firmware.
#define RA8_RETURN_ON_ERROR(err, tag, message)
Early return on error, propagating the code upward.
#define RA8_CHECK_NULL_PTR(ptr, tag, message)
Reject nullptr pointer, returning k_ra8_err_null_ptr.
Error Code Definitions for ra8-firmware.
@ k_ra8_err_invalid_state
Module in wrong state for requested operation.
@ k_ra8_ok
Success – operation completed with all postconditions satisfied.
ra8_err_codes_t ra8_err_t
Canonical error-return type used by every ra8-firmware API.
void * memset(void *dst, int value, size_t n)
Fill memory with a constant byte value.
Software 2D graphics primitives layered on top of a caller-ownedframebuffer (DRW / D/AVE 2D / GLCDC r...
ra8_err_t ra8_gfx_blit_gray4_zoom(const uint8_t *src, int32_t src_w, int32_t src_h, int32_t sx, int32_t sy, int32_t sw, int32_t sh, int32_t zoom, int32_t dst_x, int32_t dst_y)
Nearest-neighbour integer-zoom blit of a sub-rectangle of a packed 4-bit grayscale image into the fra...
Void-and-cluster blue-noise dithering: continuous-tone gray8 -> 16-level panel (#477).
ra8_err_t ra8_gfx_dither_gray8_to_gray4(const uint8_t *src, int32_t w, int32_t h, int32_t origin_x, int32_t origin_y, uint8_t *out, uint32_t out_cap, uint32_t *out_size)
Dither a gray8 tile to packed 4-bpp nibbles (panel-native), seamlessly.
#define ra8_log_error_val(tag, message, value)
RA8 log error val.
#define ra8_log_error(tag, message)
RA8 log error.
int32_t w
Width (pixels, >= 0).
int32_t h
Height (pixels, >= 0).
int32_t x
Left edge (pixels).
int32_t y
Top edge (pixels).
One axis of the viewport resolved against the image: coverage + source span.
uint32_t count
Source indices feeding the covered span (0 if none).
uint32_t s0
First source index feeding the covered span.
int32_t d0
First covered destination offset inside the viewport.
uint8_t * packed
The strip packed to 4 bpp (2 px/byte).
uint8_t * row
One source row, >= dst.w bytes.
uint32_t packed_cap
Capacity of packed, bytes.
uint8_t * strip
gray8 destination strip, dst.w * strip_rows.
uint32_t height
Full-resolution source height, pixels.
uint32_t width
Full-resolution source width, pixels.
zoom_read_fn read
gray8 sub-rectangle reader (never NULL once bound).
void * ctx
Opaque context handed back to read.
Live viewport: where it is looking, how magnified, and what it owes the panel.
uint8_t scale
Current integer magnification.
zoom_source_t src
Bound source.
zoom_scratch_t scratch
Caller-owned composite buffers.
ra8_ui_rect_t dst
Viewport in framebuffer pixels.
uint16_t strip_rows
Destination rows per composite strip.
int32_t anchor_y
Plane row shown at dst.y.
bool active
The view is open.
int32_t anchor_x
Plane column shown at dst.x.
void priv_zoom_axis(int32_t anchor, int32_t extent, int32_t scale, int32_t src_dim, zoom_axis_t *out)
Resolve one viewport axis against the image at the current magnification.
Tap-to-zoom image viewer: viewport state machine + tiled magnifying render (#478).
@ k_zoom_bg_gray
Letterbox fill level (on-palette white).
Module-private seam shared by the zoom state machine and its render.
static ra8_err_t internal_emit_strip(zoom_view_t *v, const zoom_axis_t *ax, int32_t top, int32_t rows, int32_t *cached_sy)
One strip, end to end: magnify, re-dither at plane phase, blit.
static ra8_err_t internal_fill_row(zoom_view_t *v, const zoom_axis_t *ax, int32_t plane_y, uint8_t *drow, int32_t *cached_sy)
Composite one destination row: decide coverage, fault, replicate.
static ra8_err_t internal_fill_strip(zoom_view_t *v, const zoom_axis_t *ax, int32_t top, int32_t rows, int32_t *cached_sy)
Build one gray8 destination strip: background fill, then per-row composite.
static ra8_err_t internal_render_ready(const zoom_view_t *v)
Whether a view is in a state that can be composited at all.
static void internal_expand_row(const zoom_view_t *v, const zoom_axis_t *ax, uint8_t *drow)
Replicate one source row across the covered destination columns.
ra8_err_t zoom_view_render(zoom_view_t *v)
Composite the visible window into the bound ra8_gfx framebuffer.
zoom_blit_t
Fixed arguments of the per-strip packed-gray4 blit.
@ k_zoom_blit_origin
Sub-rect origin inside the packed strip.
@ k_zoom_blit_native
Blit magnification (the strip is already sized).