diff --git a/crates/gpui/playground/src/adapter.rs b/crates/gpui/playground/src/adapter.rs index 0743a817f7bcf279e7cf50b0a63f46075c6324f8..5ce4fd3b60d7da3d105b4a69691c9d1223327c6c 100644 --- a/crates/gpui/playground/src/adapter.rs +++ b/crates/gpui/playground/src/adapter.rs @@ -1,4 +1,5 @@ -use crate::element::LayoutContext; +use crate::element::{LayoutContext, PaintContext}; +use gpui::geometry::rect::RectF; use util::ResultExt; use crate::element::AnyElement; @@ -22,11 +23,8 @@ impl gpui::Element for Adapter { .log_err(); if let Some(node) = node { - legacy_cx - .layout_engine() - .unwrap() - .compute_layout(node, constraint.max) - .log_err(); + let layout_engine = legacy_cx.layout_engine().unwrap(); + layout_engine.compute_layout(node, constraint.max).log_err(); } legacy_cx.pop_layout_engine(); @@ -36,31 +34,32 @@ impl gpui::Element for Adapter { fn paint( &mut self, scene: &mut gpui::SceneBuilder, - bounds: gpui::geometry::rect::RectF, - visible_bounds: gpui::geometry::rect::RectF, - layout: &mut Self::LayoutState, + bounds: RectF, + visible_bounds: RectF, + layout: &mut (), view: &mut V, - cx: &mut gpui::PaintContext, + legacy_cx: &mut gpui::PaintContext, ) -> Self::PaintState { - todo!() + let mut cx = PaintContext { legacy_cx, scene }; + self.0.paint(view, &mut cx).log_err(); } fn rect_for_text_range( &self, range_utf16: std::ops::Range, - bounds: gpui::geometry::rect::RectF, - visible_bounds: gpui::geometry::rect::RectF, + bounds: RectF, + visible_bounds: RectF, layout: &Self::LayoutState, paint: &Self::PaintState, view: &V, cx: &gpui::ViewContext, - ) -> Option { + ) -> Option { todo!() } fn debug( &self, - bounds: gpui::geometry::rect::RectF, + bounds: RectF, layout: &Self::LayoutState, paint: &Self::PaintState, view: &V, diff --git a/crates/gpui/playground/src/element.rs b/crates/gpui/playground/src/element.rs index 2355ff64f4a4e12d0967b58d61d1418b29a0c3ae..dee1b92acefb5faee8b6aecc4522e7234540b532 100644 --- a/crates/gpui/playground/src/element.rs +++ b/crates/gpui/playground/src/element.rs @@ -15,7 +15,7 @@ pub struct PaintContext<'a, 'b, 'c, 'd, V> { #[deref] #[deref_mut] pub(crate) legacy_cx: &'d mut LegacyPaintContext<'a, 'b, 'c, V>, - scene: &'d mut gpui::SceneBuilder, + pub(crate) scene: &'d mut gpui::SceneBuilder, } pub trait Element {