mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Antialias checkered artboard background edges (#4163)
* Antialias checkered artboard background edges * Review
This commit is contained in:
@@ -44,6 +44,13 @@ fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
|
||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||
let tile = floor((in.document_position - uniforms.pattern_origin) / uniforms.checker_size);
|
||||
let parity = i32(tile.x + tile.y) & 1;
|
||||
let luminance = vec3<f32>(select(1.0, 0.8, parity == 1));
|
||||
return vec4<f32>(luminance, 1.0);
|
||||
let luminance = select(1.0, 0.8, parity == 1);
|
||||
|
||||
let fw = fwidthFine(in.document_position);
|
||||
let coverage_max = 1.0 - smoothstep(uniforms.rect_max - fw, uniforms.rect_max, in.document_position);
|
||||
let coverage_min = smoothstep(uniforms.rect_min, uniforms.rect_min + fw, in.document_position);
|
||||
let coverage = coverage_max * coverage_min;
|
||||
let alpha = coverage.x * coverage.y;
|
||||
|
||||
return vec4<f32>(vec3<f32>(luminance), alpha);
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ impl BackgroundCompositor {
|
||||
compilation_options: Default::default(),
|
||||
targets: &[Some(wgpu::ColorTargetState {
|
||||
format,
|
||||
blend: None,
|
||||
blend: Some(wgpu::BlendState::ALPHA_BLENDING),
|
||||
write_mask: wgpu::ColorWrites::ALL,
|
||||
})],
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user