[gtk+/wip/alexl/broadway4] broadway: Add inset shadow
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/alexl/broadway4] broadway: Add inset shadow
- Date: Wed, 22 Nov 2017 16:32:34 +0000 (UTC)
commit 6d27b73553e506305689ffd61a45ebdc274e755e
Author: Alexander Larsson <alexl redhat com>
Date: Wed Nov 22 09:59:22 2017 +0100
broadway: Add inset shadow
gdk/broadway/broadway-protocol.h | 1 +
gdk/broadway/broadway.js | 17 +++++++++++++++++
gdk/broadway/broadwayd.c | 1 +
gsk/gskbroadwayrenderer.c | 12 ++++++++++++
4 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/gdk/broadway/broadway-protocol.h b/gdk/broadway/broadway-protocol.h
index 4d99417..baead88 100644
--- a/gdk/broadway/broadway-protocol.h
+++ b/gdk/broadway/broadway-protocol.h
@@ -14,6 +14,7 @@ typedef enum { /* Sync changes with broadway.js */
BROADWAY_NODE_COLOR,
BROADWAY_NODE_BORDER,
BROADWAY_NODE_OUTSET_SHADOW,
+ BROADWAY_NODE_INSET_SHADOW,
} BroadwayNodeType;
typedef enum {
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 89e4e9d..926f56b 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -492,6 +492,23 @@ SwapNodes.prototype.handle_node = function(parent)
}
break;
+ case 5: // INSET_SHADOW
+ {
+ var rrect = this.decode_rounded_rect();
+ var color = this.decode_color();
+ var dx = this.decode_float();
+ var dy = this.decode_float();
+ var spread = this.decode_float();
+ var blur = this.decode_float();
+
+ var div = document.createElement('div');
+ div.style["position"] = "absolute";
+ set_rrect_style(div, rrect, null);
+ div.style["box-shadow"] = args("inset", px(dx), px(dy), px(blur), px(spread), color);
+ parent.appendChild(div);
+ }
+ break;
+
default:
alert("Unexpected node type " + type);
}
diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c
index de3d628..c54f86b 100644
--- a/gdk/broadway/broadwayd.c
+++ b/gdk/broadway/broadwayd.c
@@ -239,6 +239,7 @@ rewrite_node_textures (BroadwayClient *client,
case BROADWAY_NODE_BORDER:
pos += NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
break;
+ case BROADWAY_NODE_INSET_SHADOW:
case BROADWAY_NODE_OUTSET_SHADOW:
pos += NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_COLOR;
break;
diff --git a/gsk/gskbroadwayrenderer.c b/gsk/gskbroadwayrenderer.c
index c89f184..7a19185 100644
--- a/gsk/gskbroadwayrenderer.c
+++ b/gsk/gskbroadwayrenderer.c
@@ -210,6 +210,18 @@ gsk_broadway_renderer_add_node (GskRenderer *self,
}
return;
+ case GSK_INSET_SHADOW_NODE:
+ {
+ add_uint32 (nodes, BROADWAY_NODE_INSET_SHADOW);
+ add_rounded_rect (nodes, gsk_inset_shadow_node_peek_outline (node));
+ add_rgba (nodes, gsk_inset_shadow_node_peek_color (node));
+ add_float (nodes, gsk_inset_shadow_node_get_dx (node));
+ add_float (nodes, gsk_inset_shadow_node_get_dy (node));
+ add_float (nodes, gsk_inset_shadow_node_get_spread (node));
+ add_float (nodes, gsk_inset_shadow_node_get_blur_radius (node));
+ }
+ return;
+
default:
{
cairo_surface_t *surface;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]