Use paint and pick context to get framebuffer
Mutter and Clutter was changed to pass around the current target framebuffer via the paint context instead of via the deprecated Cogl framebuffer stack. The framebuffer stack has also been removed from Cogl so change to use the one in the paint context instead. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827
This commit is contained in:

committed by
Georges Basile Stavracas Neto

parent
988a0e7314
commit
632a643994
@ -472,25 +472,40 @@ class ObjInspector extends St.ScrollView {
|
||||
|
||||
var RedBorderEffect = GObject.registerClass(
|
||||
class RedBorderEffect extends Clutter.Effect {
|
||||
_init() {
|
||||
super._init();
|
||||
this._pipeline = null;
|
||||
}
|
||||
|
||||
vfunc_paint(paintContext) {
|
||||
let framebuffer = paintContext.get_framebuffer();
|
||||
let coglContext = framebuffer.get_context();
|
||||
let actor = this.get_actor();
|
||||
actor.continue_paint(paintContext);
|
||||
|
||||
let color = new Cogl.Color();
|
||||
color.init_from_4ub(0xff, 0, 0, 0xc4);
|
||||
Cogl.set_source_color(color);
|
||||
if (!this._pipeline) {
|
||||
let color = new Cogl.Color();
|
||||
color.init_from_4ub(0xff, 0, 0, 0xc4);
|
||||
|
||||
this._pipeline = new Cogl.Pipeline(coglContext);
|
||||
this._pipeline.set_color(color);
|
||||
}
|
||||
|
||||
let alloc = actor.get_allocation_box();
|
||||
let width = 2;
|
||||
|
||||
// clockwise order
|
||||
Cogl.rectangle(0, 0, alloc.get_width(), width);
|
||||
Cogl.rectangle(alloc.get_width() - width, width,
|
||||
alloc.get_width(), alloc.get_height());
|
||||
Cogl.rectangle(0, alloc.get_height(),
|
||||
alloc.get_width() - width, alloc.get_height() - width);
|
||||
Cogl.rectangle(0, alloc.get_height() - width,
|
||||
width, width);
|
||||
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);
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user