mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-12 04:22:28 +00:00
LibGfx: Add shortcut to draw_scaled_bitmap_with_transform()
for scales
Using `draw_scaled_bitmap()` for simple scales is almost always better than using `draw_scaled_bitmap_with_transform()` which does not respect the scaling mode.
This commit is contained in:
parent
f7bf14605c
commit
a5442ad70d
Notes:
sideshowbarker
2024-07-17 18:13:59 +09:00
Author: https://github.com/MacDue
Commit: a5442ad70d
Pull-request: https://github.com/SerenityOS/serenity/pull/24465
Issue: https://github.com/SerenityOS/serenity/issues/24252
Reviewed-by: https://github.com/kalenikaliaksandr ✅
2 changed files with 7 additions and 4 deletions
|
@ -2447,10 +2447,8 @@ void Painter::draw_text_run(FloatPoint baseline_start, Utf8View const& string, F
|
|||
|
||||
void Painter::draw_scaled_bitmap_with_transform(IntRect const& dst_rect, Bitmap const& bitmap, FloatRect const& src_rect, AffineTransform const& transform, float opacity, Painter::ScalingMode scaling_mode)
|
||||
{
|
||||
if (transform.is_identity_or_translation()) {
|
||||
translate(transform.e(), transform.f());
|
||||
draw_scaled_bitmap(dst_rect, bitmap, src_rect, opacity, scaling_mode);
|
||||
translate(-transform.e(), -transform.f());
|
||||
if (transform.is_identity_or_translation_or_scale()) {
|
||||
draw_scaled_bitmap(transform.map(dst_rect.to_type<float>()).to_rounded<int>(), bitmap, src_rect, opacity, scaling_mode);
|
||||
} else {
|
||||
// The painter has an affine transform, we have to draw through it!
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue