Commit Graph
50 Commits
Author SHA1 Message Date
Nigel Tao 5d7b113172 Optimize imageviewer xcb_clear_area calls 2022-06-08 17:22:29 +10:00
Nigel Tao 8feb2709fa Have imageviewer use wuffs_base__i32__{min,max} 2022-06-03 11:28:39 +10:00
Nigel Tao 4c5d313120 Let example/imageviewer scroll 2022-05-31 12:29:05 +10:00
Nigel Tao 4c09c77bb9 Add std/tga package
This is just a placeholder decoder implementation  (and all of the
required plumbing) that produces a 1x1 reddish-purple image. Follow-up
commits will add flesh to the metaphorical bones.

TGA has no magic identifier, so MIME sniffers have to use heuristics.
The test/data/cbor-rfc-7049-examples.cbor file (which is CBOR binary
data, not a TGA image) is mistakenly sniffed as TGA. The /usr/bin/file
program makes the same classification (a false positive).

$ file test/data/cbor-rfc-7049-examples.cbor
test/data/cbor-rfc-7049-examples.cbor: Targa image data - Map 59395 x 26
x 15 +6169 +6500 - 2-bit alpha - interleave "@\033"

Some test/3pdata/tgasuite/*.tga test files, which are invalid TGA
images, are also false positives for now.

Updates #67
2022-01-14 22:53:20 +11:00
Nigel Tao c754f81634 Have wuffs_aux::DecodeImage report ICCP, XMP 2021-10-31 15:09:55 +11:00
Nigel Tao 15b6285d1c Add example/imageviewer -screen_gamma=N.N flag 2021-10-20 15:42:26 +11:00
Nigel Tao b003f9fe65 Let wuffs_aux::DecodeImage handle metadata
Updates #39
2021-10-19 22:09:21 +11:00
Nigel Tao 2b7b6e12ea Add wuffs_aux::DecodeImageArgQuirks 2021-10-18 00:40:11 +11:00
Nigel Tao ca33506c01 Add wuffs_aux::FooArgBar types for optional args
Prior to this commit, with a "wuffs_aux::Foo(x, y, 0, 0, 4, 5)" call,
with arguments after "y" optional, it was not a compile-time error to
give the wrong number of "0"s or to transpose "4" and "5".
2021-10-18 00:25:13 +11:00
Nigel Tao 90d3232eae Let example/imageviewer minify (negative zoom) 2021-10-07 12:59:38 +11:00
Nigel Tao 2945ef2b29 Have example/imageviewer avoid big xcb_image_put's 2021-10-07 12:35:12 +11:00
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 7753368324 Add const to example/imageviewer zooms variable 2021-10-04 09:33:33 +11:00
Nigel Tao 8eaa222592 Add example/imageviewer zoom and filter 2021-10-03 16:42:58 +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 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 816475b285 Add "b" (for "binary") to fopen calls
Updates #50
2021-07-07 20:28:35 +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 3b79564254 Drop redundant DecodeImageCallbacks subclass 2021-04-01 23:12:55 +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 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 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 f45f01f4f3 Update clang-format from v5 to v9 2020-06-05 14:06:56 +10:00
Nigel Tao dcb81a85bb Prepare to decode BMP embedding a JPEG or PNG 2020-05-27 13:37:54 +10:00
Nigel Tao 621ea5adf3 Have examples use overwrite_instead_of_blend 2020-05-14 21:20:31 +10:00
Nigel Tao d60815c93f Have example/* global variable names start with g_ 2020-03-26 14:32:35 +11:00
Nigel Tao fdac24a425 Rename FOO_BUFFER_SIZE to FOO_BUFFER_ARRAY_SIZE 2020-03-06 21:53:08 +11:00
Nigel Tao 1ad5cfac4d Make wuffs_base__{load,store}_uNNxe public 2020-02-27 10:58:14 +11:00
Nigel Tao 2914bae3b2 Re-format C function signatures 2020-02-26 09:40:30 +11:00
Nigel Tao e6cc2fe8f0 Implement bmp.decoder.decode_frame 2020-02-07 16:27:04 +11:00
Nigel Tao d595980f75 Let imageviewer toggle background color 2020-01-24 12:00:20 +11:00
Nigel Tao 731350f8f9 Optimize imageviewer's XCB_EXPOSE handling 2020-01-24 11:36:44 +11:00
Nigel Tao 4a83eba3f9 Add WUFFS_BASE__PIXEL_BLEND__SRC_OVER 2020-01-24 11:32:13 +11:00
Nigel Tao 4feb641841 Implement wbmp.decoder.decode_frame 2020-01-16 15:02:32 +11:00
Nigel Tao 8f1fe43abf Add example/imageviewer 2020-01-16 11:42:52 +11:00