libwebsockets
Lightweight C library for HTML5 websockets
Loading...
Searching...
No Matches
lws-dlo.h
Go to the documentation of this file.
1/*
2 * lws abstract display
3 *
4 * Copyright (C) 2019 - 2022 Andy Green <andy@warmcat.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
22 * IN THE SOFTWARE.
23 *
24 * lws display_list and display_list objects (dlo)
25 */
26
27#if !defined(__LWS_DLO_H__)
28#define __LWS_DLO_H__
29
30#include <stdint.h>
31
33struct lws_surface_info;
35struct lws_display_font;
36struct lws_dlo_text;
37struct lws_display;
38struct lws_dlo_text;
39struct lws_dlo;
40
41#define LWSDC_RGBA(_r, _g, _b, _a) (((uint32_t)(_r) & 0xff) | \
42 (((uint32_t)(_g) & 0xff) << 8) | \
43 (((uint32_t)(_b) & 0xff) << 16) | \
44 (((uint32_t)(_a) & 0xff) << 24))
45
46#define LWSDC_R(_c) ((_c) & 0xff)
47#define LWSDC_G(_c) ((_c >> 8) & 0xff)
48#define LWSDC_B(_c) ((_c >> 16) & 0xff)
49#define LWSDC_ALPHA(_c) ((_c >> 24) & 0xff)
50
51#define RGB_TO_Y(_r, _g, _b) ((((_r) * 299) + ((_g) * 587) + ((_b) * 114)) / 1000)
52/* stores Y in RGBY */
53#define PALETTE_RGBY(_r, _g, _b) LWSDC_RGBA(_r, _g, _b, (RGB_TO_Y(_r, _g, _b)))
54
55typedef struct {
59
60/*
61 * When using RGBA to describe native greyscale, R is Y and A is A, GB is ignored
62 */
63
64/* composed at start of larger, font-specific glyph struct */
65
66typedef struct lws_font_glyph {
68
73
74 int8_t x; /* x offset inside the glyph */
75
76 void *pin; /* font-private: what to unpin on free */
78
80typedef lws_font_glyph_t * (*lws_dlo_image_glyph_t)(
81 struct lws_dlo_text *text,
82 uint32_t unicode, char attach);
83typedef void (*lws_dlo_destroy_t)(struct lws_dlo *dlo);
84
85typedef struct lws_display_id {
87
88 char id[16];
89 lws_box_t box; /* taken from DLO after layout */
90
91 void *priv_user;
93
94 char exists;
95 char iframe; /* 1 = render html as if partial
96 * is the origin, otherwise
97 * render html with surface
98 * (0,0) as origin and rs->box
99 * is a viewport on to that */
101
102/*
103 * Common dlo object that joins the display list, composed into a subclass
104 * object like lws_dlo_rect_t etc
105 */
106
107typedef struct lws_dlo {
109
110 lws_dll2_t col_list; /* lws_dlo_t: column-mates */
111 lws_dll2_t row_list; /* lws_dlo_t: row-mates */
112
113 /* children are rendered "inside" the parent DLO box after allowing
114 * for parent padding */
116
117 /* only used for dlo rect representing whole table */
118
119 lws_dll2_owner_t table_cols; /* lhp_table_col_t */
120 lws_dll2_owner_t table_rows; /* lhp_table_row_t */
121
122 /* may point to dlo whose width or height decides our x or y:
123 * abut_y is the positioned ancestor a bottom-anchored absolute
124 * box waits on, box.y meanwhile holding the offset up from its
125 * bottom edge (layout) */
126
129
130 lws_dlo_destroy_t _destroy; /* dlo-type specific cb */
131 lws_dlo_renderer_t render; /* dlo-type specific cb */
132
134 lws_fx_t padding[4]; /* child origin */
135
136 lws_display_id_t *id; /* only valid until ids destroyed */
137
140
141 uint8_t budget; /* limit spinning */
142 int16_t base_up; /* baseline: distance up from the
143 * box bottom, 0 = bottom edge
144 * (layout) */
145
146 uint8_t flag_toplevel:1; /* don't scan up with me (different owner) */
147 uint8_t flag_block:1; /* block-level box (layout) */
148 uint8_t flag_row:1; /* table row box (layout) */
149 uint8_t flag_cell:1; /* table cell box (layout) */
150 uint8_t flag_abs:1; /* positioned box (layout) */
151 uint8_t flag_float:1; /* floated box (layout) */
152 uint8_t flag_zraise:1; /* positioned, z-index > 0 */
153 uint8_t flag_online:1; /* item of the line being ended (layout) */
154 uint8_t flag_bg_homed:1; /* css background image moved into
155 * its element's own dlo (layout) */
156 uint8_t flag_inline_bg:1; /* background rect of the text
157 * run that follows it (layout) */
158 uint8_t flag_flex_item:1; /* item of a row flex container
159 * (layout) */
160 uint8_t flag_fixed_h:1; /* has a css height: not
161 * stretched (layout) */
162 uint8_t flag_abs_stretch:1; /* waiting on abut_y
163 * to stretch between top and
164 * bottom, box.h meanwhile the
165 * bottom offset (layout) */
166 uint8_t flex_grow; /* flex-grow, for flag_flex_item */
167 uint8_t align_self; /* LCSP_PROPVAL_* or 0 = auto */
168
169 /* render-specific members ... */
171
172typedef struct lws_circle {
174
175 /* rasterization temps */
176 lws_fx_t orx; /* abs pixel x for centre */
177 lws_fx_t ory; /* abs pixel y for centre */
181
182typedef struct lws_dlo_rect {
184 lws_circle_t c[4]; /* t-l, t-r, b-l, b-r */
185 lws_fx_t b[4]; /* border width on t/r/b/l */
186 lws_display_colour_t dcb; /* border colour */
187
188 /* rasterization temps */
189
193
196 /* 0 = full box, else fill the triangle at the named corner: the css
197 * border-triangle idiom (transparent adjacent borders on an empty
198 * box) */
199 uint8_t tri; /* 1 t-l, 2 t-r, 3 b-l, 4 b-r */
201
205
206/*
207 * Non-printing hit region: renders nothing, but marks the area of its box
208 * as belonging to something, eg, the link whose url it carries. Being a
209 * dlo it is placed and moved by the layout with the things around it, and
210 * its position in the paint order decides which of several overlapping
211 * regions a point belongs to (the last, as a viewer sees it on top).
212 */
213
214/*
215 * The pointer shape a hit region asks for while the pointer is over it, in
216 * platform-neutral terms: a windowing backend maps these to whatever it
217 * has (X11 font cursors, NSCursor, LoadCursor...). A link asks for the
218 * pointing hand, editable text for the I-beam, css cursor: for the rest.
219 */
231
232typedef struct lws_dlo_hit {
234 const char *url; /* as written in the document, in
235 * the same allocation; NULL for a
236 * region that only sets the
237 * cursor */
238 uint8_t fill; /* takes its parent's size */
239 uint8_t cursor; /* lws_dlo_cursor_t */
241
242typedef struct lws_font_choice {
243 const char *family_name;
244 const char *generic_name;
246 uint16_t style; /* normal, italic, oblique */
249
250typedef struct lws_display_font {
252
254
255 const uint8_t *data; /* may be cast to imp struct */
256 uint8_t *priv; /* only used by implementation */
257 size_t data_len;
260
261 lws_fx_t em; /* 1 em in pixels */
262 lws_fx_t ex; /* 1 ex in pixels */
264
265typedef struct lws_dlo_filesystem {
267
268 const char *name;
269 const void *data;
270 size_t len;
272
273#define LWSDLO_TEXT_FLAG_WRAP (1 << 0)
274
275typedef struct lws_dlo_text {
279 lws_box_t bounding_box; /* { 0, 0, w, h } relative
280 * to and subject to
281 * clipping by .dlo.box */
282
283 /* referred to by glyphs */
284 const struct lws_surface_info *ic;
285 struct lwsac *ac_glyphs;
288 uint16_t glyph_row; /* rows the glyph run decoders
289 * have produced since attach */
290
291 char *text;
293 size_t text_len;
296
298
301 int16_t font_height;
303
306
309
315
316typedef struct lws_dlo_png {
317 lws_dlo_t dlo; /* ordering: first */
318 lws_flow_t flow; /* ordering: second */
319 char name[25];
321 uint32_t emitted; /* decoded rows issued so far,
322 * for viewport re-scans */
323 uint8_t *row; /* copy of the last row issued, for
324 * repeating it when scaled up */
326 lws_reclaimable_t rc; /* payload + decoder, once complete */
327 uint8_t evicted; /* renew from the asset cache
328 * before the next render */
329 uint8_t yields; /* consecutive OOM yields */
330 uint8_t failed; /* the decoder returned FATAL:
331 * nothing more from it */
333
334typedef struct lws_dlo_jpeg {
335 lws_dlo_t dlo; /* ordering: first */
336 lws_flow_t flow; /* ordering: second */
337 char name[25];
339 uint32_t emitted; /* decoded rows issued so far,
340 * for viewport re-scans */
341 uint8_t *row; /* copy of the last row issued, for
342 * repeating it when scaled up */
344 lws_reclaimable_t rc; /* payload + decoder, once complete */
345 uint8_t evicted; /* renew from the asset cache
346 * before the next render */
347 uint8_t failed; /* the decoder returned FATAL:
348 * nothing more from it */
350
351typedef struct lws_dlo_svg {
352 lws_dlo_t dlo; /* ordering: first */
353 lws_flow_t flow; /* ordering: second */
354 char name[25];
357
358/*
359 * Unlike the png and jpeg dlos, the gif dlo keeps the whole asset payload
360 * retained in one buffer: interlaced gifs must be re-decoded to reach rows
361 * out of stream order, and a linewise renderer without a framebuffer can
362 * only get interlaced rows that way. Progressive gifs free it again once
363 * the frame has decoded.
364 */
365
366typedef struct lws_dlo_gif {
367 lws_dlo_t dlo; /* ordering: first */
368 lws_flow_t flow; /* ordering: second */
369 char name[25];
371 uint8_t *whole; /* retained asset payload */
372 size_t whole_len;
374 size_t pos; /* decode feed cursor in whole */
375 char whole_done; /* whole fully decoded */
377
385
396
401
402typedef struct lws_dl_rend {
404 int w;
405 int h;
406 char clipped; /* the layout dropped content that
407 * landed below h */
409
411 lws_dlo_t *dlo; /* position in dlo owner */
412 lws_box_t co; /* our origin as parent */
414
415/*
416 * How deep a display list the dlo tree walkers (render, dump, hit test) can
417 * follow. Deeper nesting than this is truncated, it is not an error: the
418 * walkers all carry the stack by value, so on a constrained target the
419 * ceiling is what keeps them off a couple of KB of stack apiece.
420 */
421
422#if !defined(LWS_DLO_STACK_DEPTH)
423#if defined(LWS_ESP_PLATFORM)
424#define LWS_DLO_STACK_DEPTH 16
425#else
426#define LWS_DLO_STACK_DEPTH 64
427#endif
428#endif
429
431 lws_sorted_usec_list_t sul; /* return to event loop statefully */
432 struct lws_display_state *lds; /* optional, if using lws_display */
433
435
436 const struct lws_surface_info *ic; /* display dimensions, palette */
437
439 /* DLO child stack */
440 int sp; /* DLO child stack level */
441
442 uint8_t *line; /* Y or RGB line comp buffer */
443
445
446 /* the html document ss currently bound to this render state, when
447 * browsed with lws_lhp_ss_browse(); used by lws_lhp_ss_cancel() */
448
449 struct lws_ss_handle *hss_html;
450
453
454 char html;
455 char retained; /* nonzero: keep DLOs when the
456 * render cursor passes them, so
457 * the display list can be re-
458 * scanned at other offsets */
459 char layout_clipped; /* set when the html
460 * completes if the layout dropped
461 * content below the surface: a
462 * taller surface would show more */
463 int32_t viewport_h; /* 0, or the height css
464 * viewport units and the root
465 * element's height resolve
466 * against, when the layout
467 * surface is taller than what is
468 * shown at once (a scrolling
469 * window) */
470 struct lws_context *cx; /* set by lws_lhp_ss_browse_filter() */
471
473
474
477
480
483
486
489
492
503
504//#if defined(_DEBUG)
507//#endif
508
518lws_display_list_destroy(struct lws_context *cx, lws_displaylist_t *dl);
519
522
525
528
529/*
530 * lws_display_list_render_line() - render a single raster line of the list
531 *
532 * \param rs: prepared render state object
533 *
534 * Allocates a line pair buffer into ds->line if necessary, and renders the
535 * current line (set by ds->curr) of the display list rasterization into it
536 */
539
542
543/*
544 * rect
545 */
546
549 lws_box_t *box, const lws_fx_t *radii,
551
554
555/*
556 * hit region
557 */
558
574 const lws_box_t *box, const char *url, size_t url_len);
575
578
581
596
610
611/*
612 * dlo text
613 */
614
617 lws_box_t *box, const lws_display_font_t *font);
618
621 lws_fx_t indent, const char *utf8, size_t text_len);
622
634 size_t text_len, lws_fx_t *total,
635 lws_fx_t *longest_word);
636
639
640/*
641 * PNG
642 */
643
646 lws_box_t *box, const char *name, size_t len);
647
650
653
656
657/*
658 * JPEG
659 */
660
663 lws_box_t *box, const char *name, size_t len);
664
667
670
673
674/*
675 * SVG
676 */
677
680 lws_box_t *box, const char *name, size_t len);
681
684
687
690
691/*
692 * GIF
693 */
694
697 lws_box_t *box, const char *name, size_t len);
698
701
704
707
708/*
709 * Take rx payload for a gif dlo into its retained buffer; the gif flow
710 * keeps the payload rather than consuming it from the flow buflist.
711 * Returns 0, or nonzero on allocation failure or over the retention cap.
712 */
713
715lws_display_dlo_gif_rx(lws_dlo_gif_t *dlo_gif, const uint8_t *buf, size_t len);
716
717/*
718 * SS / dlo images
719 */
720
721struct lhp_ctx;
722
737
740
742lws_dlo_ss_find(struct lws_context *cx, const char *url, lws_dlo_image_t *u);
743
754lws_dlo_ss_assets_active(struct lws_context *cx);
755
765lws_dlo_ss_stop_any_active(struct lws_context *cx);
766
782lws_dlo_ss_detach_lhp(struct lws_context *cx, struct lhp_ctx *lhp);
783
797lws_dlo_ss_renew_images(struct lws_context *cx);
798
809lws_dlo_ss_renew_image(struct lws_context *cx, lws_dlo_t *dlo);
810
811
812/*
813 * The context dlo asset cache (see the dlo_asset_cache_dir member of
814 * lws_context_creation_info) stores fetched image assets in a self-maintaining
815 * file-backed cache, so still-valid assets are reused instead of refetched.
816 */
817
818#if !defined(LWS_DLO_ASSET_BLOB_DEFAULT_MAX_FOOTPRINT)
819#define LWS_DLO_ASSET_BLOB_DEFAULT_MAX_FOOTPRINT (64 * 1024 * 1024)
822#endif
823
824#if !defined(LWS_DLO_ASSET_BLOB_MAX_PAYLOAD)
825#define LWS_DLO_ASSET_BLOB_MAX_PAYLOAD (16 * 1024 * 1024)
827#endif
828
829#if !defined(LWS_DLO_ASSET_L1_MAX_FOOTPRINT)
830#define LWS_DLO_ASSET_L1_MAX_FOOTPRINT (8 * 1024 * 1024)
832#endif
833
834#if !defined(LWS_DLO_ASSET_L1_MAX_ITEMS)
835#define LWS_DLO_ASSET_L1_MAX_ITEMS 256
837#endif
838
839#if !defined(LWS_DLO_ASSET_CACHE_EXPIRY_S)
840#define LWS_DLO_ASSET_CACHE_EXPIRY_S (24 * 60 * 60)
843#endif
844
855LWS_VISIBLE LWS_EXTERN struct lws_cache_ttl_lru *
856lws_dlo_asset_cache(struct lws_context *cx);
857
859lhp_displaylist_layout(struct lhp_ctx *ctx, char reason);
860
861/*
862 * These image accessor macros adapt to the image types that were built in.
863 * Because they are macros, the svg arms have to be selected at compile time
864 * or they would reference svg apis that were not built.
865 */
866
867#if defined(LWS_WITH_SVG) && defined(LWS_WITH_GIF)
868
869#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
870 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
871 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
872 (_u)->type == LWSDLOSS_TYPE_SVG ? \
873 (int)lws_svg_get_width((_u)->u.dlo_svg->svg) : \
874 (_u)->type == LWSDLOSS_TYPE_GIF ? \
875 (int)lws_gif_get_width((_u)->u.dlo_gif->gif) : \
876 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
877#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
878 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
879 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
880 (_u)->type == LWSDLOSS_TYPE_SVG ? \
881 (int)lws_svg_get_height((_u)->u.dlo_svg->svg) : \
882 (_u)->type == LWSDLOSS_TYPE_GIF ? \
883 (int)lws_gif_get_height((_u)->u.dlo_gif->gif) : \
884 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
885
886#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
887 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
888 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
889 (_u)->type == LWSDLOSS_TYPE_SVG ? \
890 lws_display_dlo_svg_metadata_scan((_u)->u.dlo_svg) : \
891 (_u)->type == LWSDLOSS_TYPE_GIF ? \
892 lws_display_dlo_gif_metadata_scan((_u)->u.dlo_gif) : \
893 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
894
895#elif defined(LWS_WITH_SVG)
896
897#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
898 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
899 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
900 (_u)->type == LWSDLOSS_TYPE_SVG ? \
901 (int)lws_svg_get_width((_u)->u.dlo_svg->svg) : \
902 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
903#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
904 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
905 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
906 (_u)->type == LWSDLOSS_TYPE_SVG ? \
907 (int)lws_svg_get_height((_u)->u.dlo_svg->svg) : \
908 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
909
910#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
911 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
912 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
913 (_u)->type == LWSDLOSS_TYPE_SVG ? \
914 lws_display_dlo_svg_metadata_scan((_u)->u.dlo_svg) : \
915 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
916
917#elif defined(LWS_WITH_GIF)
918
919#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
920 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
921 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
922 (_u)->type == LWSDLOSS_TYPE_GIF ? \
923 (int)lws_gif_get_width((_u)->u.dlo_gif->gif) : \
924 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
925#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
926 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
927 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
928 (_u)->type == LWSDLOSS_TYPE_GIF ? \
929 (int)lws_gif_get_height((_u)->u.dlo_gif->gif) : \
930 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
931
932#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
933 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
934 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
935 (_u)->type == LWSDLOSS_TYPE_GIF ? \
936 lws_display_dlo_gif_metadata_scan((_u)->u.dlo_gif) : \
937 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
938
939#else
940
941#define lws_dlo_image_width(_u) ((_u)->failed ? -1 : \
942 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
943 (int)lws_jpeg_get_width((_u)->u.dlo_jpeg->j) : \
944 (int)lws_upng_get_width((_u)->u.dlo_png->png)))
945#define lws_dlo_image_height(_u) ((_u)->failed ? -1 : \
946 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
947 (int)lws_jpeg_get_height((_u)->u.dlo_jpeg->j) : \
948 (int)lws_upng_get_height((_u)->u.dlo_png->png)))
949
950#define lws_dlo_image_metadata_scan(_u) ((_u)->failed ? LWS_SRET_FATAL : \
951 ((_u)->type == LWSDLOSS_TYPE_JPEG ? \
952 lws_display_dlo_jpeg_metadata_scan((_u)->u.dlo_jpeg) : \
953 lws_display_dlo_png_metadata_scan((_u)->u.dlo_png)))
954
955#endif
956
957/*
958 * Font registry
959 *
960 * Register fonts (currently, psfu) to the lws_context, and select the closest
961 * matching. Used to pick fonts from whatever CSS information is available.
962 */
963
965lws_font_register(struct lws_context *cx, const uint8_t *data, size_t data_len);
966
979lws_font_register_file(struct lws_context *cx, const char *path);
980
993lws_fonts_register_dir(struct lws_context *cx, const char *dirpath);
994
996lws_font_choose(struct lws_context *cx, const lws_font_choice_t *hints);
997
999lws_fonts_destroy(struct lws_context *cx);
1000
1001/*
1002 * Static blob registry (built-in, name-accessible blobs)
1003 */
1004
1006lws_dlo_file_register(struct lws_context *cx, const lws_dlo_filesystem_t *f);
1007
1008/* only needed if f dynamically heap-allocated... doesn't free data; data
1009 * is typically overallocated after the lws_dlo_filesystem_t and freed when
1010 * that is freed by this. */
1011
1014
1016lws_dlo_file_unregister_by_name(struct lws_context *cx, const char *name);
1017
1019lws_dlo_file_choose(struct lws_context *cx, const char *name);
1020
1022lws_dlo_file_destroy(struct lws_context *cx);
1023
1025#endif
struct lws_dll2 lws_dll2_t
struct lws_dll2_owner lws_dll2_owner_t
struct lws_flow lws_flow_t
struct lws_reclaimable lws_reclaimable_t
#define LWS_EXTERN_FOR_DATA
unsigned short uint16_t
unsigned int uint32_t
#define LWS_EXTERN
unsigned char uint8_t
struct lws_fixed3232 lws_fx_t
lws_stateful_ret_t
#define LWS_VISIBLE
uint32_t lws_display_colour_t
Definition lws-display.h:31
int16_t lws_display_list_coord_t
Definition lws-display.h:28
uint16_t lws_display_scalar
Definition lws-display.h:29
struct lws_box lws_box_t
lws_flow_t flow
Definition lws-dlo.h:336
uint8_t flag_abs_stretch
Definition lws-dlo.h:162
uint8_t init
Definition lws-dlo.h:194
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_text_update(lws_dlo_text_t *text, lws_display_colour_t dc, lws_fx_t indent, const char *utf8, size_t text_len)
LWS_VISIBLE LWS_EXTERN lws_dlo_cursor_t lws_display_dl_cursor_at(lws_displaylist_t *dl, int x, int y)
int16_t font_line_height
Definition lws-dlo.h:302
lws_display_colour_t dc
Definition lws-dlo.h:139
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_renew_image(struct lws_context *cx, lws_dlo_t *dlo)
LWS_VISIBLE LWS_EXTERN lws_dlo_filesystem_t * lws_dlo_file_register(struct lws_context *cx, const lws_dlo_filesystem_t *f)
uint8_t flag_block
Definition lws-dlo.h:147
char whole_done
Definition lws-dlo.h:375
uint8_t * kern
Definition lws-dlo.h:292
LWS_VISIBLE LWS_EXTERN const lws_display_font_t * lws_font_choose(struct lws_context *cx, const lws_font_choice_t *hints)
lws_font_glyph_t *(* lws_dlo_image_glyph_t)(struct lws_dlo_text *text, uint32_t unicode, char attach)
Definition lws-dlo.h:80
struct lws_dlo_hit lws_dlo_hit_t
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_find(struct lws_context *cx, const char *url, lws_dlo_image_t *u)
uint8_t tri
Definition lws-dlo.h:199
lws_fx_t em
Definition lws-dlo.h:261
lws_dlo_cursor_t
Definition lws-dlo.h:220
@ LWS_DLO_CURSOR_NONE
Definition lws-dlo.h:229
@ LWS_DLO_CURSOR_WAIT
Definition lws-dlo.h:226
@ LWS_DLO_CURSOR_HELP
Definition lws-dlo.h:227
@ LWS_DLO_CURSOR_CROSSHAIR
Definition lws-dlo.h:224
@ LWS_DLO_CURSOR_DEFAULT
Definition lws-dlo.h:221
@ LWS_DLO_CURSOR_POINTER
Definition lws-dlo.h:222
@ LWS_DLO_CURSOR_NOT_ALLOWED
Definition lws-dlo.h:228
@ LWS_DLO_CURSOR_TEXT
Definition lws-dlo.h:223
@ LWS_DLO_CURSOR_MOVE
Definition lws-dlo.h:225
lws_displaylist_t * dl
Definition lws-dlo.h:403
uint16_t curr
Definition lws-dlo.h:287
LWS_VISIBLE LWS_EXTERN void lws_display_dl_init(lws_displaylist_t *dl, struct lws_display_state *ds)
lws_flow_t flow
Definition lws-dlo.h:353
void * priv_user
Definition lws-dlo.h:91
LWS_VISIBLE LWS_EXTERN void lws_dlo_contents(lws_dlo_t *parent, lws_dlo_dim_t *dim)
lws_displaylist_t displaylist
Definition lws-dlo.h:444
uint8_t flag_online
Definition lws-dlo.h:153
size_t text_len
Definition lws-dlo.h:293
struct lws_dlo * abut_x
Definition lws-dlo.h:127
LWS_VISIBLE LWS_EXTERN void lws_display_dl_dump(lws_displaylist_t *dl)
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_gif_rx(lws_dlo_gif_t *dlo_gif, const uint8_t *buf, size_t len)
LWS_VISIBLE LWS_EXTERN struct lws_cache_ttl_lru * lws_dlo_asset_cache(struct lws_context *cx)
uint32_t emitted
Definition lws-dlo.h:321
const char * name
Definition lws-dlo.h:268
lws_box_t box
Definition lws-dlo.h:89
LWS_VISIBLE LWS_EXTERN lws_dlo_png_t * lws_display_dlo_png_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_reclaimable_t rc
Definition lws-dlo.h:344
struct lhp_ctx * lhp
Definition lws-dlo.h:731
uint8_t cursor
Definition lws-dlo.h:239
struct lws_dlo_jpeg lws_dlo_jpeg_t
lws_upng_t * png
Definition lws-dlo.h:320
lws_display_scalar lowest_id_y
Definition lws-dlo.h:452
lws_fx_t height
Definition lws-dlo.h:71
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_stop_any_active(struct lws_context *cx)
lws_fx_t indent
Definition lws-dlo.h:297
struct lwsac * ac_glyphs
Definition lws-dlo.h:285
lws_dlo_image_type_t
Definition lws-dlo.h:378
@ LWSDLOSS_TYPE_JPEG
Definition lws-dlo.h:379
@ LWSDLOSS_TYPE_SVG
Definition lws-dlo.h:381
@ LWSDLOSS_TYPE_CSS
Definition lws-dlo.h:383
@ LWSDLOSS_TYPE_PNG
Definition lws-dlo.h:380
@ LWSDLOSS_TYPE_GIF
Definition lws-dlo.h:382
uint16_t style
Definition lws-dlo.h:246
lws_dll2_t list
Definition lws-dlo.h:266
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_jpeg_destroy(struct lws_dlo *dlo)
size_t whole_size
Definition lws-dlo.h:373
lws_sorted_usec_list_t sul
Definition lws-dlo.h:431
lws_fx_t btm
Definition lws-dlo.h:190
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_get_ids_boxes(lws_display_render_state_t *rs)
lws_dll2_t list
Definition lws-dlo.h:251
uint16_t glyph_row
Definition lws-dlo.h:288
size_t whole_len
Definition lws-dlo.h:372
LWS_VISIBLE LWS_EXTERN int lws_dlo_ensure_err_diff(lws_dlo_t *dlo)
lws_fx_t r
Definition lws-dlo.h:173
int16_t group_height
Definition lws-dlo.h:304
lws_dlo_renderer_t render
Definition lws-dlo.h:131
int16_t font_height
Definition lws-dlo.h:301
struct lws_dlo_gif lws_dlo_gif_t
uint8_t flag_toplevel
Definition lws-dlo.h:146
lws_flow_t flow
Definition lws-dlo.h:368
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_text_destroy(struct lws_dlo *dlo)
lws_display_list_coord_t clkernpx
Definition lws-dlo.h:294
lws_dlo_t dlo
Definition lws-dlo.h:233
LWS_VISIBLE LWS_EXTERN lws_dlo_gif_t * lws_display_dlo_gif_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_dlo_t dlo
Definition lws-dlo.h:183
lws_dll2_owner_t dl
Definition lws-dlo.h:398
lws_dll2_owner_t glyphs
Definition lws-dlo.h:278
lws_display_id_t * id
Definition lws-dlo.h:136
const void * data
Definition lws-dlo.h:269
const struct lws_surface_info * ic
Definition lws-dlo.h:436
uint8_t * row
Definition lws-dlo.h:323
struct lws_display_id lws_display_id_t
uint8_t evicted
Definition lws-dlo.h:327
const char * url
Definition lws-dlo.h:234
LWS_VISIBLE LWS_EXTERN void lws_display_render_dump_ids(lws_dll2_owner_t *ids)
struct lws_context * cx
Definition lws-dlo.h:724
LWS_VISIBLE LWS_EXTERN lws_dlo_rect_t * lws_display_dlo_rect_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const lws_fx_t *radii, lws_display_colour_t dc)
lws_jpeg_t * j
Definition lws-dlo.h:338
void(* lws_dlo_destroy_t)(struct lws_dlo *dlo)
Definition lws-dlo.h:83
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_gif_destroy(struct lws_dlo *dlo)
lws_fx_t ex
Definition lws-dlo.h:262
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_text_measure(lws_dlo_text_t *text, const char *utf8, size_t text_len, lws_fx_t *total, lws_fx_t *longest_word)
const char * generic_name
Definition lws-dlo.h:244
LWS_VISIBLE LWS_EXTERN void lws_dlo_ss_renew_images(struct lws_context *cx)
size_t pos
Definition lws-dlo.h:374
uint32_t row_len
Definition lws-dlo.h:325
size_t data_len
Definition lws-dlo.h:257
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_assets_active(struct lws_context *cx)
uint8_t * whole
Definition lws-dlo.h:371
LWS_VISIBLE LWS_EXTERN int lws_font_register(struct lws_context *cx, const uint8_t *data, size_t data_len)
const uint8_t * data
Definition lws-dlo.h:255
struct lws_font_choice lws_font_choice_t
uint8_t flag_fixed_h
Definition lws-dlo.h:160
uint16_t fixed_height
Definition lws-dlo.h:247
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_destroy(lws_dlo_t **r)
lws_displaylist_t * dl
Definition lws-dlo.h:725
lws_dlo_t * dlo_parent
Definition lws-dlo.h:726
uint32_t emitted
Definition lws-dlo.h:339
lws_dlo_t dlo
Definition lws-dlo.h:335
lws_sorted_usec_list_t sul
Definition lws-dlo.h:312
lws_dll2_t col_list
Definition lws-dlo.h:110
uint8_t flag_float
Definition lws-dlo.h:151
lws_dll2_owner_t table_rows
Definition lws-dlo.h:120
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_svg_metadata_scan(lws_dlo_svg_t *ds)
lws_display_render_stack_t st[LWS_DLO_STACK_DEPTH]
Definition lws-dlo.h:438
lws_sorted_usec_list_t * on_rx_sul
Definition lws-dlo.h:729
lws_fx_t rsq
Definition lws-dlo.h:178
struct lws_dlo_filesystem lws_dlo_filesystem_t
struct lws_display_font lws_display_font_t
int16_t group_y_baseline
Definition lws-dlo.h:305
LWS_VISIBLE LWS_EXTERN lws_display_id_t * lws_display_render_get_id(lws_display_render_state_t *rs, const char *id)
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_unregister(lws_dlo_filesystem_t **f)
lws_fx_t cwidth
Definition lws-dlo.h:72
struct lws_context * cx
Definition lws-dlo.h:470
LWS_VISIBLE LWS_EXTERN lws_dlo_hit_t * lws_display_dlo_hit_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, const lws_box_t *box, const char *url, size_t url_len)
uint8_t flag_bg_homed
Definition lws-dlo.h:154
uint8_t flex_grow
Definition lws-dlo.h:166
struct lws_dlo_png lws_dlo_png_t
char name[25]
Definition lws-dlo.h:369
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_list_render_line(lws_display_render_state_t *rs)
lws_fx_t _cwidth
Definition lws-dlo.h:307
LWS_VISIBLE LWS_EXTERN lws_dlo_text_t * lws_display_dlo_text_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const lws_display_font_t *font)
uint32_t flags
Definition lws-dlo.h:299
struct lws_dlo_rect lws_dlo_rect_t
lws_dll2_owner_t ids
Definition lws-dlo.h:434
uint16_t weight
Definition lws-dlo.h:245
lws_dlo_t dlo
Definition lws-dlo.h:203
LWS_VISIBLE LWS_EXTERN lws_dlo_svg_t * lws_display_dlo_svg_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_unregister_by_name(struct lws_context *cx, const char *name)
lws_dll2_t list
Definition lws-dlo.h:67
const struct lws_surface_info * ic
Definition lws-dlo.h:284
struct lws_display_state * ds
Definition lws-dlo.h:399
uint8_t flag_flex_item
Definition lws-dlo.h:158
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_png_metadata_scan(lws_dlo_png_t *dp)
uint8_t * row
Definition lws-dlo.h:341
uint8_t align_self
Definition lws-dlo.h:167
uint8_t alt
Definition lws-dlo.h:195
lws_dlo_t dlo
Definition lws-dlo.h:276
lws_fx_t w
Definition lws-dlo.h:56
lws_dlo_image_t * u
Definition lws-dlo.h:732
uint8_t flag_abs
Definition lws-dlo.h:150
int16_t base_up
Definition lws-dlo.h:142
#define LWS_DLO_STACK_DEPTH
Definition lws-dlo.h:426
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_gif_metadata_scan(lws_dlo_gif_t *dg)
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_hit(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN int lws_dlo_ss_create(lws_dlo_ss_create_info_t *i, lws_dlo_t **pdlo)
lws_box_t bounding_box
Definition lws-dlo.h:279
lws_fx_t right
Definition lws-dlo.h:191
LWS_VISIBLE LWS_EXTERN_FOR_DATA const struct lws_plat_file_ops lws_dlo_fops
Definition lws-dlo.h:1024
lws_fx_t b[4]
Definition lws-dlo.h:185
lws_box_t db
Definition lws-dlo.h:192
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_gif(struct lws_display_render_state *rs)
lws_display_list_coord_t cwidth
Definition lws-dlo.h:295
const lws_display_font_t * font
Definition lws-dlo.h:277
lws_fx_t padding[4]
Definition lws-dlo.h:134
LWS_VISIBLE LWS_EXTERN const lws_dlo_filesystem_t * lws_dlo_file_choose(struct lws_context *cx, const char *name)
struct lws_dlo_svg lws_dlo_svg_t
char clipped
Definition lws-dlo.h:406
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_adjust_dims(lws_dlo_t *dlo, lws_dlo_dim_t *dim)
lws_display_scalar curr
Definition lws-dlo.h:451
lws_circle_t c[4]
Definition lws-dlo.h:184
lws_dlo_destroy_t _destroy
Definition lws-dlo.h:130
struct lws_display_state * lds
Definition lws-dlo.h:432
LWS_VISIBLE LWS_EXTERN void lws_dlo_ss_detach_lhp(struct lws_context *cx, struct lhp_ctx *lhp)
lws_fx_t xpx
Definition lws-dlo.h:70
LWS_VISIBLE LWS_EXTERN int lws_display_dlo_add(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_dlo_t *dlo)
lws_dlo_t dlo
Definition lws-dlo.h:367
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_png(struct lws_display_render_state *rs)
uint8_t evicted
Definition lws-dlo.h:345
lws_dlo_t dlo
Definition lws-dlo.h:352
uint8_t flag_row
Definition lws-dlo.h:148
lws_dlo_renderer_t renderer
Definition lws-dlo.h:258
LWS_VISIBLE LWS_EXTERN void lws_fonts_destroy(struct lws_context *cx)
uint8_t failed
Definition lws-dlo.h:347
struct lws_dlo_circle lws_dlo_circle_t
lws_dlo_t dlo
Definition lws-dlo.h:317
uint8_t flag_zraise
Definition lws-dlo.h:152
uint8_t budget
Definition lws-dlo.h:141
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_png_destroy(struct lws_dlo *dlo)
uint8_t yields
Definition lws-dlo.h:329
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_svg(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN lws_dlo_jpeg_t * lws_display_dlo_jpeg_new(lws_displaylist_t *dl, lws_dlo_t *dlo_parent, lws_box_t *box, const char *name, size_t len)
lws_dlo_image_glyph_t image_glyph
Definition lws-dlo.h:259
lws_font_choice_t choice
Definition lws-dlo.h:253
uint8_t flag_cell
Definition lws-dlo.h:149
int16_t font_y_baseline
Definition lws-dlo.h:300
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_dlo_jpeg_metadata_scan(lws_dlo_jpeg_t *dj)
char name[25]
Definition lws-dlo.h:337
lws_reclaimable_t rc
Definition lws-dlo.h:326
lws_flow_t flow
Definition lws-dlo.h:318
uint8_t flag_inline_bg
Definition lws-dlo.h:156
lws_display_colour_t dcb
Definition lws-dlo.h:186
LWS_VISIBLE LWS_EXTERN lws_dlo_hit_t * lws_display_dl_hit_test(lws_displaylist_t *dl, int x, int y, lws_box_t *abox)
uint32_t row_len
Definition lws-dlo.h:343
struct lws_circle lws_circle_t
lws_dll2_owner_t children
Definition lws-dlo.h:115
lws_stateful_ret_t(* lws_dlo_renderer_t)(struct lws_display_render_state *rs)
Definition lws-dlo.h:79
lws_fx_t margin[4]
Definition lws-dlo.h:133
char * text
Definition lws-dlo.h:291
char name[25]
Definition lws-dlo.h:354
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_jpeg(struct lws_display_render_state *rs)
struct lws_ss_handle * hss_html
Definition lws-dlo.h:449
lws_dll2_t list
Definition lws-dlo.h:108
lws_fx_t orx
Definition lws-dlo.h:176
lws_gif_t * gif
Definition lws-dlo.h:370
LWS_VISIBLE LWS_EXTERN int lws_fonts_register_dir(struct lws_context *cx, const char *dirpath)
void * priv_driver
Definition lws-dlo.h:92
lws_dll2_owner_t owner
Definition lws-dlo.h:311
char name[25]
Definition lws-dlo.h:319
lws_dll2_t row_list
Definition lws-dlo.h:111
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_hit_destroy(struct lws_dlo *dlo)
LWS_VISIBLE LWS_EXTERN void lws_display_dlo_svg_destroy(struct lws_dlo *dlo)
struct lws_dl_rend lws_dl_rend_t
lws_fx_t ys
Definition lws-dlo.h:179
lws_svg_t * svg
Definition lws-dlo.h:355
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lws_display_render_rect(struct lws_display_render_state *rs)
LWS_VISIBLE LWS_EXTERN int lws_font_register_file(struct lws_context *cx, const char *path)
const char * family_name
Definition lws-dlo.h:243
LWS_VISIBLE LWS_EXTERN void lws_display_list_destroy(struct lws_context *cx, lws_displaylist_t *dl)
struct lws_font_glyph lws_font_glyph_t
uint8_t failed
Definition lws-dlo.h:330
void * pin
Definition lws-dlo.h:76
lws_fx_t ory
Definition lws-dlo.h:177
LWS_VISIBLE LWS_EXTERN lws_display_id_t * lws_display_render_add_id(lws_display_render_state_t *rs, const char *id, void *priv)
lws_box_t box
Definition lws-dlo.h:138
struct lws_dlo lws_dlo_t
struct lws_dlo_rasterize lws_dlo_rasterize_t
lws_dll2_owner_t table_cols
Definition lws-dlo.h:119
lws_dll2_t list
Definition lws-dlo.h:86
uint8_t fill
Definition lws-dlo.h:238
uint8_t * priv
Definition lws-dlo.h:256
LWS_VISIBLE LWS_EXTERN lws_stateful_ret_t lhp_displaylist_layout(struct lhp_ctx *ctx, char reason)
lws_fx_t h
Definition lws-dlo.h:57
struct lws_dlo * abut_y
Definition lws-dlo.h:128
LWS_VISIBLE LWS_EXTERN void lws_display_render_free_ids(lws_display_render_state_t *rs)
struct lws_dlo_text lws_dlo_text_t
struct lws_displaylist lws_displaylist_t
struct lws_display_render_stack lws_display_render_stack_t
uint8_t * line
Definition lws-dlo.h:286
LWS_VISIBLE LWS_EXTERN void lws_dlo_file_destroy(struct lws_context *cx)
struct lws_display_render_state lws_display_render_state_t
lws_fx_t xorg
Definition lws-dlo.h:69
struct lws_gif lws_gif_t
Definition lws-gif.h:44
struct lws_jpeg lws_jpeg_t
Definition lws-jpeg.h:36
struct lws_svg lws_svg_t
Definition lws-svg.h:39
void(* sul_cb_t)(struct lws_sorted_usec_list *sul)
struct lws_sorted_usec_list lws_sorted_usec_list_t
struct lws_upng_t lws_upng_t
Definition lws-upng.h:51
union lhp_ctx::@311003342135116017074105067137247155112136133110 u
lws_dlo_jpeg_t * dlo_jpeg
lws_dlo_image_type_t type
Definition lws-dlo.h:393