[libadwaita/wip/exalm/tab-style: 9/11] fade: Add width params
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libadwaita/wip/exalm/tab-style: 9/11] fade: Add width params
- Date: Wed, 6 Apr 2022 21:23:16 +0000 (UTC)
commit bc100a25ceef299ea4a5b6eef6196de1dede2b27
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Wed Apr 6 17:45:46 2022 +0400
fade: Add width params
We'll need to change the width for tab box.
src/adw-fading-label.c | 4 +++-
src/adw-tab.c | 4 +++-
src/glsl/fade.glsl | 8 ++++----
3 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/adw-fading-label.c b/src/adw-fading-label.c
index e9a685e1..91982904 100644
--- a/src/adw-fading-label.c
+++ b/src/adw-fading-label.c
@@ -13,7 +13,7 @@
#include "adw-bidi-private.h"
#include "adw-macros-private.h"
-#define FADE_WIDTH 18
+#define FADE_WIDTH 18.0f
struct _AdwFadingLabel
{
@@ -161,6 +161,8 @@ adw_fading_label_snapshot (GtkWidget *widget,
"offsetRight", 0.0f,
"strengthLeft", align > 0 ? 1.0f : 0.0f,
"strengthRight", align < 1 ? 1.0f : 0.0f,
+ "widthLeft", FADE_WIDTH,
+ "widthRight", FADE_WIDTH,
NULL));
} else {
gtk_snapshot_push_clip (snapshot, &bounds);
diff --git a/src/adw-tab.c b/src/adw-tab.c
index 6d8a8ebd..36978829 100644
--- a/src/adw-tab.c
+++ b/src/adw-tab.c
@@ -14,7 +14,7 @@
#include "adw-macros-private.h"
#include "adw-timed-animation.h"
-#define FADE_WIDTH 18
+#define FADE_WIDTH 18.0f
#define CLOSE_BTN_ANIMATION_DURATION 150
#define BASE_WIDTH 118
@@ -553,6 +553,8 @@ adw_tab_snapshot (GtkWidget *widget,
"offsetRight", is_rtl ? 0.0f : offset,
"strengthLeft", is_rtl ? opacity : 0.0f,
"strengthRight", is_rtl ? 0.0f : opacity,
+ "widthLeft", FADE_WIDTH,
+ "widthRight", FADE_WIDTH,
NULL));
} else {
bounds.size.width -= offset;
diff --git a/src/glsl/fade.glsl b/src/glsl/fade.glsl
index 3d99c221..0953d5b5 100644
--- a/src/glsl/fade.glsl
+++ b/src/glsl/fade.glsl
@@ -2,11 +2,11 @@ uniform float offsetLeft;
uniform float offsetRight;
uniform float strengthLeft;
uniform float strengthRight;
+uniform float widthLeft;
+uniform float widthRight;
uniform sampler2D u_texture1;
-#define FADE_WIDTH 18
-
void
mainImage (out vec4 fragColor,
in vec2 fragCoord,
@@ -18,10 +18,10 @@ mainImage (out vec4 fragColor,
fragColor = GskTexture (u_texture1, uv);
progress = fragCoord.x - offsetLeft;
- progress = min (max (progress / FADE_WIDTH, 0), 1);
+ progress = min (max (progress / widthLeft, 0), 1);
fragColor *= (1 + strengthLeft * (progress - 1));
progress = resolution.x - offsetRight - fragCoord.x;
- progress = min (max (progress / FADE_WIDTH, 0), 1);
+ progress = min (max (progress / widthRight, 0), 1);
fragColor *= (1 + strengthRight * (progress - 1));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]