diff options
author | 2020-05-27 23:17:21 +0200 | |
---|---|---|
committer | 2020-05-27 23:17:21 +0200 | |
commit | 45511a442f707e93fe6e568d2100756b63af7362 (patch) | |
tree | 2aae8f914ca00722587d2e0f0cf1bfc3b95ea2c0 | |
parent | 823ea1573245b849a0696543838a7ad1d0f914d8 (diff) | |
download | iced-45511a442f707e93fe6e568d2100756b63af7362.tar.gz iced-45511a442f707e93fe6e568d2100756b63af7362.tar.bz2 iced-45511a442f707e93fe6e568d2100756b63af7362.zip |
Target physical pixels for quads in `iced_glow`
Diffstat (limited to '')
-rw-r--r-- | examples/tour/src/main.rs | 4 | ||||
-rw-r--r-- | glow/src/shader/quad.vert | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/tour/src/main.rs b/examples/tour/src/main.rs index ca7a4f5d..c0bd2efe 100644 --- a/examples/tour/src/main.rs +++ b/examples/tour/src/main.rs @@ -772,7 +772,7 @@ mod style { Button::Secondary => Color::from_rgb(0.5, 0.5, 0.5), })), border_radius: 12, - shadow_offset: Vector::new(1.0, 1.0), + shadow_offset: Vector::new(0.0, 1.0), text_color: Color::from_rgb8(0xEE, 0xEE, 0xEE), ..button::Style::default() } @@ -781,7 +781,7 @@ mod style { fn hovered(&self) -> button::Style { button::Style { text_color: Color::WHITE, - shadow_offset: Vector::new(1.0, 2.0), + shadow_offset: Vector::new(0.0, 2.0), ..self.active() } } diff --git a/glow/src/shader/quad.vert b/glow/src/shader/quad.vert index d37b5c8d..ce816550 100644 --- a/glow/src/shader/quad.vert +++ b/glow/src/shader/quad.vert @@ -26,14 +26,14 @@ const vec2 positions[4] = vec2[]( void main() { vec2 q_Pos = positions[gl_VertexID]; - vec2 p_Pos = i_Pos * u_Scale; - vec2 p_Scale = i_Scale * u_Scale; + vec2 p_Pos = floor(i_Pos * u_Scale); + vec2 p_Scale = floor(i_Scale * u_Scale); mat4 i_Transform = mat4( - vec4(p_Scale.x + 1.0, 0.0, 0.0, 0.0), - vec4(0.0, p_Scale.y + 1.0, 0.0, 0.0), + vec4(p_Scale.x, 0.0, 0.0, 0.0), + vec4(0.0, p_Scale.y, 0.0, 0.0), vec4(0.0, 0.0, 1.0, 0.0), - vec4(p_Pos - vec2(0.5, 0.5), 0.0, 1.0) + vec4(p_Pos, 0.0, 1.0) ); v_Color = i_Color; @@ -41,7 +41,7 @@ void main() { v_Pos = p_Pos; v_Scale = p_Scale; v_BorderRadius = i_BorderRadius * u_Scale; - v_BorderWidth = i_BorderWidth * u_Scale; + v_BorderWidth = floor(i_BorderWidth * u_Scale); gl_Position = u_Transform * i_Transform * vec4(q_Pos, 0.0, 1.0); } |