lookingGlass: Port to paint nodes

Override vfunc_paint_node(), and add paint nodes to the
root node instead of directly calling CoglFramebuffer APIs.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1339
This commit is contained in:
Georges Basile Stavracas Neto 2020-06-29 18:01:44 -03:00 committed by Robert Mader
parent 6f75274eec
commit bdb28535df

View File

@ -482,13 +482,16 @@ class RedBorderEffect extends Clutter.Effect {
this._pipeline = null; this._pipeline = null;
} }
vfunc_paint(paintContext) { vfunc_paint_node(node, paintContext) {
let framebuffer = paintContext.get_framebuffer();
let coglContext = framebuffer.get_context();
let actor = this.get_actor(); let actor = this.get_actor();
actor.continue_paint(paintContext);
const actorNode = new Clutter.ActorNode(actor);
node.add_child(actorNode, -1);
if (!this._pipeline) { if (!this._pipeline) {
const framebuffer = paintContext.get_framebuffer();
const coglContext = framebuffer.get_context();
let color = new Cogl.Color(); let color = new Cogl.Color();
color.init_from_4ub(0xff, 0, 0, 0xc4); color.init_from_4ub(0xff, 0, 0, 0xc4);
@ -499,18 +502,28 @@ class RedBorderEffect extends Clutter.Effect {
let alloc = actor.get_allocation_box(); let alloc = actor.get_allocation_box();
let width = 2; let width = 2;
const pipelineNode = new Clutter.PipelineNode(this._pipeline);
pipelineNode.set_name('Red Border');
actorNode.add_child(pipelineNode);
const box = new Clutter.ActorBox();
// clockwise order // clockwise order
framebuffer.draw_rectangle(this._pipeline, box.set_origin(0, 0);
0, 0, alloc.get_width(), width); box.set_size(alloc.get_width(), width);
framebuffer.draw_rectangle(this._pipeline, pipelineNode.add_rectangle(box);
alloc.get_width() - width, width,
alloc.get_width(), alloc.get_height()); box.set_origin(alloc.get_width() - width, width);
framebuffer.draw_rectangle(this._pipeline, box.set_size(width, alloc.get_height());
0, alloc.get_height(), pipelineNode.add_rectangle(box);
alloc.get_width() - width, alloc.get_height() - width);
framebuffer.draw_rectangle(this._pipeline, box.set_origin(0, alloc.get_height() - width);
0, alloc.get_height() - width, box.set_size(alloc.get_width() - width, width);
width, width); pipelineNode.add_rectangle(box);
box.set_origin(0, width);
box.set_size(width, alloc.get_height() - width);
pipelineNode.add_rectangle(box);
} }
}); });