shader_element: Store and set location separately

This commit is contained in:
Ivan Molodetskikh
2024-05-04 09:49:32 +04:00
parent 7aab413048
commit 69aeba2a4d
7 changed files with 75 additions and 55 deletions
@@ -62,15 +62,16 @@ impl TestCase for GradientAngle {
let area = Rectangle::from_loc_and_size((a, b), size);
[BorderRenderElement::new(
area,
area,
area.size,
Rectangle::from_loc_and_size((0, 0), area.size),
[1., 0., 0., 1.],
[0., 1., 0., 1.],
self.angle - FRAC_PI_2,
area,
Rectangle::from_loc_and_size((0, 0), area.size),
0.,
CornerRadius::default(),
)]
)
.with_location(area.loc)]
.into_iter()
.map(|elem| Box::new(elem) as _)
.collect()
+6 -4
View File
@@ -83,7 +83,8 @@ impl TestCase for GradientArea {
(size.h as f32 / 8. + size.h as f32 / 8. * 7. * f).round() as i32,
));
let g_loc = ((size.w - g_size.w) / 2, (size.h - g_size.h) / 2);
let g_area = Rectangle::from_loc_and_size(g_loc, g_size);
let mut g_area = Rectangle::from_loc_and_size(g_loc, g_size);
g_area.loc -= area.loc;
self.border.update(g_size, true, CornerRadius::default());
rv.extend(
@@ -99,15 +100,16 @@ impl TestCase for GradientArea {
rv.extend(
[BorderRenderElement::new(
area,
area.size,
g_area,
[1., 0., 0., 1.],
[0., 1., 0., 1.],
FRAC_PI_4,
area,
Rectangle::from_loc_and_size((0, 0), rect_size),
0.,
CornerRadius::default(),
)]
)
.with_location(area.loc)]
.into_iter()
.map(|elem| Box::new(elem) as _),
);