Implement wbmp.decoder.decode_frame

This commit is contained in:
Nigel Tao committed 2020-01-16 15:02:32 +11:00
1 parent bec5d6fa5c
commit 4feb641841
6 files changed
+283 -9

No files matched your search

+15
View File
@@ -55,6 +55,7 @@ The Escape key quits.
#define WUFFS_CONFIG__MODULE__BASE
#define WUFFS_CONFIG__MODULE__GIF
#define WUFFS_CONFIG__MODULE__LZW
#define WUFFS_CONFIG__MODULE__WBMP
// If building this program in an environment that doesn't easily accommodate
// relative includes, you can use the script/inline-c-relative-includes.go
@@ -82,6 +83,7 @@ wuffs_base__image_decoder* g_image_decoder = NULL;
union {
wuffs_gif__decoder gif;
wuffs_wbmp__decoder wbmp;
} g_potential_decoders;
bool read_more_src() {
@@ -110,6 +112,19 @@ bool load_image_type() {
wuffs_base__status status;
switch (g_src_buffer[0]) {
case '\x00':
status = wuffs_wbmp__decoder__initialize(
&g_potential_decoders.wbmp, sizeof g_potential_decoders.wbmp,
WUFFS_VERSION, WUFFS_INITIALIZE__DEFAULT_OPTIONS);
if (!wuffs_base__status__is_ok(&status)) {
printf("%s: %s\n", g_filename, wuffs_base__status__message(&status));
return false;
}
g_image_decoder =
wuffs_wbmp__decoder__upcast_as__wuffs_base__image_decoder(
&g_potential_decoders.wbmp);
break;
case 'G':
status = wuffs_gif__decoder__initialize(
&g_potential_decoders.gif, sizeof g_potential_decoders.gif,