• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 RustPngCodec \
49            RustEncodePng
50```
51
52TODO(https://crbug.com/356875275): Add support for running older tests
53(e.g. ones from `tests/CodecTest.cpp`) against `SkPngRustCodec`.
54
55## Differences between `SkPngCodec` and `SkRustPngCodec`
56
57* `SkPngCodec`:
58    - No APNG support.
59    - No CICP support.
60* `SkPngRustCodec` differences - see
61  https://issues.chromium.org/issues?q=parentid:362829876%2B
62
63## Differences between `SkPngEncoder` and `SkPngRustEncoder`
64
65* `SkPngRustEncoder` differences - see
66  https://issues.chromium.org/issues?q=parentid:381140294%2B
67