Switched blend modes for demo.
Instead of doing more work reverting the pre-multiplied
colors and then letting wgpu apply alpha, we simply use
our pre-multiplied values, replacing the ones in the buffer.
Change-Id: Iee911c3c24f8c161702de9706a313f64f9927fc8
diff --git a/demo/Cargo.toml b/demo/Cargo.toml
index be95de0..c79ae71 100644
--- a/demo/Cargo.toml
+++ b/demo/Cargo.toml
@@ -14,7 +14,7 @@
image = "0.23"
# Stick to nalgebra 0.25.4 until https://github.com/rust-analyzer/rust-analyzer/issues/8654 is fixed.
nalgebra = "0.25.4"
-pixels = "0.9"
+pixels = { git = "https://github.com/parasyte/pixels", commit = "94b8749" }
rand = { version = "0.8", features = ["small_rng"] }
rive-rs = { path = "../rive-rs" }
svg = "0.5"
diff --git a/demo/src/main.rs b/demo/src/main.rs
index 79b89b9..5c55036 100644
--- a/demo/src/main.rs
+++ b/demo/src/main.rs
@@ -13,7 +13,7 @@
use clap::{Parser, Subcommand};
use forma::{
buffer::{layout::LinearLayout, BufferBuilder},
- Color, Composition, BGRA,
+ Color, Composition, BGR1,
};
use pixels::{wgpu, PixelsBuilder, SurfaceTexture};
use rive::Rive;
@@ -148,6 +148,7 @@
let surface_texture = SurfaceTexture::new(width as u32, height as u32, &window);
let mut pixels = PixelsBuilder::new(width as u32, height as u32, surface_texture)
.texture_format(wgpu::TextureFormat::Bgra8UnormSrgb)
+ .blend_state(wgpu::BlendState::REPLACE)
.build()
.unwrap();
@@ -212,7 +213,7 @@
&mut BufferBuilder::new(pixels.get_frame(), &mut layout)
.layer_cache(layer_cache.clone())
.build(),
- BGRA,
+ BGR1,
Color { r: 1.0, g: 1.0, b: 1.0, a: 0.0 },
None,
);