1
0
Fork 0
forked from wry/wry

alpha-multiplier: perform multiplication in the renderer

This commit is contained in:
Julian Orth 2025-02-22 11:14:51 +01:00
parent 33718340f7
commit 0872a1251d
8 changed files with 46 additions and 22 deletions

View file

@ -202,7 +202,7 @@ enum RenderError {
#[derive(Default)]
struct GfxGlState {
triangles: RefCell<Vec<[f32; 2]>>,
fill_rect: VecStorage<&'static FillRect>,
fill_rect: VecStorage<FillRect>,
copy_tex: VecStorage<&'static CopyTexture>,
}
@ -233,7 +233,11 @@ fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
}
}
GfxApiOpt::FillRect(f) => {
fill_rect.push(f);
fill_rect.push(FillRect {
rect: f.rect,
color: f.effective_color(),
alpha: None,
});
i += 1;
}
GfxApiOpt::CopyTexture(c) => {
@ -249,7 +253,7 @@ fn run_ops(fb: &Framebuffer, ops: &[GfxApiOpt]) -> Option<SyncFile> {
triangles.clear();
let mut color = None;
while i < fill_rect.len() {
let fr = fill_rect[i];
let fr = &fill_rect[i];
match color {
None => color = Some(fr.color),
Some(c) if c == fr.color => {}

View file

@ -505,7 +505,7 @@ impl VulkanRenderer {
let memory = &mut *self.memory.borrow_mut();
let clear_value = clear.map(|clear| ClearValue {
color: ClearColorValue {
float32: clear.to_array_srgb(),
float32: clear.to_array_srgb(None),
},
});
let load_clear = memory.paint_regions.len() == 1 && {
@ -620,7 +620,7 @@ impl VulkanRenderer {
GfxApiOpt::FillRect(r) => {
let push = FillPushConstants {
pos: r.rect.to_points(),
color: r.color.to_array_srgb(),
color: r.color.to_array_srgb(r.alpha),
};
for region in &memory.paint_regions {
let mut push = push;