mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-25 19:02:07 -05:00
LibWeb: Add option to allocate new bitmap for BorderRadiusCornerClipper
This will be needed for overflow: hidden, that clips things which may themselves use the BorderRadiusCornerClipper.
This commit is contained in:
parent
13b4d91f66
commit
9a97adf121
2 changed files with 15 additions and 5 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace Web::Painting {
|
||||
|
||||
ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(Gfx::IntRect const& border_rect, BorderRadiiData const& border_radii, CornerClip corner_clip)
|
||||
ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(Gfx::IntRect const& border_rect, BorderRadiiData const& border_radii, CornerClip corner_clip, UseCachedBitmap use_cached_bitmap)
|
||||
{
|
||||
VERIFY(border_radii.has_any_radius());
|
||||
|
||||
|
@ -28,9 +28,14 @@ ErrorOr<BorderRadiusCornerClipper> BorderRadiusCornerClipper::create(Gfx::IntRec
|
|||
top_right.vertical_radius + bottom_right.vertical_radius)
|
||||
};
|
||||
|
||||
auto corner_bitmap = get_cached_corner_bitmap(corners_bitmap_size);
|
||||
if (!corner_bitmap)
|
||||
return Error::from_errno(ENOMEM);
|
||||
RefPtr<Gfx::Bitmap> corner_bitmap;
|
||||
if (use_cached_bitmap == UseCachedBitmap::Yes) {
|
||||
corner_bitmap = get_cached_corner_bitmap(corners_bitmap_size);
|
||||
if (!corner_bitmap)
|
||||
return Error::from_errno(ENOMEM);
|
||||
} else {
|
||||
corner_bitmap = TRY(Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRA8888, corners_bitmap_size));
|
||||
}
|
||||
|
||||
CornerData corner_data {
|
||||
.corner_radii = {
|
||||
|
|
|
@ -18,7 +18,12 @@ enum class CornerClip {
|
|||
|
||||
class BorderRadiusCornerClipper {
|
||||
public:
|
||||
static ErrorOr<BorderRadiusCornerClipper> create(Gfx::IntRect const& border_rect, BorderRadiiData const& border_radii, CornerClip corner_clip = CornerClip::Outside);
|
||||
enum class UseCachedBitmap {
|
||||
Yes,
|
||||
No
|
||||
};
|
||||
|
||||
static ErrorOr<BorderRadiusCornerClipper> create(Gfx::IntRect const& border_rect, BorderRadiiData const& border_radii, CornerClip corner_clip = CornerClip::Outside, UseCachedBitmap use_cached_bitmap = UseCachedBitmap::Yes);
|
||||
|
||||
void sample_under_corners(Gfx::Painter& page_painter);
|
||||
void blit_corner_clipping(Gfx::Painter& page_painter);
|
||||
|
|
Loading…
Add table
Reference in a new issue