summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-09-05 22:37:10 -0400
committerpommicket <pommicket@gmail.com>2023-09-05 22:37:10 -0400
commit6fdb5619052ff68face6ad06b4423776ce8bd4f2 (patch)
tree68d65c8354cfcb71276b6cc36a7f26449efcf75f /examples
parentd990a922652d5adaab61ea8b8c461f624b53dc84 (diff)
rename to minipng0.1.0
Diffstat (limited to 'examples')
-rw-r--r--examples/example.rs4
-rw-r--r--examples/profile.rs4
-rw-r--r--examples/wasm-minipng/.cargo/config.toml (renamed from examples/wasm-tiny-png/.cargo/config.toml)0
-rw-r--r--examples/wasm-minipng/Cargo.toml (renamed from examples/wasm-tiny-png/Cargo.toml)4
-rw-r--r--examples/wasm-minipng/src/lib.rs (renamed from examples/wasm-tiny-png/src/lib.rs)4
5 files changed, 8 insertions, 8 deletions
diff --git a/examples/example.rs b/examples/example.rs
index dda0a79..c26b484 100644
--- a/examples/example.rs
+++ b/examples/example.rs
@@ -1,9 +1,9 @@
fn main() {
let png = &include_bytes!("image.png")[..];
- let header = tiny_png::decode_png_header(png).expect("bad PNG");
+ let header = minipng::decode_png_header(png).expect("bad PNG");
println!("need {} bytes of memory", header.required_bytes());
let mut buffer = vec![0; header.required_bytes()];
- let image = tiny_png::decode_png(png, &mut buffer).expect("bad PNG");
+ let image = minipng::decode_png(png, &mut buffer).expect("bad PNG");
println!("{}×{} image", image.width(), image.height());
let pixels = image.pixels();
println!(
diff --git a/examples/profile.rs b/examples/profile.rs
index fb8110a..9833c32 100644
--- a/examples/profile.rs
+++ b/examples/profile.rs
@@ -11,9 +11,9 @@ fn main() {
for _ in 0..100 {
let png = &large_image[..];
- let header = tiny_png::decode_png_header(png).unwrap();
+ let header = minipng::decode_png_header(png).unwrap();
let mut buf = vec![0; header.required_bytes()];
- let data = tiny_png::decode_png(png, &mut buf).unwrap();
+ let data = minipng::decode_png(png, &mut buf).unwrap();
std::hint::black_box(data);
}
}
diff --git a/examples/wasm-tiny-png/.cargo/config.toml b/examples/wasm-minipng/.cargo/config.toml
index f4e8c00..f4e8c00 100644
--- a/examples/wasm-tiny-png/.cargo/config.toml
+++ b/examples/wasm-minipng/.cargo/config.toml
diff --git a/examples/wasm-tiny-png/Cargo.toml b/examples/wasm-minipng/Cargo.toml
index 5c8dae5..ac51c8b 100644
--- a/examples/wasm-tiny-png/Cargo.toml
+++ b/examples/wasm-minipng/Cargo.toml
@@ -1,5 +1,5 @@
[package]
-name = "wasm-tiny-png"
+name = "wasm-minipng"
version = "0.1.0"
edition = "2021"
@@ -7,7 +7,7 @@ edition = "2021"
crate-type = ["cdylib"]
[dependencies]
-tiny-png = { path = "../.." }
+minipng = { path = "../.." }
[profile.release]
opt-level = "z"
diff --git a/examples/wasm-tiny-png/src/lib.rs b/examples/wasm-minipng/src/lib.rs
index 449b67d..aebf88b 100644
--- a/examples/wasm-tiny-png/src/lib.rs
+++ b/examples/wasm-minipng/src/lib.rs
@@ -2,12 +2,12 @@
pub unsafe fn decode_png(input: *const u8, input_len: usize, output: *mut u8, output_len: usize) -> usize {
let input = core::slice::from_raw_parts(input, input_len);
let output = core::slice::from_raw_parts_mut(output, output_len);
- let Ok(header) = tiny_png::decode_png_header(input) else {
+ let Ok(header) = minipng::decode_png_header(input) else {
return 0;
};
let required_bytes = header.required_bytes();
if output_len >= required_bytes {
- if tiny_png::decode_png(input, output).is_err() {
+ if minipng::decode_png(input, output).is_err() {
return 0;
}
}