Commit Graph
295 Commits
Author SHA1 Message Date
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
Přemysl Eric Janouch 550fabd15d Fix the imageviewer demo on DefaultDepth 30
Using Render compositing should make this work reliably
with pratically any root window visual.
2021-09-30 12:14:51 +02:00
Přemysl Eric Janouch a1d9c6a8e6 Make imageviewer not segfault on XCB errors
Fixing the issue properly doesn't seem worth the effort,
shared memory is ugly, and incremental loading is a lot of code.

Xlib - XCB 1:0
2021-09-30 07:31:45 +02:00
Nigel Tao 77f855206d Have JSON line-comment tokens exclude the "\n"
Before this commit, line-comment token chains included the final "\n"
the way block-comments included the final "*/". The "\n" was mandatory.

However, when parsing with both QUIRK_ALLOW_COMMENT_LINE and
QUIRK_ALLOW_TRAILING_FILLER, input like "123//xyz" (without a "\n"
before the EOF) was rejected before and accepted after this commit.

So that line-comments are consistent, in that they either always or
never include the final "\n", they now never include the final "\n".

An input fragment (parsed with QUIRK_ALLOW_COMMENT_LINE) like
"//abc\n\t\t" was, before this commit, parsed as a 6 byte comment token
and a 2 byte other-filler token. That split is now 5+3.
2021-07-20 14:17:09 +10:00
Nigel Tao 816475b285 Add "b" (for "binary") to fopen calls
Updates #50
2021-07-07 20:28:35 +10:00
Nigel Tao a51867dc63 Fix "forseen" typo 2021-05-19 21:34:09 +10:00
Nigel Tao c86ac5baef Add wuffs_base__table__flattened_length 2021-04-03 11:01:46 +11: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 3b79564254 Drop redundant DecodeImageCallbacks subclass 2021-04-01 23:12:55 +11:00
Nigel Tao 10850c17bc Add example/sdl-imageviewer 2021-04-01 23:08:49 +11:00
Nigel Tao 57ad55355b Have wuffs_aux SelectPixfmt default to BGRA_PREMUL 2021-03-29 22:06:39 +11:00
Nigel Tao 5767f030a3 Add DecodeImageCallbacks::SelectPixfmt 2021-03-11 16:25:16 +11:00
Nigel Tao 441e96a8d4 Add pixel_buffer.set_color_u32_fill_rect 2021-03-11 15:53:09 +11:00
Nigel Tao 1daace6342 Add DecodeImageCallbacks::OnImageFormat def impl 2021-03-11 12:04:00 +11:00
Nigel Tao 62986fde71 Let example/convert-to-nia handle I/O redirects 2021-03-10 23:31:23 +11:00
Nigel Tao e9c6f7fd55 Let example/convert-to-nia speak PNG 2021-03-10 23:29:51 +11:00
Nigel Tao a21e891e24 Add example/imageviewer OnImageConfig override 2021-03-08 13:25:46 +11:00
Nigel Tao 04f8686989 Add wuffs_aux::DecodeImage 2021-03-03 23:19:58 +11:00
Nigel Tao ccee207661 Change example/imageviewer from C to C++ 2021-02-27 22:40:32 +11:00
Nigel Tao 6050cbd319 Add wuffs_base__magic_number_guess_fourcc 2021-02-27 13:45:57 +11:00
Nigel Tao 3d6c609dc1 Add example/jsonptr/README.md 2021-02-22 21:05:53 +11:00
Nigel Tao 041267957c Add example/json* -input-jwcc and -jwcc flags 2021-02-22 12:29:14 +11:00
Nigel Tao 773994c3f6 Have jsonptr collapse consecutive blank lines 2021-02-22 12:04:08 +11:00
Nigel Tao 2f2bbc6ab0 Rename default github.com branch s/master/main/ 2021-01-25 11:30:15 +11:00
Nigel Tao 2f78804e62 Use more inclusive language 2021-01-23 19:50:47 +11:00
Nigel Tao a1c22caa15 Rename load and store to peek and poke 2021-01-17 22:44:39 +11:00
Nigel Tao 3faddde52d Fix imageviewer signed/unsigned char comparison 2020-12-24 22:30:32 +11:00
Nigel Tao 58c30e9d6d Add std/png 2020-12-24 13:10:29 +11:00
Nigel Tao 1197e86616 Add std/nie 2020-12-23 14:53:56 +11:00
Nigel Tao 904004e79a Let non-strict JSON Pointer syntax allow "~t" 2020-11-15 20:56:04 +11:00
Nigel Tao cd4cbc9102 Tweak JSON trailing comment/new-line quirks 2020-09-22 23:03:49 +10:00
Nigel Tao fa50f4de67 Add json QUIRK_ALLOW_TRAILING_COMMENT 2020-09-21 11:24:22 +10:00
Nigel Tao b55d539d94 Add links to jsonptr blog post 2020-09-11 08:11:02 +10:00
Nigel Tao 6c13877688 Drop WUFFS_JSON__QUIRK_ALLOW_BACKSLASH_X_AS_BYTES
We can always add it back later if there's demand for it.
2020-08-30 16:15:35 +10:00
Nigel Tao 8d779ae1cd Add jsonfindptrs -only-parse-dont-output flag 2020-08-29 23:10:08 +10:00
Nigel Tao 5396dbd17d Have jsonfindptrs use C++17's std::variant
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m7.333s
After:
real    0m5.970s
Ratio: 1.23x

Using "/usr/bin/time -v" instead of "time"
Before this commit:
Maximum resident set size (kbytes): 2556992
After:
Maximum resident set size (kbytes): 1214812
Ratio: 2.10x
2020-08-29 22:23:15 +10:00
Nigel Tao 9d69939f2c Have jsonfindptrs factor out escape_needed
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m7.550s
After:
real    0m7.333s
Ratio: 1.03x
2020-08-29 10:56:37 +10:00
Nigel Tao b6c01b3464 Have jsonfindptrs cache std::to_string(i)
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m8.822s
After:
real    0m7.550s
Ratio: 1.17x
2020-08-29 10:46:04 +10:00
Nigel Tao 8098d96113 Have jsonfindptrs re-use the output string buffer
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real    0m9.774s
After:
real    0m8.822s
Ratio: 1.11x
2020-08-29 10:41:05 +10:00
Nigel Tao feded888dd Have jsonfindptrs not flush stdout after each line
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonfindptrs < citylots.json > /dev/null
Before this commit:
real	0m21.104s
After:
real	0m9.774s
Ratio: 2.16x
2020-08-29 10:33:41 +10:00
Nigel Tao 63e6796896 Add "4Ki tokens is 32KiB" comment 2020-08-26 00:00:32 +10:00
Nigel Tao 7fd3bb661a Fix -Wswitch in example/jsonfindptrs 2020-08-24 21:34:53 +10:00
Nigel Tao 75682548f5 Add example/jsonptr -output-inf-nan-numbers flag 2020-08-22 21:40:18 +10:00
Nigel Tao ade016523b Optimize example/jsonptr string conversion
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.687s
After:
real    0m1.677s
Ratio: 1.01x
2020-08-21 15:57:51 +10:00
Nigel Tao 3f688b2677 Optimize example/jsonptr token VBD switch
On a mid-range x86_64 laptop, processing the 181 MiB citylots.json file
from github.com/zemirco/sf-city-lots-json:

$ time gen/bin/example-jsonptr < citylots.json > /dev/null
Before this commit:
real    0m1.765s
After:
real    0m1.687s
Ratio: 1.05x
2020-08-21 15:51:48 +10:00