1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use crate::render_object::*;

pub struct PipelineRenderObject;

impl Into<Box<dyn RenderObject>> for PipelineRenderObject {
    fn into(self) -> Box<dyn RenderObject> {
        Box::new(self)
    }
}

impl RenderObject for PipelineRenderObject {
    fn render_self(&self, ctx: &mut Context, _: &Point) {
        let bounds = *ctx.widget().get::<Rectangle>("bounds");
        let pipeline = ctx
            .widget()
            .get::<DefaultRenderPipeline>("render_pipeline")
            .0
            .clone();

        ctx.render_context_2_d().draw_pipeline(
            bounds.x(),
            bounds.y(),
            bounds.width(),
            bounds.height(),
            pipeline,
        );
    }
}