mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
LibGfx: Calculate source rect once in do_draw_scaled_bitmap
This commit is contained in:
parent
f790a69431
commit
bec474d99b
Notes:
sideshowbarker
2024-07-17 16:52:37 +09:00
Author: https://github.com/gmta Commit: https://github.com/SerenityOS/serenity/commit/bec474d99b Pull-request: https://github.com/SerenityOS/serenity/pull/13207 Reviewed-by: https://github.com/TobyAsE ✅
1 changed files with 2 additions and 2 deletions
|
@ -1097,12 +1097,12 @@ ALWAYS_INLINE static void do_draw_integer_scaled_bitmap(Gfx::Bitmap& target, Int
|
|||
template<bool has_alpha_channel, bool do_bilinear_blend, typename GetPixel>
|
||||
ALWAYS_INLINE static void do_draw_scaled_bitmap(Gfx::Bitmap& target, IntRect const& dst_rect, IntRect const& clipped_rect, Gfx::Bitmap const& source, FloatRect const& src_rect, GetPixel get_pixel, float opacity)
|
||||
{
|
||||
auto clipped_src_rect = enclosing_int_rect(src_rect).intersected(source.rect());
|
||||
auto int_src_rect = enclosing_int_rect(src_rect);
|
||||
auto clipped_src_rect = int_src_rect.intersected(source.rect());
|
||||
if (clipped_src_rect.is_empty())
|
||||
return;
|
||||
|
||||
if constexpr (!do_bilinear_blend) {
|
||||
IntRect int_src_rect = enclosing_int_rect(src_rect);
|
||||
if (dst_rect == clipped_rect && int_src_rect == src_rect && !(dst_rect.width() % int_src_rect.width()) && !(dst_rect.height() % int_src_rect.height())) {
|
||||
int hfactor = dst_rect.width() / int_src_rect.width();
|
||||
int vfactor = dst_rect.height() / int_src_rect.height();
|
||||
|
|
Loading…
Reference in a new issue