diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-12 04:50:09 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-12 04:50:09 +0200 |
commit | e705c74a8d9e3fdf6ed181b8793ad7c8c7afb75f (patch) | |
tree | 5a16b464e45624a52f22ff669616f4b7d3051126 | |
parent | a462f8bcea50c7ad9f33eefc62c03f9ed6fd890b (diff) |
Fix uninitialized variable read resulting in item highlight being messed sometimes
-rw-r--r-- | include/Body.hpp | 2 | ||||
-rw-r--r-- | shaders/circle_mask.glsl | 2 | ||||
-rw-r--r-- | src/RoundedRectangle.cpp | 4 |
3 files changed, 3 insertions, 5 deletions
diff --git a/include/Body.hpp b/include/Body.hpp index 8ce05fc..7d19cf5 100644 --- a/include/Body.hpp +++ b/include/Body.hpp @@ -371,7 +371,7 @@ namespace QuickMedia { sf::Vector2f item_background_target_pos; sf::Vector2f item_background_prev_size; sf::Vector2f item_background_target_size; - float item_background_target_height; + float item_background_target_height = 0.0f; TargetSetState target_set = TargetSetState::NOT_SET; // TODO: Instead of using this, add functions for modifying |items| and apply the filter on those new items DirtyState items_dirty = DirtyState::FALSE; diff --git a/shaders/circle_mask.glsl b/shaders/circle_mask.glsl index 367edbe..519cf15 100644 --- a/shaders/circle_mask.glsl +++ b/shaders/circle_mask.glsl @@ -10,7 +10,7 @@ vec4 circle(vec2 uv, vec2 pos, float rad, vec4 color) { void main() { vec2 uv = gl_TexCoord[0].xy * resolution; vec2 center = resolution * 0.5; - float radius = 0.5 * resolution.y - 1; + float radius = 0.5 * resolution.y - 1.0; vec4 texture_color = texture2D(texture, gl_TexCoord[0].xy); gl_FragColor = circle(uv, center, radius, texture_color); diff --git a/src/RoundedRectangle.cpp b/src/RoundedRectangle.cpp index 735c182..33d7d64 100644 --- a/src/RoundedRectangle.cpp +++ b/src/RoundedRectangle.cpp @@ -8,14 +8,12 @@ namespace QuickMedia { radius(radius), pos(0.0f, 0.0f), size(size), rounded_rectangle_shader(rounded_rectangle_shader), band_color(sf::Color::Transparent) { assert(rounded_rectangle_shader); + set_color(color); vertices[0].texCoords = sf::Vector2f(0.0f, 0.0f); vertices[1].texCoords = sf::Vector2f(1.0f, 0.0f); vertices[2].texCoords = sf::Vector2f(1.0f, 1.0f); vertices[3].texCoords = sf::Vector2f(0.0f, 1.0f); - for(size_t i = 0; i < 4; ++i) - vertices[i].color = color; - const sf::Color shadow_color(0, 0, 0, 50); // Top |