mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add some more information for an assertion violation.
This commit is contained in:
parent
12252ef1aa
commit
da1945d0ca
1 changed files with 14 additions and 2 deletions
|
@ -14,6 +14,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/image/image_prepare.h"
|
#include "ui/image/image_prepare.h"
|
||||||
#include "ui/chat/attach/attach_extensions.h"
|
#include "ui/chat/attach/attach_extensions.h"
|
||||||
#include "ui/chat/attach/attach_prepare.h"
|
#include "ui/chat/attach/attach_prepare.h"
|
||||||
|
#include "core/crash_reports.h"
|
||||||
|
|
||||||
#include <QtCore/QSemaphore>
|
#include <QtCore/QSemaphore>
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
@ -328,10 +329,21 @@ void UpdateImageDetails(PreparedFile &file, int previewWidth) {
|
||||||
: image->data;
|
: image->data;
|
||||||
Assert(!preview.isNull());
|
Assert(!preview.isNull());
|
||||||
file.shownDimensions = PrepareShownDimensions(preview);
|
file.shownDimensions = PrepareShownDimensions(preview);
|
||||||
|
const auto toWidth = std::min(
|
||||||
|
previewWidth,
|
||||||
|
style::ConvertScale(preview.width())
|
||||||
|
) * cIntRetinaFactor();
|
||||||
const auto scaled = preview.scaledToWidth(
|
const auto scaled = preview.scaledToWidth(
|
||||||
(std::min(previewWidth, style::ConvertScale(preview.width()))
|
toWidth,
|
||||||
* cIntRetinaFactor()),
|
|
||||||
Qt::SmoothTransformation);
|
Qt::SmoothTransformation);
|
||||||
|
if (scaled.isNull()) {
|
||||||
|
CrashReports::SetAnnotation("Info", QString("%1x%2:%3*%4->%5;%6x%7"
|
||||||
|
).arg(preview.width()).arg(preview.height()
|
||||||
|
).arg(previewWidth).arg(cIntRetinaFactor()
|
||||||
|
).arg(toWidth
|
||||||
|
).arg(scaled.width()).arg(scaled.height()));
|
||||||
|
Unexpected("Scaled is null.");
|
||||||
|
}
|
||||||
Assert(!scaled.isNull());
|
Assert(!scaled.isNull());
|
||||||
file.preview = Images::prepareOpaque(scaled);
|
file.preview = Images::prepareOpaque(scaled);
|
||||||
Assert(!file.preview.isNull());
|
Assert(!file.preview.isNull());
|
||||||
|
|
Loading…
Add table
Reference in a new issue