mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-01-25 08:44:38 +00:00
fixed gif animations on retina display
This commit is contained in:
parent
e7b94f3d3a
commit
e2d02f4e4b
@ -2617,8 +2617,8 @@ HistoryDocument::HistoryDocument(DocumentData *document) : HistoryMedia()
|
|||||||
|
|
||||||
void HistoryDocument::initDimensions(const HistoryItem *parent) {
|
void HistoryDocument::initDimensions(const HistoryItem *parent) {
|
||||||
if (parent == animated.msg) {
|
if (parent == animated.msg) {
|
||||||
_maxw = animated.w;
|
_maxw = animated.w / cIntRetinaFactor();
|
||||||
_minh = animated.h;
|
_minh = animated.h / cIntRetinaFactor();
|
||||||
} else {
|
} else {
|
||||||
_maxw = st::mediaMaxWidth;
|
_maxw = st::mediaMaxWidth;
|
||||||
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
int32 tleft = st::mediaPadding.left() + st::mediaThumbSize + st::mediaPadding.right();
|
||||||
@ -2651,7 +2651,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected
|
|||||||
|
|
||||||
bool out = parent->out(), hovered, pressed;
|
bool out = parent->out(), hovered, pressed;
|
||||||
if (parent == animated.msg) {
|
if (parent == animated.msg) {
|
||||||
int32 pw = animated.w, ph = animated.h;
|
int32 pw = animated.w / cIntRetinaFactor(), ph = animated.h / cIntRetinaFactor();
|
||||||
if (width < pw) {
|
if (width < pw) {
|
||||||
pw = width;
|
pw = width;
|
||||||
ph = (pw == w) ? _height : (pw * animated.h / animated.w);
|
ph = (pw == w) ? _height : (pw * animated.h / animated.w);
|
||||||
@ -2660,7 +2660,7 @@ void HistoryDocument::draw(QPainter &p, const HistoryItem *parent, bool selected
|
|||||||
|
|
||||||
App::roundShadow(p, 0, 0, pw, ph, selected ? st::msgInSelectShadow : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners);
|
App::roundShadow(p, 0, 0, pw, ph, selected ? st::msgInSelectShadow : st::msgInShadow, selected ? InSelectedShadowCorners : InShadowCorners);
|
||||||
|
|
||||||
p.drawPixmap(0, 0, animated.current(pw, ph, true));
|
p.drawPixmap(0, 0, animated.current(pw * cIntRetinaFactor(), ph * cIntRetinaFactor(), true));
|
||||||
if (selected) {
|
if (selected) {
|
||||||
App::roundRect(p, 0, 0, pw, ph, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
App::roundRect(p, 0, 0, pw, ph, textstyleCurrent()->selectOverlay, SelectedOverlayCorners);
|
||||||
}
|
}
|
||||||
@ -2812,9 +2812,9 @@ int32 HistoryDocument::resize(int32 width, bool dontRecountText, const HistoryIt
|
|||||||
if (w > st::maxMediaSize) {
|
if (w > st::maxMediaSize) {
|
||||||
w = st::maxMediaSize;
|
w = st::maxMediaSize;
|
||||||
}
|
}
|
||||||
_height = animated.h;
|
_height = animated.h / cIntRetinaFactor();
|
||||||
if (animated.w > w) {
|
if (animated.w / cIntRetinaFactor() > w) {
|
||||||
_height = (w * _height / animated.w);
|
_height = (w * _height / (animated.w / cIntRetinaFactor()));
|
||||||
if (_height <= 0) _height = 1;
|
if (_height <= 0) _height = 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user