mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibGfx: Skip manual cropping for the degenerate case
This commit is contained in:
parent
3c3da1ce8c
commit
e81c33da42
|
|
@ -160,6 +160,10 @@ void Bitmap::apply_mask(Gfx::Bitmap const& mask, MaskKind mask_kind)
|
|||
|
||||
ErrorOr<NonnullRefPtr<Gfx::Bitmap>> Bitmap::cropped(Gfx::IntRect crop, Gfx::Color outside_color) const
|
||||
{
|
||||
// OPTIMIZATION: Skip slow manual copying for NO-OP crops
|
||||
if (crop == rect())
|
||||
return clone();
|
||||
|
||||
auto new_bitmap = TRY(Gfx::Bitmap::create(format(), alpha_type(), { crop.width(), crop.height() }));
|
||||
|
||||
for (int y = 0; y < crop.height(); ++y) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user