aboutsummaryrefslogtreecommitdiff
path: root/src/Body.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2022-03-05 07:45:14 +0100
committerdec05eba <dec05eba@protonmail.com>2022-03-05 07:45:14 +0100
commit0a64acc3d68fecf5e7f23c6b0a013272f9288af8 (patch)
treec9390c71fdd827ed945610bf884f69eb236d9879 /src/Body.cpp
parent63d18f733602f9b7381a03b72a17662a99c44fc2 (diff)
Make ui behavior nicer with spacing_scale less than 1.0
Diffstat (limited to 'src/Body.cpp')
-rw-r--r--src/Body.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Body.cpp b/src/Body.cpp
index 6fdb285..1c436f5 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -1378,10 +1378,10 @@ namespace QuickMedia {
auto image_scale = get_ratio(image_size_f, new_image_size);
image.set_scale(image_scale);
image.set_position(item_pos + mgl::vec2f(body_spacing[body_theme].image_padding_x, padding_y));
- if(thumbnail_mask_shader && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
+ if(thumbnail_mask_shader && thumbnail_mask_shader->is_valid() && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
thumbnail_mask_shader->set_uniform("resolution", new_image_size);
window.draw(image, thumbnail_mask_shader);
- } else if(rounded_rectangle_mask_shader) {
+ } else if(rounded_rectangle_mask_shader && rounded_rectangle_mask_shader->is_valid()) {
rounded_rectangle_mask_shader->set_uniform("radius", 10.0f);
rounded_rectangle_mask_shader->set_uniform("resolution", new_image_size);
window.draw(image, rounded_rectangle_mask_shader);
@@ -1395,7 +1395,7 @@ namespace QuickMedia {
} else if(!item->thumbnail_url.empty()) {
mgl::vec2f content_size = thumbnail_size.to_vec2f();
- if(thumbnail_mask_shader && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
+ if(thumbnail_mask_shader && thumbnail_mask_shader->is_valid() && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
// TODO: Use the mask shader instead, but a vertex shader is also needed for that to pass the vertex coordinates since
// shapes dont have texture coordinates.
// TODO: Cache circle shape
@@ -1556,10 +1556,10 @@ namespace QuickMedia {
image.set_scale(image_scale);
image.set_position(pos + pos_offset + mgl::vec2f(card_padding_x, card_padding_y) + mgl::vec2f(card_max_image_size.x * 0.5f, 0.0f) - mgl::vec2f(new_image_size.x * 0.5f, 0.0f));
image_height = new_image_size.y;
- if(thumbnail_mask_shader && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
+ if(thumbnail_mask_shader && thumbnail_mask_shader->is_valid() && item->thumbnail_mask_type == ThumbnailMaskType::CIRCLE) {
thumbnail_mask_shader->set_uniform("resolution", new_image_size);
window.draw(image, thumbnail_mask_shader);
- } else if(rounded_rectangle_mask_shader) {
+ } else if(rounded_rectangle_mask_shader && rounded_rectangle_mask_shader->is_valid()) {
rounded_rectangle_mask_shader->set_uniform("radius", 10.0f);
rounded_rectangle_mask_shader->set_uniform("resolution", new_image_size);
window.draw(image, rounded_rectangle_mask_shader);