瀏覽代碼

LibWeb: Fix logic mistake in CRC2D's default_source_size()

If the source has a bitmap, we should indeed use the bitmap's size
instead of always using the source's own size.
Andreas Kling 3 年之前
父節點
當前提交
36d9943d3a
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp

+ 3 - 2
Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp

@@ -102,9 +102,10 @@ static void default_source_size(CanvasImageSource const& image, float& source_wi
         if (source->bitmap()) {
             source_width = source->bitmap()->width();
             source_height = source->bitmap()->height();
+        } else {
+            source_width = source->width();
+            source_height = source->height();
         }
-        source_width = source->width();
-        source_height = source->height();
     });
 }