| 1 |
# Rust PNG decoder |
| 2 |
|
| 3 |
This directory contains helpers, simplifications, and wrappers for exposing the |
| 4 |
`png` Rust crate to other Skia code: |
| 5 |
|
| 6 |
* to `SkPngRustCodec` |
| 7 |
* to `SkPngRustEncoderImpl` |
| 8 |
|
| 9 |
See the following document for more details: |
| 10 |
https://docs.google.com/document/d/1glx5ue5JDlCld5WzWgTOGK3wsMErQFnkY5N5Dsbi91Y/edit?usp=sharing |
| 11 |
|
| 12 |
## Chromium build instructions |
| 13 |
|
| 14 |
To build and test the code from this directory from Chromium: |
| 15 |
|
| 16 |
1. `autoninja -C out/... gfx_unittests blink_platform_unittests chrome` |
| 17 |
1. `out/.../gfx_unittests --gtest_filter=*PNG*` |
| 18 |
1. `out/.../blink_platform_unittests --gtest_filter=*PNG*` |
| 19 |
|
| 20 |
## Skia build instructions |
| 21 |
|
| 22 |
### Bazel |
| 23 |
|
| 24 |
To build the code from this directory from Skia (testing via Bazel is not |
| 25 |
supported yet): |
| 26 |
|
| 27 |
``` |
| 28 |
$ cd skia-repo-root |
| 29 |
$ bazelisk build //src/codec:rust_png_decoder //src/encode:rust_png_encoder rust/png/... |
| 30 |
``` |
| 31 |
|
| 32 |
### gn / ninja |
| 33 |
|
| 34 |
To build the code from this directory from Skia: |
| 35 |
|
| 36 |
1. `gn args out/RustPng` and set `skia_use_rust_png_decode = true` |
| 37 |
as well as `skia_use_rust_png_encode = true` |
| 38 |
1. `gn gen out/RustPng` |
| 39 |
1. `autoninja -C out/RustPng dm` |
| 40 |
``` |
| 41 |
|
| 42 |
To test the code (via `tests/SkPngRustDecoderTest.cpp` and |
| 43 |
`tests/SkPngRustEncoderTest.cpp`): |
| 44 |
|
| 45 |
``` |
| 46 |
$ out/RustPng/dm --src tests --nogpu \ |
| 47 |
--match RustPngCodec \ |
| 48 |
RustEncodePng |
| 49 |
``` |
| 50 |
|
| 51 |
TODO(https://crbug.com/356875275): Add support for running older tests |
| 52 |
(e.g. ones from `tests/CodecTest.cpp`) against `SkPngRustCodec`. |
| 53 |
|
| 54 |
## Differences between `SkPngCodec` and `SkRustPngCodec` |
| 55 |
|
| 56 |
* `SkPngCodec`: |
| 57 |
- No APNG support. |
| 58 |
- No CICP support. |
| 59 |
* `SkPngRustCodec` differences - see |
| 60 |
https://issues.chromium.org/issues?q=parentid:362829876%2B |
| 61 |
|
| 62 |
## Differences between `SkPngEncoder` and `SkPngRustEncoder` |
| 63 |
|
| 64 |
* `SkPngRustEncoder` differences - see |
| 65 |
https://issues.chromium.org/issues?q=parentid:381140294%2B |