broadway: Add inset shadow

This commit is contained in:
Alexander Larsson 2017-11-22 09:59:22 +01:00
parent 35ceb8e626
commit 0083c084e4
4 changed files with 31 additions and 0 deletions

View File

@ -14,6 +14,7 @@ typedef enum { /* Sync changes with broadway.js */
BROADWAY_NODE_COLOR, BROADWAY_NODE_COLOR,
BROADWAY_NODE_BORDER, BROADWAY_NODE_BORDER,
BROADWAY_NODE_OUTSET_SHADOW, BROADWAY_NODE_OUTSET_SHADOW,
BROADWAY_NODE_INSET_SHADOW,
} BroadwayNodeType; } BroadwayNodeType;
typedef enum { typedef enum {

View File

@ -492,6 +492,23 @@ SwapNodes.prototype.handle_node = function(parent)
} }
break; 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: default:
alert("Unexpected node type " + type); alert("Unexpected node type " + type);
} }

View File

@ -239,6 +239,7 @@ rewrite_node_textures (BroadwayClient *client,
case BROADWAY_NODE_BORDER: case BROADWAY_NODE_BORDER:
pos += NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR; pos += NODE_SIZE_RRECT + 4 * NODE_SIZE_FLOAT + 4 * NODE_SIZE_COLOR;
break; break;
case BROADWAY_NODE_INSET_SHADOW:
case BROADWAY_NODE_OUTSET_SHADOW: case BROADWAY_NODE_OUTSET_SHADOW:
pos += NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_COLOR; pos += NODE_SIZE_RRECT + NODE_SIZE_COLOR + 4 * NODE_SIZE_COLOR;
break; break;

View File

@ -210,6 +210,18 @@ gsk_broadway_renderer_add_node (GskRenderer *self,
} }
return; 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: default:
{ {
cairo_surface_t *surface; cairo_surface_t *surface;