|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Tap-to-zoom demo scene: page sampler, viewports, chrome, self-check. More...
#include "ez_scene.h"#include <stddef.h>#include <stdint.h>#include "ra8_check.h"#include "ra8_err.h"#include "ra8_gfx.h"#include "ra8_tile_cache.h"#include "ra8_ui.h"#include "zoom.h"#include "zoom_tiles.h"Go to the source code of this file.
Enumerations | |
| enum | ez_tone_t : uint32_t { k_ez_bg_lo = 140U , k_ez_grad_shift = 4U , k_ez_grad_mask = 63U , k_ez_grad_wrap = 127U , k_ez_ink = 24U , k_ez_rule_mask = 31U , k_ez_rule_thick = 3U , k_ez_word_shift = 5U , k_ez_word_mask = 7U , k_ez_word_blank = 7U } |
| Gray8 tones and the shift/mask geometry of the procedural page. More... | |
| enum | ez_chrome_t : uint32_t { k_ez_col_bar = 0x00222222U , k_ez_col_ind = 0x00DDDDDDU , k_ez_col_dim = 0x00555555U , k_ez_col_lens = 0x00000000U } |
| Chrome colours, in the 0x00RRGGBB space ra8_gfx down-converts from. More... | |
| enum | ez_fnv_t : uint32_t { k_ez_fnv_offset = 2166136261U , k_ez_fnv_prime = 16777619U } |
| FNV-1a-32 parameters. More... | |
| enum | ez_selftest_step_t : uint16_t { k_ez_st_focus_x = 700U , k_ez_st_focus_y = 400U , k_ez_st_scale = 2U , k_ez_st_t0 = 0U } |
| The scripted self-check's fixed inputs. More... | |
Functions | |
| uint8_t | ez_page_sample (uint32_t x, uint32_t y) |
| Sample the procedural full-resolution page at one pixel. | |
| static void | ez_fill_tile (uint8_t *cell, uint32_t org_x, uint32_t org_y) |
| Write one whole tile's pixels from the procedural page sampler. | |
| ra8_err_t | ez_tile_decode (void *ctx, const ra8_tile_key_t *key, uint8_t *cell, uint32_t cell_bytes, uint16_t *out_w, uint16_t *out_h) |
| ra8_tile_decode_fn that materialises one page tile from the sampler. | |
| ra8_ui_rect_t | ez_content_rect (int32_t fb_w, int32_t fb_h) |
| The content rectangle: the panel less the status bar. | |
| static ra8_ui_rect_t | ez_lens_rect (ra8_ui_rect_t content) |
| The loupe box: a square centred in the content rectangle. | |
| static zoom_scratch_t | ez_scratch_of (const ez_scene_cfg_t *cfg) |
| Build the shared composite-scratch descriptor from a configuration. | |
| static ra8_err_t | ez_cfg_scratch_ok (const ez_scene_cfg_t *cfg) |
| Validate the three composite-scratch pointers. | |
| static ra8_err_t | ez_cfg_ptrs_ok (const ez_scene_cfg_t *cfg) |
| Validate the borrowed storage a scene configuration must carry. | |
| static ra8_err_t | ez_open_views (ez_scene_t *s, const ez_scene_cfg_t *cfg) |
| Open both viewports over the bound page source. | |
| static ra8_err_t | ez_bind_page (ez_scene_t *s, const ez_scene_cfg_t *cfg) |
| Wire the tile cache over the borrowed storage and bind it as a source. | |
| ra8_err_t | ez_scene_init (ez_scene_t *s, const ez_scene_cfg_t *cfg) |
| Wire the tile cache, the tiled source and both viewports. | |
| ez_zone_t | ez_zone_hit (const ez_scene_t *s, int32_t x, int32_t y) |
| Classify a tap by the zone it lands in. | |
| static bool | ez_apply_pan (ez_scene_t *s, ez_zone_t zone, uint32_t now_ms) |
| Apply a pan zone to the page viewport. | |
| bool | ez_scene_tap (ez_scene_t *s, int32_t x, int32_t y, uint32_t now_ms) |
| Apply a tap to the scene. | |
| static ra8_err_t | ez_draw_status (const ez_scene_t *s) |
| Paint the status bar and its block zoom indicator. | |
| static ra8_err_t | ez_draw_lens_chrome (ra8_ui_rect_t lens) |
| Paint the loupe's border so the lens reads as a lens, not a seam. | |
| ra8_err_t | ez_scene_render (ez_scene_t *s) |
| Repaint the content area, the loupe (when open) and the status bar. | |
| static void | ez_choose_plan (const ez_scene_t *s, const zoom_present_t *page_plan, const zoom_present_t *lens_plan, ez_present_t *out) |
| Pick the flush rectangle from the two views' drained plans. | |
| ra8_err_t | ez_scene_present (ez_scene_t *s, ez_present_t *out) |
| Take the pending flush plan for whichever view changed. | |
| bool | ez_scene_tick (ez_scene_t *s, uint32_t now_ms) |
| Advance both views' settle timers; report whether a repaint is due. | |
| ra8_err_t | ez_scene_prefetch (ez_scene_t *s, zoom_pan_t dir, uint16_t *out_warmed) |
| Warm the tiles one pan step ahead of the page viewport. | |
| uint32_t | ez_fnv1a (const void *buf, uint32_t len) |
| FNV-1a-32 over a byte range (the framebuffer hash). | |
| static ra8_err_t | ez_render_and_hash (ez_scene_t *s, uint32_t *out_hash) |
| Render the scene and hash the framebuffer it produced. | |
| static ra8_err_t | ez_selftest_pan (ez_scene_t *s, ez_selftest_t *out) |
| Self-check stage 2: one right-pan step at 1:1, with read-ahead. | |
| static ra8_err_t | ez_selftest_zoom (ez_scene_t *s, ez_selftest_t *out) |
| Self-check stage 3: 2x about a fixed panel point. | |
| static ra8_err_t | ez_selftest_lens (ez_scene_t *s, ez_selftest_t *out) |
| Self-check stage 4: open the loupe over the magnified page. | |
| static ra8_err_t | ez_selftest_stages (ez_scene_t *s, ez_selftest_t *out) |
| Run the four scripted self-check stages in order. | |
| ra8_err_t | ez_scene_selftest (ez_scene_t *s, ez_selftest_t *out) |
| Drive the scene through the scripted boot self-check. | |
Variables | |
| static const char *const | s_tag = "ereader_zoom" |
| Component tag for RA8_CHECK_* log lines. | |
Tap-to-zoom demo scene: page sampler, viewports, chrome, self-check.
Implements ez_scene.h. Every pixel this file puts on the panel comes from integer arithmetic – the procedural page sampler, the zoom composite, and filled rectangles for the chrome – so the framebuffer hash it reports is the same number on the unit-test host, in ra8_emulator, and on silicon.
Definition in file ez_scene.c.
| enum ez_chrome_t : uint32_t |
Chrome colours, in the 0x00RRGGBB space ra8_gfx down-converts from.
Grey levels on the panel's 16-level palette (multiples of 17 replicated across the three channels) so the chrome never dithers.
| Enumerator | |
|---|---|
| k_ez_col_bar | Status-bar fill. |
| k_ez_col_ind | Lit zoom-indicator block. |
| k_ez_col_dim | Unlit zoom-indicator block. |
| k_ez_col_lens | Loupe border. |
Definition at line 112 of file ez_scene.c.
| enum ez_fnv_t : uint32_t |
FNV-1a-32 parameters.
The standard 32-bit offset basis and prime; named so the hash is not two unexplained constants in the middle of a loop.
| Enumerator | |
|---|---|
| k_ez_fnv_offset | FNV-1a-32 offset basis. |
| k_ez_fnv_prime | FNV-1a-32 prime. |
Definition at line 132 of file ez_scene.c.
| enum ez_selftest_step_t : uint16_t |
The scripted self-check's fixed inputs.
Held as named constants so the app, the host twin and hil.conf cannot drift on "which pan, which focus point": the sequence is part of the golden, not an incidental of whoever wrote the test.
Definition at line 151 of file ez_scene.c.
| enum ez_tone_t : uint32_t |
Gray8 tones and the shift/mask geometry of the procedural page.
The background is a triangle wave whose full cycle is (1 << k_ez_grad_shift) * (k_ez_grad_wrap + 1) = 2048 px along the diagonal – a 64-level swing across roughly a screen, which a 16-level panel would band visibly without the blue-noise dither, and which is exactly what the demo is showing. A triangle rather than a sawtooth because a sawtooth's wrap is a genuine tone discontinuity in the source and would be mistaken for the artefact. The rules are 3 px tall on a 32 px pitch with one blank run in eight, so at 1:1 they read as texture and at 4x as structure.
| Enumerator | |
|---|---|
| k_ez_bg_lo | Darkest background tone. |
| k_ez_grad_shift | Pixels per gradient step (1 << shift). |
| k_ez_grad_mask | Gradient span above k_ez_bg_lo. |
| k_ez_grad_wrap | Triangle-wave period - 1 (2 * span + 1). |
| k_ez_ink | Rule (text) tone. |
| k_ez_rule_mask | Rule pitch - 1, rows. |
| k_ez_rule_thick | Rule thickness, rows. |
| k_ez_word_shift | Word run length (1 << shift), columns. |
| k_ez_word_mask | Words per group - 1 (one blank per group). |
| k_ez_word_blank | Group index left blank (the inter-word gap). |
Definition at line 86 of file ez_scene.c.
|
static |
Apply a pan zone to the page viewport.
| [in,out] | s | Initialised scene. |
| [in] | zone | A pan zone (any other zone is a no-op). |
| [in] | now_ms | Current millisecond timestamp. |
| true | The page panned; a redraw is due. |
| false | The pan clamped against an edge, or the zone was not a pan. |
s was initialised by ez_scene_init. now_ms comes from a monotonic millisecond source. Definition at line 496 of file ez_scene.c.
References ez_scene_prefetch(), k_ez_zone_pan_down, k_ez_zone_pan_left, k_ez_zone_pan_right, k_ez_zone_pan_up, k_ra8_ok, k_zoom_pan_down, k_zoom_pan_left, k_zoom_pan_none, k_zoom_pan_right, k_zoom_pan_up, ez_scene_t::page, ra8_ui_rect_t::x, ra8_ui_rect_t::y, zoom_view_pan_dir(), and zoom_view_window().
Referenced by ez_scene_tap().
|
static |
Wire the tile cache over the borrowed storage and bind it as a source.
Split out of ez_scene_init so that function reads as "validate, lay out, bind the page, open the views". The tile grid is derived by zoom_tile_src_init from the page extent rather than passed in, so it cannot disagree with the geometry it is meant to cover.
| [in,out] | s | Scene whose layout is already computed. |
| [in] | cfg | Validated configuration supplying the cache storage. |
| k_ra8_ok | s->src is a bound, magnifiable page. |
| k_ra8_err_* | Propagated from the tile cache or the tiled adapter. |
cfg passed ez_cfg_ptrs_ok. s holds no usable source. Definition at line 403 of file ez_scene.c.
References ez_scene_cfg_t::buckets, ez_scene_t::cache, ez_scene_cfg_t::cell_mem, ez_scene_cfg_t::dims, ez_tile_decode(), k_ez_buckets, k_ez_cell_bytes, k_ez_cells, k_ez_image_id, k_ez_page_h, k_ez_page_w, k_ez_tile_edge, ez_scene_cfg_t::keys, ez_scene_cfg_t::meta, RA8_RETURN_ON_ERROR, ra8_tile_cache_init(), s_tag, ez_scene_t::src, ez_scene_t::tiles, zoom_tile_src_bind(), and zoom_tile_src_init().
Referenced by ez_scene_init().
|
static |
Validate the borrowed storage a scene configuration must carry.
| [in] | cfg | Candidate configuration (already known non-NULL). |
| k_ra8_ok | Every pointer is present. |
| k_ra8_err_null_ptr | One is missing; the log line names it. |
cfg is non-NULL. cfg has been published into a scene yet. Definition at line 329 of file ez_scene.c.
References ez_scene_cfg_t::buckets, ez_scene_cfg_t::cell_mem, ez_scene_cfg_t::dims, ez_cfg_scratch_ok(), ez_scene_cfg_t::fb, ez_scene_cfg_t::keys, ez_scene_cfg_t::meta, RA8_CHECK_NULL_PTR, and s_tag.
Referenced by ez_scene_init().
|
static |
Validate the three composite-scratch pointers.
The second half of ez_cfg_ptrs_ok, split only so each stays inside the project's function-size bar – every RA8_CHECK_NULL_PTR is several statements once expanded, so eight of them in one function is over the ceiling on their own.
| [in] | cfg | Candidate configuration (already known non-NULL). |
| k_ra8_ok | All three scratch pointers are present. |
| k_ra8_err_null_ptr | One is missing; the log line names it. |
cfg is non-NULL. Definition at line 308 of file ez_scene.c.
References k_ra8_ok, ez_scene_cfg_t::packed, RA8_CHECK_NULL_PTR, ez_scene_cfg_t::row, s_tag, and ez_scene_cfg_t::strip.
Referenced by ez_cfg_ptrs_ok().
|
static |
Pick the flush rectangle from the two views' drained plans.
The page wins when it owes anything, because the loupe is drawn over page pixels and a page repaint therefore damages the lens box too. Only when the page owes nothing does a loupe-only change get to ask for the small rectangle – which is the partial-update case the demo exists to show.
| [in] | s | Initialised scene. |
| [in] | page_plan | The page view's drained plan. |
| [in] | lens_plan | The loupe's drained plan. |
| [out] | out | Receives the scene-level plan. |
out addresses writable storage. Definition at line 655 of file ez_scene.c.
References ez_scene_t::content, ez_lens_rect(), k_zoom_refresh_quality, ez_scene_t::lens_on, ez_present_t::present, zoom_present_t::present, ez_present_t::quality, ez_present_t::rect, and zoom_present_t::refresh.
Referenced by ez_scene_present().
|
nodiscard |
The content rectangle: the panel less the status bar.
| [in] | fb_w | Framebuffer width, pixels. |
| [in] | fb_h | Framebuffer height, pixels. |
| {0, k_ez_status_h, fb_w, fb_h - k_ez_status_h} | Always. |
fb_h exceeds k_ez_status_h. fb_w is positive. Definition at line 232 of file ez_scene.c.
References k_ez_status_h.
Referenced by ez_scene_init(), and main().
|
static |
Paint the loupe's border so the lens reads as a lens, not a seam.
| [in] | lens | The lens rectangle. |
| k_ra8_ok | The border is painted. |
| k_ra8_err_* | Propagated from ra8_gfx_rect. |
lens lies inside the framebuffer. lens is written. Definition at line 609 of file ez_scene.c.
References ra8_ui_rect_t::h, k_ez_col_lens, k_ez_lens_border, k_ra8_ok, ra8_gfx_rect(), RA8_RETURN_ON_ERROR, s_tag, ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by ez_scene_render().
|
static |
Paint the status bar and its block zoom indicator.
| [in] | s | Initialised scene. |
| k_ra8_ok | The bar is painted. |
| k_ra8_err_* | Propagated from ra8_gfx_rect. |
s was initialised by ez_scene_init. Definition at line 573 of file ez_scene.c.
References ez_scene_t::fb_w, k_ez_col_bar, k_ez_col_dim, k_ez_col_ind, k_ez_ind_block, k_ez_ind_gap, k_ez_page_scale_max, k_ez_status_h, k_ra8_ok, ez_scene_t::page, ra8_gfx_rect(), RA8_RETURN_ON_ERROR, s_tag, and zoom_view_t::scale.
Referenced by ez_scene_render().
|
static |
Write one whole tile's pixels from the procedural page sampler.
Split out of ez_tile_decode so the decode entry point is its five precondition checks and nothing else. The offset is computed in size_t because a tile index times the tile edge is a pointer offset, and doing that arithmetic in 32 bits before the implicit widening is how a large image silently wraps.
| [out] | cell | Destination cell, at least k_ez_cell_bytes writable bytes. |
| [in] | org_x | Tile origin column in page pixels. |
| [in] | org_y | Tile origin row in page pixels. |
cell addresses at least k_ez_cell_bytes writable bytes. cell); otherwise pure. Definition at line 194 of file ez_scene.c.
References ez_page_sample(), and k_ez_tile_edge.
Referenced by ez_tile_decode().
|
nodiscard |
FNV-1a-32 over a byte range (the framebuffer hash).
| [in] | buf | Bytes to hash (NULL hashes nothing). |
| [in] | len | Byte count. |
| 2166136261 | buf is NULL or len is 0 (the FNV offset basis). |
| digest | Otherwise, the hash of the range. |
buf addresses at least len readable bytes. Definition at line 712 of file ez_scene.c.
References k_ez_fnv_offset, and k_ez_fnv_prime.
Referenced by ez_render_and_hash().
|
static |
The loupe box: a square centred in the content rectangle.
| [in] | content | The content rectangle. |
| centred square | Always k_ez_lens_edge on a side. |
content is at least k_ez_lens_edge on both axes. content is the rectangle the page view paints. content. Definition at line 255 of file ez_scene.c.
References ra8_ui_rect_t::h, k_ez_lens_edge, ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by ez_choose_plan(), ez_open_views(), ez_scene_render(), and ez_zone_hit().
|
static |
Open both viewports over the bound page source.
| [in,out] | s | Scene whose cache and source are already wired. |
| [in] | cfg | Scene configuration (for the scratch buffers). |
| k_ra8_ok | Both views are open and owe a quality flush. |
| k_ra8_err_* | Propagated from zoom_view_open. |
Definition at line 354 of file ez_scene.c.
References ez_scene_t::content, ez_lens_rect(), ez_scratch_of(), k_ez_lens_scale_max, k_ez_lens_scale_min, k_ez_page_scale_max, k_zoom_policy_responsive, k_zoom_scale_min, ez_scene_t::lens, ez_scene_t::page, RA8_RETURN_ON_ERROR, s_tag, ez_scene_t::src, and zoom_view_open().
Referenced by ez_scene_init().
|
nodiscard |
Sample the procedural full-resolution page at one pixel.
A page of "text": a repeating smooth gradient (which only a dither can render on a 16-level panel without banding) overlaid with 3 px rules broken into word-like runs (which only full-resolution magnification can resolve). Every operation is a shift or a mask, so decoding a 256x256 tile is cheap enough to stay inside the emulator's boot budget.
| [in] | x | Source column, < k_ez_page_w. |
| [in] | y | Source row, < k_ez_page_h. |
| ink | The pixel falls on an inked rule (a dark constant). |
| background | Otherwise, the gradient value at (x, y). |
x and y are inside the page (the caller is the tile decoder). Definition at line 158 of file ez_scene.c.
References k_ez_bg_lo, k_ez_grad_mask, k_ez_grad_shift, k_ez_grad_wrap, k_ez_ink, k_ez_rule_mask, k_ez_rule_thick, k_ez_word_blank, k_ez_word_mask, and k_ez_word_shift.
Referenced by ez_fill_tile().
|
static |
Render the scene and hash the framebuffer it produced.
| [in,out] | s | Initialised scene. |
| [out] | out_hash | Receives the FNV-1a-32 of the whole framebuffer. |
| k_ra8_ok | The frame was painted and hashed. |
| k_ra8_err_* | Propagated from ez_scene_render or ra8_gfx. |
out_hash is writable. Definition at line 740 of file ez_scene.c.
References ez_fnv1a(), ez_scene_present(), ez_scene_render(), ez_scene_t::fb, ez_scene_t::fb_bytes, k_ra8_ok, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ez_selftest_lens(), ez_selftest_pan(), ez_selftest_stages(), and ez_selftest_zoom().
|
nodiscard |
Wire the tile cache, the tiled source and both viewports.
| [out] | s | Scene to populate. |
| [in] | cfg | Borrowed storage and framebuffer geometry. |
| k_ra8_ok | The scene is ready to render. |
| k_ra8_err_null_ptr | s, cfg, or a required storage pointer is NULL. |
| k_ra8_err_invalid_arg | The framebuffer is too small for the layout. |
| k_ra8_err_* | Propagated from the cache or the zoom engine. |
cfg outlives the scene. Definition at line 430 of file ez_scene.c.
References ez_scene_t::content, ez_bind_page(), ez_cfg_ptrs_ok(), ez_content_rect(), ez_open_views(), ez_scene_cfg_t::fb, ez_scene_t::fb, ez_scene_cfg_t::fb_bytes, ez_scene_t::fb_bytes, ez_scene_cfg_t::fb_h, ez_scene_t::fb_h, ez_scene_cfg_t::fb_w, ez_scene_t::fb_w, k_ez_lens_edge, k_ez_status_h, k_ra8_err_invalid_arg, ez_scene_t::lens_on, RA8_CHECK_NULL_PTR, ra8_log_error, RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ez_setup_scene().
|
nodiscard |
Warm the tiles one pan step ahead of the page viewport.
| [in,out] | s | Initialised scene. |
| [in] | dir | Direction of travel. |
| [out] | out_warmed | Tiles warmed (may be NULL). |
| k_ra8_ok | The read-ahead sweep ran. |
| k_ra8_err_null_ptr | s is NULL. |
| k_ra8_err_* | Propagated from zoom_tiles_prefetch. |
s was initialised by ez_scene_init. Definition at line 705 of file ez_scene.c.
References zoom_tile_src_t::cache, k_ez_prefetch_max, ez_scene_t::page, RA8_CHECK_NULL_PTR, s_tag, ez_scene_t::tiles, and zoom_tiles_prefetch().
Referenced by ez_apply_pan(), and ez_selftest_pan().
|
nodiscard |
Take the pending flush plan for whichever view changed.
A page change dirties the whole content rectangle; a loupe-only change dirties only the lens box, which is the partial-update case this demo exists to show. A view that owes nothing contributes nothing, so an idle reader never refreshes the panel.
| [in,out] | s | Initialised scene. |
| [out] | out | Receives the plan; out->present is false when none is owed. |
| k_ra8_ok | out holds the plan. |
| k_ra8_err_null_ptr | s or out is NULL. |
| k_ra8_err_* | Propagated from zoom_view_present. |
s was initialised by ez_scene_init. Definition at line 677 of file ez_scene.c.
References ez_choose_plan(), k_ra8_ok, ez_scene_t::lens, ez_scene_t::page, RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, s_tag, and zoom_view_present().
Referenced by ez_redraw(), and ez_render_and_hash().
|
nodiscard |
Repaint the content area, the loupe (when open) and the status bar.
| [in,out] | s | Initialised scene. |
| k_ra8_ok | The framebuffer holds the current scene. |
| k_ra8_err_null_ptr | s is NULL. |
| k_ra8_err_* | Propagated from zoom_view_render or ra8_gfx. |
s was initialised by ez_scene_init. Definition at line 624 of file ez_scene.c.
References ez_scene_t::content, ez_draw_lens_chrome(), ez_draw_status(), ez_lens_rect(), ez_scene_t::lens, ez_scene_t::lens_on, ez_scene_t::page, RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, zoom_source_t::read, s_tag, ez_scene_t::src, and zoom_view_render().
Referenced by ez_redraw(), and ez_render_and_hash().
|
nodiscard |
Drive the scene through the scripted boot self-check.
Four states – opening 1:1, one right-pan step, 2x about a fixed panel point, and the 4x loupe – each rendered and hashed. This is the app's golden: apps/board/stand_alone/ereader/tests/src/test_app_ereader_zoom.c calls this same function over a host framebuffer and asserts the identical numbers, and hil.conf pins them for the headless emulator gate.
| [in,out] | s | Initialised scene (left in the loupe state on return). |
| [out] | out | Receives the four hashes and the cache counters. |
| k_ra8_ok | The sequence ran and out is populated. |
| k_ra8_err_null_ptr | s or out is NULL. |
| k_ra8_err_* | Propagated from a render or a viewport call. |
s was freshly initialised (the counters start from zero). out reflects the whole sequence.Definition at line 861 of file ez_scene.c.
References ez_scene_t::cache, ez_selftest_t::evictions, ez_selftest_stages(), ez_selftest_t::hits, ez_selftest_t::misses, RA8_CHECK_NULL_PTR, RA8_RETURN_ON_ERROR, ra8_tile_cache_stats(), and s_tag.
Referenced by main().
|
nodiscard |
Apply a tap to the scene.
| [in,out] | s | Initialised scene. |
| [in] | x | Framebuffer column of the tap. |
| [in] | y | Framebuffer row of the tap. |
| [in] | now_ms | Current millisecond timestamp. |
| true | The scene changed; re-render and present. |
| false | The tap hit nothing, or clamped to no movement. |
s was initialised by ez_scene_init (NULL answers false). now_ms comes from a monotonic millisecond source. Definition at line 531 of file ez_scene.c.
References ez_apply_pan(), ez_zone_hit(), k_ez_lens_scale_max, k_ez_lens_scale_min, k_ez_page_scale_max, k_ez_zone_lens, k_ez_zone_toggle, k_ez_zone_zoom, k_ra8_ok, k_zoom_scale_min, ez_scene_t::lens, ez_scene_t::lens_on, ez_scene_t::page, zoom_view_t::scale, zoom_scale_cycle(), zoom_view_invalidate(), and zoom_view_set_scale().
Referenced by ez_poll_touch().
| bool ez_scene_tick | ( | ez_scene_t * | s, |
| uint32_t | now_ms ) |
Advance both views' settle timers; report whether a repaint is due.
| [in,out] | s | Initialised scene. |
| [in] | now_ms | Current millisecond timestamp. |
| true | Re-render and present. |
| false | Nothing to do this tick. |
s was initialised by ez_scene_init (NULL answers false). now_ms comes from a monotonic millisecond source. Definition at line 689 of file ez_scene.c.
References ez_scene_t::lens, ez_scene_t::lens_on, ez_scene_t::page, and zoom_view_tick().
Referenced by main().
|
static |
Build the shared composite-scratch descriptor from a configuration.
| [in] | cfg | Scene configuration holding the three borrowed buffers. |
| descriptor | Always; validation happens in zoom_view_open(). |
cfg is non-NULL. Definition at line 278 of file ez_scene.c.
References k_ez_packed_bytes, k_ez_row_bytes, k_ez_strip_bytes, ez_scene_cfg_t::packed, ez_scene_cfg_t::row, and ez_scene_cfg_t::strip.
Referenced by ez_open_views().
|
static |
Self-check stage 4: open the loupe over the magnified page.
Both views are invalidated explicitly. Opening the loupe moves no anchor and changes no scale, so neither view would otherwise know its pixels had been damaged – the seam this stage also regression- tests.
| [in,out] | s | Initialised scene. |
| [out] | out | Receives crc_lens. |
| k_ra8_ok | The stage ran and the hash is set. |
| k_ra8_err_* | Propagated from the viewport or the render. |
Definition at line 823 of file ez_scene.c.
References ez_selftest_t::crc_lens, ez_render_and_hash(), k_ez_st_t0, ez_scene_t::lens, ez_scene_t::lens_on, ez_scene_t::page, RA8_RETURN_ON_ERROR, s_tag, and zoom_view_invalidate().
Referenced by ez_selftest_stages().
|
static |
Self-check stage 2: one right-pan step at 1:1, with read-ahead.
The pan is a full discrete step rather than a nudge, so it is the case the tile cache is sized for: the newly exposed column decodes and nothing still on screen is evicted.
| [in,out] | s | Initialised scene. |
| [out] | out | Receives crc_pan and warmed. |
| k_ra8_ok | The stage ran and both fields are set. |
| k_ra8_err_* | Propagated from the viewport, the prefetch or the render. |
Definition at line 766 of file ez_scene.c.
References ez_selftest_t::crc_pan, ez_render_and_hash(), ez_scene_prefetch(), k_ez_st_t0, k_zoom_pan_right, ez_scene_t::page, RA8_RETURN_ON_ERROR, s_tag, ez_selftest_t::warmed, and zoom_view_pan_dir().
Referenced by ez_selftest_stages().
|
static |
Run the four scripted self-check stages in order.
The order IS the golden: each stage starts from the state the last one left, so re-ordering them changes every hash after the first. Split from ez_scene_selftest so that entry point is its argument checks, this call, and the counter read.
| [in,out] | s | Freshly initialised scene. |
| [out] | out | Receives all four hashes and the prefetch count. |
| k_ra8_ok | All four stages rendered and hashed. |
| k_ra8_err_* | The first failing stage's code, verbatim. |
s was freshly initialised, so the cache counters start at zero. Definition at line 853 of file ez_scene.c.
References ez_selftest_t::crc_1x, ez_render_and_hash(), ez_selftest_lens(), ez_selftest_pan(), ez_selftest_zoom(), RA8_RETURN_ON_ERROR, and s_tag.
Referenced by ez_scene_selftest().
|
static |
Self-check stage 3: 2x about a fixed panel point.
The focus point is a named constant, not an incidental of whoever wrote the test, because the resulting hash is part of the golden.
| [in,out] | s | Initialised scene. |
| [out] | out | Receives crc_2x. |
| k_ra8_ok | The stage ran and the hash is set. |
| k_ra8_err_* | Propagated from the viewport or the render. |
Definition at line 793 of file ez_scene.c.
References ez_selftest_t::crc_2x, ez_render_and_hash(), k_ez_st_focus_x, k_ez_st_focus_y, k_ez_st_scale, k_ez_st_t0, ez_scene_t::page, RA8_RETURN_ON_ERROR, s_tag, and zoom_view_set_scale().
Referenced by ez_selftest_stages().
|
nodiscard |
ra8_tile_decode_fn that materialises one page tile from the sampler.
The decode-on-miss seam. A real reader inflates a JOF tile here; the demo computes it, which keeps the app free of a multi-megabyte baked fixture while exercising the identical cache, eviction and residency behaviour.
| [in] | ctx | Unused (the page is a pure function). |
| [in] | key | The tile being decoded. |
| [out] | cell | Destination cell, cell_bytes writable bytes. |
| [in] | cell_bytes | Capacity of cell. |
| [out] | out_w | Receives the decoded tile width. |
| [out] | out_h | Receives the decoded tile height. |
| k_ra8_ok | The tile was written. |
| k_ra8_err_null_ptr | key, cell, out_w or out_h is NULL. |
| k_ra8_err_out_of_range | The key names a tile outside the page. |
| k_ra8_err_no_mem | cell_bytes is smaller than one tile. |
cell addresses at least cell_bytes writable bytes. cell); otherwise pure. Definition at line 204 of file ez_scene.c.
References ez_fill_tile(), k_ez_cell_bytes, k_ez_page_h, k_ez_page_w, k_ez_tile_edge, k_ra8_err_no_mem, k_ra8_err_out_of_range, k_ra8_ok, RA8_CHECK_NULL_PTR, ra8_log_error, s_tag, ra8_tile_key_t::tile_x, and ra8_tile_key_t::tile_y.
Referenced by ez_bind_page().
|
nodiscard |
Classify a tap by the zone it lands in.
| [in] | s | Initialised scene. |
| [in] | x | Framebuffer column of the tap. |
| [in] | y | Framebuffer row of the tap. |
| k_ez_zone_none | The point is outside every zone. |
| a zone | Otherwise, the zone that owns the point. |
s was initialised by ez_scene_init (NULL answers none). s; thread-safe. Definition at line 451 of file ez_scene.c.
References ez_scene_t::content, ez_lens_rect(), ra8_ui_rect_t::h, k_ez_edge_band, k_ez_status_h, k_ez_zone_lens, k_ez_zone_none, k_ez_zone_pan_down, k_ez_zone_pan_left, k_ez_zone_pan_right, k_ez_zone_pan_up, k_ez_zone_toggle, k_ez_zone_zoom, ez_scene_t::lens_on, ra8_ui_rect_contains(), ra8_ui_rect_t::w, ra8_ui_rect_t::x, and ra8_ui_rect_t::y.
Referenced by ez_scene_tap().
|
static |
Component tag for RA8_CHECK_* log lines.
Definition at line 33 of file ez_scene.c.