mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-29 13:46:31 +00:00
LibGfx: Skip manual cropping for the degenerate case
This commit is contained in:
parent
3c3da1ce8c
commit
e81c33da42
Notes:
github-actions[bot]
2025-08-04 21:40:27 +00:00
Author: https://github.com/IdanHo
Commit: e81c33da42
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5702
Reviewed-by: https://github.com/gmta ✅
1 changed files with 4 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue