summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>2020-06-29 18:01:44 -0300
committerMarge Bot <marge-bot@gnome.org>2020-12-10 16:15:49 +0000
commit0c6df924befd2f9deb82c391b0f0418f1cdb9466 (patch)
treefdac39b7a2a8b5468050d2ee9788655541b809d9
parent71807a4f10895b9fb104130e077e24450021c8a2 (diff)
downloadgnome-shell-gbsneto/effects-paint-nodes.tar.gz
lookingGlass: Port to paint nodesgbsneto/effects-paint-nodes
Override vfunc_paint_node(), and add paint nodes to the root node instead of directly calling CoglFramebuffer APIs. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1339>
-rw-r--r--js/ui/lookingGlass.js43
1 files changed, 28 insertions, 15 deletions
diff --git a/js/ui/lookingGlass.js b/js/ui/lookingGlass.js
index 109c04631..728983ea2 100644
--- a/js/ui/lookingGlass.js
+++ b/js/ui/lookingGlass.js
@@ -481,13 +481,16 @@ class RedBorderEffect extends Clutter.Effect {
this._pipeline = null;
}
- vfunc_paint(paintContext) {
- let framebuffer = paintContext.get_framebuffer();
- let coglContext = framebuffer.get_context();
+ vfunc_paint_node(node, paintContext) {
let actor = this.get_actor();
- actor.continue_paint(paintContext);
+
+ const actorNode = new Clutter.ActorNode(actor, -1);
+ node.add_child(actorNode);
if (!this._pipeline) {
+ const framebuffer = paintContext.get_framebuffer();
+ const coglContext = framebuffer.get_context();
+
let color = new Cogl.Color();
color.init_from_4ub(0xff, 0, 0, 0xc4);
@@ -498,18 +501,28 @@ class RedBorderEffect extends Clutter.Effect {
let alloc = actor.get_allocation_box();
let width = 2;
+ const pipelineNode = new Clutter.PipelineNode(this._pipeline);
+ pipelineNode.set_name('Red Border');
+ node.add_child(pipelineNode);
+
+ const box = new Clutter.ActorBox();
+
// clockwise order
- framebuffer.draw_rectangle(this._pipeline,
- 0, 0, alloc.get_width(), width);
- framebuffer.draw_rectangle(this._pipeline,
- alloc.get_width() - width, width,
- alloc.get_width(), alloc.get_height());
- framebuffer.draw_rectangle(this._pipeline,
- 0, alloc.get_height(),
- alloc.get_width() - width, alloc.get_height() - width);
- framebuffer.draw_rectangle(this._pipeline,
- 0, alloc.get_height() - width,
- width, width);
+ box.set_origin(0, 0);
+ box.set_size(alloc.get_width(), width);
+ pipelineNode.add_rectangle(box);
+
+ box.set_origin(alloc.get_width() - width, width);
+ box.set_size(width, alloc.get_height());
+ pipelineNode.add_rectangle(box);
+
+ box.set_origin(0, alloc.get_height() - width);
+ box.set_size(alloc.get_width() - width, width);
+ pipelineNode.add_rectangle(box);
+
+ box.set_origin(0, width);
+ box.set_size(width, alloc.get_height() - width);
+ pipelineNode.add_rectangle(box);
}
});