Commit Graph
9 Commits
Author SHA1 Message Date
Nigel Tao 7f9f37ce5a Have examples use WUFFS_CONFIG__STATIC_FUNCTIONS
Compile time:
$ time ./build-example.sh
Before: user 1m15.750s
After:  user 0m50.343s

Binary size (excluding the statically linked example-toy-genlib):
$ ls -l gen/bin/example-* | awk '{print $5 " " $9}'

Before:
212624 gen/bin/example-cbor-to-json
284192 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
184304 gen/bin/example-gifplayer
324952 gen/bin/example-imageviewer
209632 gen/bin/example-json-to-cbor
241432 gen/bin/example-jsonfindptrs
196320 gen/bin/example-jsonptr
309768 gen/bin/example-sdl-imageviewer
200704 gen/bin/example-zcat

After:
 85280 gen/bin/example-cbor-to-json
242216 gen/bin/example-convert-to-nia
344744 gen/bin/example-crc32
 53328 gen/bin/example-gifplayer
282840 gen/bin/example-imageviewer
 95152 gen/bin/example-json-to-cbor
122720 gen/bin/example-jsonfindptrs
 60448 gen/bin/example-jsonptr
267672 gen/bin/example-sdl-imageviewer
 64792 gen/bin/example-zcat

Before total: 2508672
After  total: 1619192
2021-10-04 12:35:32 +11:00
Nigel Tao 1cf0df9da4 Tweak example{,sdl-}imageviewer 2021-10-03 15:30:04 +11:00
Nigel Tao 68acf24515 Remove Makefiles
They don't work for me (on Debian bullseye). For example, from the
example/sdl-imageviewer directory:

$ make
g++   -lSDL2 -lSDL2_image  sdl-imageviewer.cc   -o sdl-imageviewer
/usr/bin/ld: /tmp/cciX1mj2.o: in function `draw(SDL_Window*)':
sdl-imageviewer.cc:(.text+0x36e44): undefined reference to `SDL_GetWindowSurface'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e69): undefined reference to `SDL_CreateRenderer'
/usr/bin/ld: sdl-imageviewer.cc:(.text+0x36e79): undefined reference to `SDL_RenderClear'
etc
collect2: error: ld returned 1 exit status
make: *** [<builtin>: sdl-imageviewer] Error 1

Swapping the g++ args around to

g++ sdl-imageviewer.cc -lSDL2 -lSDL2_image -o sdl-imageviewer

works, but the recommended approach is to use the existing top-level
build-example.sh script instead.
2021-10-03 14:06:16 +11:00
Nigel Tao 2453a8d52a Run "clang-format-9 -style=Chromium"
Also replace /*...*/ comments with //... comments. The former don't nest
when using /*...*/ to comment out blocks of code.
2021-10-03 13:53:27 +11:00
Přemysl Eric Janouch 7ee081f4b9 Add Makefiles to image viewer demos
There doesn't seem to be much of a point in making it difficult
to try out Wuffs's most practical feature.
2021-09-30 12:38:32 +02:00
Přemysl Eric Janouch 6f39b9641b Fix the sdl-imageviewer demo on DefaultDepth 30
Using SDL renderers should make this work reliably
with pratically any root window visual.
2021-09-30 12:35:43 +02:00
Nigel Tao 314d265fe8 Spin out wuffs_aux Alloc{Pixbuf,Workbuf}Result 2021-04-02 23:57:18 +11:00
Nigel Tao a1506ad446 Simplify sdl-imageviewer's SDL pixel format use 2021-04-02 19:40:11 +11:00
Nigel Tao 10850c17bc Add example/sdl-imageviewer 2021-04-01 23:08:49 +11:00