mirror of
https://github.com/elementary/gala.git
synced 2024-12-27 19:24:40 +03:00
5644c66724
Update to the latest version on time.
29 lines
828 B
Vala
29 lines
828 B
Vala
/*
|
|
* Copyright 2024 elementary, Inc. (https://elementary.io)
|
|
* SPDX-License-Identifier: LGPL-2.0-or-later
|
|
*/
|
|
|
|
public class Gala.CanvasActor : Clutter.Actor {
|
|
private Gala.Drawing.Canvas canvas;
|
|
|
|
construct {
|
|
canvas = new Gala.Drawing.Canvas ();
|
|
content = canvas;
|
|
canvas.draw.connect ((ctx, width, height) => {
|
|
draw (ctx, width, height);
|
|
});
|
|
}
|
|
|
|
public override void resource_scale_changed () {
|
|
canvas.set_scale_factor (get_resource_scale ());
|
|
}
|
|
|
|
public override void allocate (Clutter.ActorBox box) {
|
|
base.allocate (box);
|
|
canvas.set_size ((int)box.get_width (), (int)box.get_height ());
|
|
canvas.set_scale_factor (get_resource_scale ());
|
|
}
|
|
|
|
protected virtual void draw (Cairo.Context canvas, int width, int height) { }
|
|
}
|