mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:07:44 +00:00
LibGfx: Calculate source rect once in do_draw_scaled_bitmap
This commit is contained in:
parent
f790a69431
commit
bec474d99b
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>
|
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)
|
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())
|
if (clipped_src_rect.is_empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if constexpr (!do_bilinear_blend) {
|
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())) {
|
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 hfactor = dst_rect.width() / int_src_rect.width();
|
||||||
int vfactor = dst_rect.height() / int_src_rect.height();
|
int vfactor = dst_rect.height() / int_src_rect.height();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue