Skip to content

Commit

Permalink
lhp: add DLO layout support
Browse files Browse the repository at this point in the history
Add a dlo-based layout callback for use with lhp.

If lhp_dl_render() is used as the Lws Html/CSS parser callback, it
produces a display_list representation of the Html as DLOs, referencing the
appropriate CSS to drive the layout as best it can.

The display list can be rasterized on to an lws_display using the display's
state object

  lds->disp->blit(lds, (uint8_t *)&dl, &box);
  • Loading branch information
lws-team committed May 4, 2022
1 parent 3063fe8 commit 4a443c3
Show file tree
Hide file tree
Showing 16 changed files with 28,236 additions and 49 deletions.
11 changes: 10 additions & 1 deletion CMakeLists-implied-options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ if (LWS_WITH_SECURE_STREAMS_PROXY_API)
set(LWS_WITH_LWS_DSH 1)
set(LWS_WITH_UNIX_SOCK 1)
set(LWS_WITH_SYS_SMD 1)
set(LWS_WITH_SECURE_STREAMS 1)
endif()

if (NOT LWS_WITH_NETWORK)
Expand All @@ -158,6 +159,7 @@ if (NOT LWS_WITH_NETWORK)
set(LWS_WITH_LWS_DSH 0)
set(LWS_WITH_THREADPOOL 0)
set(LWS_WITH_SYS_SMD 0)
set(LWS_WITH_LHP 0)
endif()

if (LWS_WITH_CGI)
Expand Down Expand Up @@ -363,8 +365,10 @@ endif()

set(LWS_WITH_CLIENT 1)
if (LWS_WITHOUT_CLIENT)
set(LWS_WITH_CLIENT)
set(LWS_WITH_CLIENT 0)
set(LWS_WITH_SECURE_STREAMS 0)
set(LWS_WITH_SECURE_STREAMS_PROXY_API 0)
set(LWS_WITH_LHP 0)
endif()
set(LWS_WITH_SERVER 1)
if (LWS_WITHOUT_SERVER)
Expand All @@ -381,6 +385,11 @@ if (LWS_WITH_OTA)
set(LWS_WITH_GZINFATE 1)
endif()

if (LWS_WITH_LHP)
set(LWS_WITH_CLIENT 1)
set(LWS_WITH_SECURE_STREAMS 1)
endif()

# using any abstract protocol enables LWS_WITH_ABSTRACT

#if (LWS_WITH_SMTP)
Expand Down
19 changes: 19 additions & 0 deletions contrib/assets/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Asset Provanance and licenses

### bluecat.jpg.h

Licence: CC0
Source: https://commons.wikimedia.org/wiki/File:Startled_blue-eyed_cat_(Unsplash).jpg
Archive: https://archive.is/Bi4tR

### cat1.png.h

License: CC0
Source: https://commons.wikimedia.org/wiki/File:Cat_looking_outside_the_window.jpg
Archive: https://archive.is/Rocwf

### exclaim80.png.h & no-right.png.h

License: CC0
Source: [email protected] inkscape

1,952 changes: 1,952 additions & 0 deletions contrib/assets/bluecat.jpg.h

Large diffs are not rendered by default.

23,399 changes: 23,399 additions & 0 deletions contrib/assets/cat1.png.h

Large diffs are not rendered by default.

880 changes: 880 additions & 0 deletions contrib/assets/exclaim80.png.h

Large diffs are not rendered by default.

257 changes: 257 additions & 0 deletions contrib/assets/no-right.png.h

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions include/libwebsockets/lws-context-vhost.h
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,9 @@ struct lws_context_creation_info {
* proxy. NULL means to use the default wsi-based client support */
#endif

#if defined(LWS_WITH_SECURE_STREAMS_PROXY_API)
#endif

int rlimit_nofile;
/**< 0 = inherit the initial ulimit for files / sockets from the startup
* environment. Nonzero = try to set the limit for this process.
Expand Down
2 changes: 2 additions & 0 deletions lib/core-net/vhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -1014,11 +1014,13 @@ lws_create_vhost(struct lws_context *context,
lwsl_vhost_err(vh, "lws_context_init_server_ssl failed");
goto bail1;
}
#if defined(LWS_WITH_CLIENT)
if (lws_fi(&vh->fic, "vh_create_ssl_cli") ||
lws_context_init_client_ssl(info, vh)) {
lwsl_vhost_err(vh, "lws_context_init_client_ssl failed");
goto bail1;
}
#endif
#if defined(LWS_WITH_SERVER)
lws_context_lock(context, __func__);
if (lws_fi(&vh->fic, "vh_create_srv_init"))
Expand Down
8 changes: 8 additions & 0 deletions lib/core/alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,14 @@ _realloc(void *ptr, size_t size, const char *reason)
allocated -= malloc_usable_size(ptr);
#endif
free(ptr);
#if defined(LWS_PLAT_FREERTOS)
lwsl_debug("%s: free heap %d\n", __func__,
#if defined(LWS_AMAZON_RTOS)
(unsigned int)xPortGetFreeHeapSize() - (int)size);
#else
(unsigned int)esp_get_free_heap_size() - (int)size);
#endif
#endif
}

return NULL;
Expand Down
30 changes: 18 additions & 12 deletions lib/misc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,26 @@ if (LWS_WITH_DLO)
misc/dlo/dlo-font-mcufont.c
misc/dlo/dlo-text.c)

if (LWS_WITH_UPNG)
list(APPEND SOURCES
misc/dlo/dlo-png.c)
endif()
if (LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
list(APPEND SOURCES
misc/dlo/dlo-ss.c)
endif()

if (LWS_WITH_JPEG)
list(APPEND SOURCES
misc/dlo/dlo-jpeg.c)
endif()
if (LWS_WITH_UPNG AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
list(APPEND SOURCES
misc/dlo/dlo-png.c)
endif()

if (LWS_WITH_SECURE_STREAMS)
list(APPEND SOURCES
misc/dlo/dlo-ss.c)
endif()
if (LWS_WITH_JPEG AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
list(APPEND SOURCES
misc/dlo/dlo-jpeg.c)
endif()

if (LWS_WITH_LHP AND LWS_WITH_DLO AND LWS_WITH_SECURE_STREAMS AND LWS_WITH_CLIENT)
list(APPEND SOURCES
misc/dlo/dlo-lhp.c
)
endif()

endif() #dlo

Expand Down
Loading

0 comments on commit 4a443c3

Please sign in to comment.