From f93c2bb5e5393c074b56c4f571d7d4800891b776 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Feb 2022 11:05:52 +0300 Subject: [PATCH] Always convert to ARGB before rounding. --- ui/image/image_prepare.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/image/image_prepare.cpp b/ui/image/image_prepare.cpp index da8bc33..83900f5 100644 --- a/ui/image/image_prepare.cpp +++ b/ui/image/image_prepare.cpp @@ -1011,6 +1011,10 @@ QImage Round( return std::move(image); } + image = std::move(image).convertToFormat( + QImage::Format_ARGB32_Premultiplied); + Assert(!image.isNull()); + // We need to detach image first (if it is shared), before we // count some offsets using QImage::bytesPerLine etc, because // bytesPerLine may change on detach, this leads to crashes: @@ -1068,10 +1072,6 @@ QImage Round( } Assert(!image.isNull()); - image = std::move(image).convertToFormat( - QImage::Format_ARGB32_Premultiplied); - Assert(!image.isNull()); - const auto masks = CornersMask(radius); return Round(std::move(image), masks, corners, target); }