mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Limit avatar photo editor processed image size
This commit is contained in:
parent
447fc13416
commit
a3fc5f5340
3 changed files with 3 additions and 1 deletions
|
|
@ -47,6 +47,7 @@ CGSize TGPhotoEditorScreenImageMaxSize();
|
|||
|
||||
extern const CGSize TGPhotoEditorResultImageMaxSize;
|
||||
extern const CGSize TGPhotoEditorResultImageWallpaperMaxSize;
|
||||
extern const CGSize TGPhotoEditorResultImageAvatarMaxSize;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@
|
|||
}] map:^UIImage *(UIImage *image)
|
||||
{
|
||||
if (avatar) {
|
||||
CGFloat maxSide = [GPUImageContext maximumTextureSizeForThisDevice];
|
||||
CGFloat maxSide = MIN(TGPhotoEditorResultImageAvatarMaxSize.width, [GPUImageContext maximumTextureSizeForThisDevice]);
|
||||
if (MAX(image.size.width, image.size.height) > maxSide) {
|
||||
CGSize fittedSize = TGScaleToFit(image.size, CGSizeMake(maxSide, maxSide));
|
||||
return TGScaleImageToPixelSize(image, fittedSize);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
const CGSize TGPhotoEditorResultImageMaxSize = { 1280, 1280 };
|
||||
const CGSize TGPhotoEditorResultImageWallpaperMaxSize = { 2048, 2048 };
|
||||
const CGSize TGPhotoEditorResultImageAvatarMaxSize = { 2048, 2048 };
|
||||
const CGSize TGPhotoEditorScreenImageHardLimitSize = { 1280, 1280 };
|
||||
const CGSize TGPhotoEditorScreenImageHardLimitLegacySize = { 750, 750 };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue