Eliminate PaintContext

This commit is contained in:
Nathan Sobo
2023-09-11 09:00:59 -06:00
parent a24d94cfda
commit e0fdc7d0aa
49 changed files with 156 additions and 269 deletions
+3 -4
View File
@@ -3,7 +3,6 @@ use std::{cell::Cell, rc::Rc};
use crate::{
element::{AnyElement, Element, IntoElement, Layout, ParentElement},
hsla,
paint_context::PaintContext,
style::{CornerRadii, Overflow, Style, StyleHelpers, Styleable},
InteractionHandlers, Interactive, ViewContext,
};
@@ -69,7 +68,7 @@ impl<V: 'static> Element<V> for Div<V> {
parent_origin: Vector2F,
layout: &Layout,
child_layouts: &mut Vec<LayoutId>,
cx: &mut PaintContext<V>,
cx: &mut ViewContext<V>,
) where
Self: Sized,
{
@@ -167,7 +166,7 @@ impl<V: 'static> Div<V> {
bounds: RectF,
overflow: Point<Overflow>,
child_layout_ids: &[LayoutId],
cx: &mut PaintContext<V>,
cx: &mut ViewContext<V>,
) {
if overflow.y == Overflow::Scroll || overflow.x == Overflow::Scroll {
let mut scroll_max = Vector2F::zero();
@@ -214,7 +213,7 @@ impl<V: 'static> Div<V> {
}
}
fn paint_inspector(&self, parent_origin: Vector2F, layout: &Layout, cx: &mut PaintContext<V>) {
fn paint_inspector(&self, parent_origin: Vector2F, layout: &Layout, cx: &mut ViewContext<V>) {
let style = self.styles.merged();
let bounds = layout.bounds + parent_origin;
+1 -2
View File
@@ -1,7 +1,6 @@
use crate::{
element::{AnyElement, Element, IntoElement, Layout, ParentElement},
interactive::{InteractionHandlers, Interactive},
paint_context::PaintContext,
style::{Style, StyleHelpers, Styleable},
ViewContext,
};
@@ -59,7 +58,7 @@ impl<V: 'static, E: Element<V> + Styleable> Element<V> for Hoverable<E> {
parent_origin: Vector2F,
layout: &Layout,
paint_state: &mut Self::PaintState,
cx: &mut PaintContext<V>,
cx: &mut ViewContext<V>,
) where
Self: Sized,
{
+1 -1
View File
@@ -53,7 +53,7 @@ impl<V: 'static> Element<V> for Img {
parent_origin: Vector2F,
layout: &gpui::Layout,
_: &mut Self::PaintState,
cx: &mut crate::paint_context::PaintContext<V>,
cx: &mut crate::ViewContext<V>,
) where
Self: Sized,
{
+1 -2
View File
@@ -1,7 +1,6 @@
use crate::{
element::{AnyElement, Element, IntoElement, Layout, ParentElement},
interactive::{InteractionHandlers, Interactive},
paint_context::PaintContext,
style::{Style, StyleHelpers, Styleable},
ViewContext,
};
@@ -59,7 +58,7 @@ impl<V: 'static, E: Element<V> + Styleable> Element<V> for Pressable<E> {
parent_origin: Vector2F,
layout: &Layout,
paint_state: &mut Self::PaintState,
cx: &mut PaintContext<V>,
cx: &mut ViewContext<V>,
) where
Self: Sized,
{
+1 -1
View File
@@ -49,7 +49,7 @@ impl<V: 'static> Element<V> for Svg {
parent_origin: Vector2F,
layout: &Layout,
_: &mut Self::PaintState,
cx: &mut crate::paint_context::PaintContext<V>,
cx: &mut crate::ViewContext<V>,
) where
Self: Sized,
{
+1 -2
View File
@@ -1,6 +1,5 @@
use crate::{
element::{Element, IntoElement, Layout},
paint_context::PaintContext,
ViewContext,
};
use anyhow::Result;
@@ -71,7 +70,7 @@ impl<V: 'static> Element<V> for Text {
parent_origin: Vector2F,
layout: &Layout,
paint_state: &mut Self::PaintState,
cx: &mut PaintContext<V>,
cx: &mut ViewContext<V>,
) {
let bounds = layout.bounds + parent_origin;