Refactor out element context from GPUI

This commit is contained in:
Mikayla
2024-01-21 19:43:35 -08:00
parent 2f9958621b
commit df4566fd1e
16 changed files with 1129 additions and 1036 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
use crate::{
black, fill, point, px, size, Bounds, Hsla, LineLayout, Pixels, Point, Result, SharedString,
UnderlineStyle, WindowContext, WrapBoundary, WrappedLineLayout,
black, fill, point, px, size, Bounds, ElementContext, Hsla, LineLayout, Pixels, Point, Result,
SharedString, UnderlineStyle, WrapBoundary, WrappedLineLayout,
};
use derive_more::{Deref, DerefMut};
use smallvec::SmallVec;
@@ -33,7 +33,7 @@ impl ShapedLine {
&self,
origin: Point<Pixels>,
line_height: Pixels,
cx: &mut WindowContext,
cx: &mut ElementContext,
) -> Result<()> {
paint_line(
origin,
@@ -66,7 +66,7 @@ impl WrappedLine {
&self,
origin: Point<Pixels>,
line_height: Pixels,
cx: &mut WindowContext,
cx: &mut ElementContext,
) -> Result<()> {
paint_line(
origin,
@@ -87,7 +87,7 @@ fn paint_line(
line_height: Pixels,
decoration_runs: &[DecorationRun],
wrap_boundaries: &[WrapBoundary],
cx: &mut WindowContext<'_>,
cx: &mut ElementContext<'_>,
) -> Result<()> {
let padding_top = (line_height - layout.ascent - layout.descent) / 2.;
let baseline_offset = point(px(0.), padding_top + layout.ascent);