xref: /aosp_15_r20/external/skia/experimental/rust_png/README.md (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1# Rust PNG decoder
2
3This directory contains experimental code for
4
5* Providing `SkCodec` API for decoding PNG images using Rust `png` crate.
6* Providing `SkEncoder` API for encoding PNG images using Rust `png` crate.
7
8See the following document for more details:
9https://docs.google.com/document/d/1glx5ue5JDlCld5WzWgTOGK3wsMErQFnkY5N5Dsbi91Y/edit?usp=sharing
10
11## Chromium build instructions
12
13To build and test the code from this directory from Chromium:
14
151. `gn args out/...` and set `enable_rust_png = true`
161. `autoninja -C out/... gfx_unittests blink_platform_unittests chrome`
171. `out/.../gfx_unittests --gtest_filter=RustEnabled*`
181. `out/.../blink_platform_unittests --gtest_filter=RustEnabled*`
191. `out/.../chrome --enable-features=RustyPng`
20
21## Skia build instructions
22
23### Bazel
24
25To build the code from this directory from Skia (testing via Bazel is not
26supported yet):
27
28```
29$ cd skia-repo-root
30$ bazelisk build experimental/rust_png/...
31```
32
33### gn / ninja
34
35To build the code from this directory from Skia:
36
371. `gn args out/RustPng` and set `skia_use_rust_png_decode = true`
38   as well as `skia_use_rust_png_encode = true`
391. `gn gen out/RustPng`
401. `autoninja -C out/RustPng dm`
41```
42
43To test the code (via `tests/SkPngRustDecoderTest.cpp` and
44`tests/SkPngRustEncoderTest.cpp`):
45
46```
47$ out/RustPng/dm --src tests --nogpu \
48    --match Codec_apng \
49    --match Codec_png \
50    --match Encode_png
51```
52
53TODO(https://crbug.com/356875275): Add support for running older tests
54(e.g. ones from `tests/CodecTest.cpp`) against `SkPngRustCodec`.
55
56## Differences between `SkPngCodec` and `SkRustPngCodec`
57
58* `SkPngCodec`:
59    - No APNG support.
60    - No CICP support.
61* `SkPngRustCodec` differences - see
62  https://issues.chromium.org/issues?q=parentid:362829876%2B):
63