diff --git a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGPhotoAvatarCropView.h b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGPhotoAvatarCropView.h index 9b30384a51..5a756ef52d 100644 --- a/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGPhotoAvatarCropView.h +++ b/submodules/LegacyComponents/PublicHeaders/LegacyComponents/TGPhotoAvatarCropView.h @@ -7,6 +7,7 @@ @property (nonatomic, strong) UIImage *image; @property (nonatomic, strong) AVPlayer *player; +@property (nonatomic, readonly) CGSize originalSize; @property (nonatomic, assign) CGRect cropRect; @property (nonatomic, assign) UIImageOrientation cropOrientation; @property (nonatomic, assign) bool cropMirrored; @@ -36,6 +37,8 @@ - (void)invalidateCropRect; - (void)invalidateVideoView; +- (UIImage *)currentImage; + - (void)hideImageForCustomTransition; - (CGRect)contentFrameForView:(UIView *)view; diff --git a/submodules/LegacyComponents/Sources/TGMediaAvatarMenuMixin.m b/submodules/LegacyComponents/Sources/TGMediaAvatarMenuMixin.m index 1e65621ab8..da66999126 100644 --- a/submodules/LegacyComponents/Sources/TGMediaAvatarMenuMixin.m +++ b/submodules/LegacyComponents/Sources/TGMediaAvatarMenuMixin.m @@ -405,14 +405,14 @@ { __strong TGMediaAssetsController *strongController = weakController; if (strongController != nil) { - [strongController dismissViewControllerAnimated:true completion:nil]; + [strongController dismissViewControllerAnimated:false completion:nil]; } __strong TGMediaAvatarMenuMixin *strongSelf = weakSelf; if (strongSelf == nil) return; - [strongSelf->_parentController dismissViewControllerAnimated:true completion:nil]; + [strongSelf->_parentController dismissViewControllerAnimated:false completion:nil]; if (strongSelf.didDismiss != nil) strongSelf.didDismiss(); diff --git a/submodules/LegacyComponents/Sources/TGMediaPickerGalleryVideoScrubber.h b/submodules/LegacyComponents/Sources/TGMediaPickerGalleryVideoScrubber.h index 0dca57f0e3..62180ca7e1 100644 --- a/submodules/LegacyComponents/Sources/TGMediaPickerGalleryVideoScrubber.h +++ b/submodules/LegacyComponents/Sources/TGMediaPickerGalleryVideoScrubber.h @@ -37,6 +37,7 @@ - (void)reloadDataAndReset:(bool)reset; - (void)reloadThumbnails; +- (void)reloadThumbnailsAnimated; - (void)ignoreThumbnails; - (void)resetThumbnails; diff --git a/submodules/LegacyComponents/Sources/TGPhotoAvatarCropController.m b/submodules/LegacyComponents/Sources/TGPhotoAvatarCropController.m index 51c340bdd3..cf938b2d81 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoAvatarCropController.m +++ b/submodules/LegacyComponents/Sources/TGPhotoAvatarCropController.m @@ -311,6 +311,12 @@ const CGFloat TGPhotoAvatarCropButtonsWrapperSize = 61.0f; if (self.finishedPhotoProcessing != nil) self.finishedPhotoProcessing(); } else { + UIImage *image = _cropView.currentImage; + CGRect cropRect = _cropView.cropRect; + UIImageOrientation cropOrientation = _cropView.cropOrientation; + bool cropMirrored = _cropView.cropMirrored; + CGSize originalSize = _cropView.originalSize; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ { if (dispatch_semaphore_wait(_waitSemaphore, dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)))) @@ -319,8 +325,8 @@ const CGFloat TGPhotoAvatarCropButtonsWrapperSize = 61.0f; return; } - UIImage *croppedImage = [_cropView croppedImageWithMaxSize:TGPhotoEditorScreenImageMaxSize()]; - [photoEditor setImage:croppedImage forCropRect:_cropView.cropRect cropRotation:0.0f cropOrientation:_cropView.cropOrientation cropMirrored:_cropView.cropMirrored fullSize:false]; + UIImage *croppedImage = TGPhotoEditorCrop(image, nil, cropOrientation, 0.0f, cropRect, false, TGPhotoEditorScreenImageMaxSize(), originalSize, true); + [photoEditor setImage:croppedImage forCropRect:cropRect cropRotation:0.0f cropOrientation:cropOrientation cropMirrored:cropMirrored fullSize:false]; [photoEditor processAnimated:false completion:^ { diff --git a/submodules/LegacyComponents/Sources/TGPhotoAvatarCropView.m b/submodules/LegacyComponents/Sources/TGPhotoAvatarCropView.m index 5ab0d4b74f..a28c47e0cd 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoAvatarCropView.m +++ b/submodules/LegacyComponents/Sources/TGPhotoAvatarCropView.m @@ -440,6 +440,10 @@ const CGFloat TGPhotoAvatarCropViewOverscreenSize = 1000; return snapshotView; } +- (UIImage *)currentImage { + return _imageView.image; +} + - (UIImage *)croppedImageWithMaxSize:(CGSize)maxSize { return TGPhotoEditorCrop(_imageView.image, nil, self.cropOrientation, 0.0f, self.cropRect, false, maxSize, _originalSize, true); diff --git a/submodules/LegacyComponents/Sources/TGPhotoEditorController.m b/submodules/LegacyComponents/Sources/TGPhotoEditorController.m index 88ed04bc5f..f61ba32618 100644 --- a/submodules/LegacyComponents/Sources/TGPhotoEditorController.m +++ b/submodules/LegacyComponents/Sources/TGPhotoEditorController.m @@ -1333,7 +1333,8 @@ case TGPhotoEditorPreviewTab: { if ([_currentTabController isKindOfClass:[TGPhotoToolsController class]]) { - [_scrubberView reloadThumbnails]; + [_scrubberView reloadDataAndReset:false]; + [self updateDotImage]; } TGPhotoAvatarPreviewController *previewController = [[TGPhotoAvatarPreviewController alloc] initWithContext:_context photoEditor:_photoEditor previewView:_previewView scrubberView:_scrubberView]; diff --git a/submodules/LegacyComponents/Sources/TGVideoCameraPipeline.m b/submodules/LegacyComponents/Sources/TGVideoCameraPipeline.m index 03a796f70c..304099a130 100644 --- a/submodules/LegacyComponents/Sources/TGVideoCameraPipeline.m +++ b/submodules/LegacyComponents/Sources/TGVideoCameraPipeline.m @@ -374,8 +374,8 @@ const NSInteger TGVideoCameraRetainedBufferCount = 16; if (self.outputVideoFormatDescription == NULL) [self setupVideoPipelineWithInputFormatDescription:formatDescription]; else { - [_recorder appendVideoSampleBuffer:sampleBuffer]; -// [self renderVideoSampleBuffer:sampleBuffer]; +// [_recorder appendVideoSampleBuffer:sampleBuffer]; + [self renderVideoSampleBuffer:sampleBuffer]; } } else if (connection == _audioConnection)