Limit avatar photo editor processed image size

This commit is contained in:
Ilya Laktyushin 2023-04-18 14:19:19 +04:00
parent 447fc13416
commit a3fc5f5340
3 changed files with 3 additions and 1 deletions

View File

@ -47,6 +47,7 @@ CGSize TGPhotoEditorScreenImageMaxSize();
extern const CGSize TGPhotoEditorResultImageMaxSize;
extern const CGSize TGPhotoEditorResultImageWallpaperMaxSize;
extern const CGSize TGPhotoEditorResultImageAvatarMaxSize;
#ifdef __cplusplus
}

View File

@ -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);

View File

@ -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 };