HACKING.md: Update sample code to use paint context
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/827
This commit is contained in:
parent
632a643994
commit
8c4d07ba92
12
HACKING.md
12
HACKING.md
@ -163,10 +163,16 @@ you to inherit from a type to use it, you can do so:
|
|||||||
return [100, 100];
|
return [100, 100];
|
||||||
}
|
}
|
||||||
|
|
||||||
vfunc_paint() {
|
vfunc_paint(paintContext) {
|
||||||
|
let framebuffer = paintContext.get_framebuffer();
|
||||||
|
let coglContext = framebuffer.get_context();
|
||||||
let alloc = this.get_allocation_box();
|
let alloc = this.get_allocation_box();
|
||||||
Cogl.set_source_color4ub(255, 0, 0, 255);
|
|
||||||
Cogl.rectangle(alloc.x1, alloc.y1,
|
let pipeline = new Cogl.Pipeline(coglContext);
|
||||||
|
pipeline.set_color4ub(255, 0, 0, 255);
|
||||||
|
|
||||||
|
framebuffer.draw_rectangle(pipeline,
|
||||||
|
alloc.x1, alloc.y1,
|
||||||
alloc.x2, alloc.y2);
|
alloc.x2, alloc.y2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user