mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-26 00:12:25 +00:00
Fix location thumb image sizes
This commit is contained in:
parent
3cdfa1014a
commit
f2866442d2
@ -18,9 +18,9 @@ constexpr auto kMaxHttpRedirects = 5;
|
||||
|
||||
GeoPointLocation ComputeLocation(const LocationCoords &coords) {
|
||||
const auto scale = 1 + (cScale() * cIntRetinaFactor()) / 200;
|
||||
const auto zoom = 15 + (scale - 1);
|
||||
const auto w = ConvertScale(st::locationSize.width()) / scale;
|
||||
const auto h = ConvertScale(st::locationSize.height()) / scale;
|
||||
const auto zoom = 13 + (scale - 1);
|
||||
const auto w = st::locationSize.width() / scale;
|
||||
const auto h = st::locationSize.height() / scale;
|
||||
|
||||
auto result = GeoPointLocation();
|
||||
result.lat = coords.lat();
|
||||
|
@ -4829,17 +4829,7 @@ void HistoryLocation::draw(Painter &p, const QRect &r, TextSelection selection,
|
||||
| (isBubbleBottom() ? (RectPart::BottomLeft | RectPart::BottomRight) : RectPart::None);
|
||||
auto rthumb = QRect(paintx, painty, paintw, painth);
|
||||
if (_data && !_data->thumb->isNull()) {
|
||||
auto w = _data->thumb->width(), h = _data->thumb->height();
|
||||
QPixmap pix;
|
||||
if (paintw * h == painth * w || (w == fullWidth() && h == fullHeight())) {
|
||||
pix = _data->thumb->pixSingle(contextId, paintw, painth, paintw, painth, roundRadius, roundCorners);
|
||||
} else if (paintw * h > painth * w) {
|
||||
auto nw = painth * w / h;
|
||||
pix = _data->thumb->pixSingle(contextId, nw, painth, paintw, painth, roundRadius, roundCorners);
|
||||
} else {
|
||||
auto nh = paintw * h / w;
|
||||
pix = _data->thumb->pixSingle(contextId, paintw, nh, paintw, painth, roundRadius, roundCorners);
|
||||
}
|
||||
const auto &pix = _data->thumb->pixSingle(contextId, paintw, painth, paintw, painth, roundRadius, roundCorners);
|
||||
p.drawPixmap(rthumb.topLeft(), pix);
|
||||
} else {
|
||||
App::complexLocationRect(p, rthumb, roundRadius, roundCorners);
|
||||
|
@ -225,8 +225,8 @@ std::unique_ptr<Result> Result::create(uint64 queryId, const MTPBotInlineResult
|
||||
if (result->getLocationCoords(&coords)) {
|
||||
const auto scale = 1 + (cScale() * cIntRetinaFactor()) / 200;
|
||||
const auto zoom = 15 + (scale - 1);
|
||||
const auto w = ConvertScale(st::inlineThumbSize) / scale;
|
||||
const auto h = ConvertScale(st::inlineThumbSize) / scale;
|
||||
const auto w = st::inlineThumbSize / scale;
|
||||
const auto h = st::inlineThumbSize / scale;
|
||||
|
||||
auto location = GeoPointLocation();
|
||||
location.lat = coords.lat();
|
||||
|
@ -1245,11 +1245,11 @@ std::optional<Storage::Cache::Key> GeoPointImage::cacheKey() const {
|
||||
}
|
||||
|
||||
int GeoPointImage::countWidth() const {
|
||||
return _location.width;
|
||||
return _location.width * _location.scale;
|
||||
}
|
||||
|
||||
int GeoPointImage::countHeight() const {
|
||||
return _location.height;
|
||||
return _location.height * _location.scale;
|
||||
}
|
||||
|
||||
void GeoPointImage::setInformation(int size, int width, int height) {
|
||||
|
Loading…
Reference in New Issue
Block a user