10
10
11
11
namespace Web ::Painting {
12
12
13
- ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create (Gfx::IntRect const & border_rect, BorderRadiiData const & border_radii, CornerClip corner_clip, UseCachedBitmap use_cached_bitmap)
13
+ ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create (PaintContext& context, DevicePixelRect const & border_rect, BorderRadiiData const & border_radii, CornerClip corner_clip, UseCachedBitmap use_cached_bitmap)
14
14
{
15
15
VERIFY (border_radii.has_any_radius ());
16
16
17
- auto top_left = border_radii.top_left .as_corner ();
18
- auto top_right = border_radii.top_right .as_corner ();
19
- auto bottom_right = border_radii.bottom_right .as_corner ();
20
- auto bottom_left = border_radii.bottom_left .as_corner ();
17
+ auto top_left = border_radii.top_left .as_corner (context );
18
+ auto top_right = border_radii.top_right .as_corner (context );
19
+ auto bottom_right = border_radii.bottom_right .as_corner (context );
20
+ auto bottom_left = border_radii.bottom_left .as_corner (context );
21
21
22
- Gfx::IntSize corners_bitmap_size {
22
+ DevicePixelSize corners_bitmap_size {
23
23
max (
24
24
top_left.horizontal_radius + top_right.horizontal_radius ,
25
25
bottom_left.horizontal_radius + bottom_right.horizontal_radius ),
@@ -34,7 +34,7 @@ ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(Gfx::IntRec
34
34
if (!corner_bitmap)
35
35
return Error::from_errno (ENOMEM);
36
36
} else {
37
- corner_bitmap = TRY (Gfx::Bitmap::try_create (Gfx::BitmapFormat::BGRA8888, corners_bitmap_size));
37
+ corner_bitmap = TRY (Gfx::Bitmap::try_create (Gfx::BitmapFormat::BGRA8888, corners_bitmap_size. to_type < int >() ));
38
38
}
39
39
40
40
CornerData corner_data {
@@ -60,7 +60,7 @@ void BorderRadiusCornerClipper::sample_under_corners(Gfx::Painter& page_painter)
60
60
corner_aa_painter.fill_rect_with_rounded_corners (corner_rect, Color::NamedColor::Black,
61
61
m_data.corner_radii .top_left , m_data.corner_radii .top_right , m_data.corner_radii .bottom_right , m_data.corner_radii .bottom_left );
62
62
63
- auto copy_page_masked = [&](auto const & mask_src, auto const & page_location) {
63
+ auto copy_page_masked = [&](Gfx::IntRect const & mask_src, Gfx::IntPoint const & page_location) {
64
64
for (int row = 0 ; row < mask_src.height (); ++row) {
65
65
for (int col = 0 ; col < mask_src.width (); ++col) {
66
66
auto corner_location = mask_src.location ().translated (col, row);
@@ -81,13 +81,13 @@ void BorderRadiusCornerClipper::sample_under_corners(Gfx::Painter& page_painter)
81
81
82
82
// Copy the pixels under the corner mask (using the alpha of the mask):
83
83
if (m_data.corner_radii .top_left )
84
- copy_page_masked (m_data.corner_radii .top_left .as_rect ().translated (m_data.bitmap_locations .top_left ) , m_data.page_locations .top_left );
84
+ copy_page_masked (m_data.corner_radii .top_left .as_rect ().translated (m_data.bitmap_locations .top_left . to_type < int >()) , m_data.page_locations .top_left . to_type < int >() );
85
85
if (m_data.corner_radii .top_right )
86
- copy_page_masked (m_data.corner_radii .top_right .as_rect ().translated (m_data.bitmap_locations .top_right ) , m_data.page_locations .top_right );
86
+ copy_page_masked (m_data.corner_radii .top_right .as_rect ().translated (m_data.bitmap_locations .top_right . to_type < int >()) , m_data.page_locations .top_right . to_type < int >() );
87
87
if (m_data.corner_radii .bottom_right )
88
- copy_page_masked (m_data.corner_radii .bottom_right .as_rect ().translated (m_data.bitmap_locations .bottom_right ) , m_data.page_locations .bottom_right );
88
+ copy_page_masked (m_data.corner_radii .bottom_right .as_rect ().translated (m_data.bitmap_locations .bottom_right . to_type < int >()) , m_data.page_locations .bottom_right . to_type < int >() );
89
89
if (m_data.corner_radii .bottom_left )
90
- copy_page_masked (m_data.corner_radii .bottom_left .as_rect ().translated (m_data.bitmap_locations .bottom_left ) , m_data.page_locations .bottom_left );
90
+ copy_page_masked (m_data.corner_radii .bottom_left .as_rect ().translated (m_data.bitmap_locations .bottom_left . to_type < int >()) , m_data.page_locations .bottom_left . to_type < int >() );
91
91
92
92
m_has_sampled = true ;
93
93
}
@@ -98,13 +98,13 @@ void BorderRadiusCornerClipper::blit_corner_clipping(Gfx::Painter& painter)
98
98
99
99
// Restore the corners:
100
100
if (m_data.corner_radii .top_left )
101
- painter.blit (m_data.page_locations .top_left , *m_corner_bitmap, m_data.corner_radii .top_left .as_rect ().translated (m_data.bitmap_locations .top_left ));
101
+ painter.blit (m_data.page_locations .top_left . to_type < int >() , *m_corner_bitmap, m_data.corner_radii .top_left .as_rect ().translated (m_data.bitmap_locations .top_left . to_type < int >() ));
102
102
if (m_data.corner_radii .top_right )
103
- painter.blit (m_data.page_locations .top_right , *m_corner_bitmap, m_data.corner_radii .top_right .as_rect ().translated (m_data.bitmap_locations .top_right ));
103
+ painter.blit (m_data.page_locations .top_right . to_type < int >() , *m_corner_bitmap, m_data.corner_radii .top_right .as_rect ().translated (m_data.bitmap_locations .top_right . to_type < int >() ));
104
104
if (m_data.corner_radii .bottom_right )
105
- painter.blit (m_data.page_locations .bottom_right , *m_corner_bitmap, m_data.corner_radii .bottom_right .as_rect ().translated (m_data.bitmap_locations .bottom_right ));
105
+ painter.blit (m_data.page_locations .bottom_right . to_type < int >() , *m_corner_bitmap, m_data.corner_radii .bottom_right .as_rect ().translated (m_data.bitmap_locations .bottom_right . to_type < int >() ));
106
106
if (m_data.corner_radii .bottom_left )
107
- painter.blit (m_data.page_locations .bottom_left , *m_corner_bitmap, m_data.corner_radii .bottom_left .as_rect ().translated (m_data.bitmap_locations .bottom_left ));
107
+ painter.blit (m_data.page_locations .bottom_left . to_type < int >() , *m_corner_bitmap, m_data.corner_radii .bottom_left .as_rect ().translated (m_data.bitmap_locations .bottom_left . to_type < int >() ));
108
108
}
109
109
110
110
}
0 commit comments