| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 12252ef commit da1945d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,6 +14,7 @@ For license and copyright information please follow this link: | |||
| 14 | 14 | #include "ui/image/image_prepare.h" | |
| 15 | 15 | #include "ui/chat/attach/attach_extensions.h" | |
| 16 | 16 | #include "ui/chat/attach/attach_prepare.h" | |
| 17 | + #include "core/crash_reports.h" | ||
| 17 | 18 | ||
| 18 | 19 | #include <QtCore/QSemaphore> | |
| 19 | 20 | #include <QtCore/QMimeData> | |
@@ -328,10 +329,21 @@ void UpdateImageDetails(PreparedFile &file, int previewWidth) { | |||
| 328 | 329 | : image->data; | |
| 329 | 330 | Assert(!preview.isNull()); | |
| 330 | 331 | file.shownDimensions = PrepareShownDimensions(preview); | |
| 332 | + const auto toWidth = std::min( | ||
| 333 | + previewWidth, | ||
| 334 | + style::ConvertScale(preview.width()) | ||
| 335 | + ) * cIntRetinaFactor(); | ||
| 331 | 336 | const auto scaled = preview.scaledToWidth( | |
| 332 | - (std::min(previewWidth, style::ConvertScale(preview.width())) | ||
| 333 | - * cIntRetinaFactor()), | ||
| 337 | + toWidth, | ||
| 334 | 338 | Qt::SmoothTransformation); | |
| 339 | + if (scaled.isNull()) { | ||
| 340 | + CrashReports::SetAnnotation("Info", QString("%1x%2:%3*%4->%5;%6x%7" | ||
| 341 | + ).arg(preview.width()).arg(preview.height() | ||
| 342 | + ).arg(previewWidth).arg(cIntRetinaFactor() | ||
| 343 | + ).arg(toWidth | ||
| 344 | + ).arg(scaled.width()).arg(scaled.height())); | ||
| 345 | + Unexpected("Scaled is null."); | ||
| 346 | + } | ||
| 335 | 347 | Assert(!scaled.isNull()); | |
| 336 | 348 | file.preview = Images::prepareOpaque(scaled); | |
| 337 | 349 | Assert(!file.preview.isNull()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments