Video avatar fixes

This commit is contained in:
Ilya Laktyushin 2020-07-02 23:49:30 +03:00
parent 94ef5b9acf
commit 9d6d332623
5 changed files with 29 additions and 2 deletions

View File

@ -46,6 +46,8 @@
- (void)setPlayerItem:(AVPlayerItem *)playerItem forCropRect:(CGRect)cropRect cropRotation:(CGFloat)cropRotation cropOrientation:(UIImageOrientation)cropOrientation cropMirrored:(bool)cropMirrored;
- (void)setCIImage:(CIImage *)ciImage;
- (void)updateProcessChain:(bool)force;
- (void)processAnimated:(bool)animated completion:(void (^)(void))completion;
- (void)reprocess;

View File

@ -383,6 +383,10 @@
}
- (void)updateProcessChain {
[self updateProcessChain:false];
}
- (void)updateProcessChain:(bool)force {
[GPUImageFramebuffer setMark:self.forVideo];
NSMutableArray *processChain = [NSMutableArray array];
@ -398,7 +402,7 @@
TGPhotoEditorPreviewView *previewOutput = self.previewOutput;
if (![_currentProcessChain isEqualToArray:processChain])
if (![_currentProcessChain isEqualToArray:processChain] || force)
{
[_currentInput removeAllTargets];
[_cropFilter removeAllTargets];

View File

@ -513,7 +513,7 @@ const CGFloat TGPhotoAvatarPreviewLandscapePanelSize = TGPhotoAvatarPreviewPanel
if (!self.initialAppearance)
[_cropView openCurtains];
[_cropView transitionInFinishedFromCamera:(self.fromCamera && self.initialAppearance)];
PGPhotoEditor *photoEditor = self.photoEditor;
[photoEditor processAnimated:false completion:nil];
}

View File

@ -1656,6 +1656,9 @@
self.view.frame = targetFrame;
} completion:^(__unused BOOL finished)
{
TGDispatchAfter(1.0, dispatch_get_main_queue(), ^{
[_photoEditor updateProcessChain:true];
});
}];
}
}

View File

@ -629,6 +629,24 @@ public class AvatarGalleryController: ViewController, StandalonePresentableContr
let media = TelegramMediaImage(imageId: MediaId(namespace: 0, id: 0), representations: rawEntry.representations.map({ $0.representation }), immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: [])
mediaReference = .standalone(media: media)
}
// var cancelImpl: (() -> Void)?
// let presentationData = self.context.sharedContext.currentPresentationData.with { $0 }
// let progressSignal = Signal<Never, NoError> { subscriber in
// let controller = OverlayStatusController(theme: presentationData.theme, type: .loading(cancelled: {
// cancelImpl?()
// }))
// strongSelf.present(controller, in: .window(.root), with: ViewControllerPresentationArguments(presentationAnimation: .modalSheet))
// return ActionDisposable { [weak controller] in
// Queue.mainQueue().async() {
// controller?.dismiss()
// }
// }
// }
// |> runOn(Queue.mainQueue())
// |> delay(0.15, queue: Queue.mainQueue())
self.editDisposable.set((fetchMediaData(context: self.context, postbox: self.context.account.postbox, mediaReference: mediaReference)
|> deliverOnMainQueue).start(next: { [weak self] state, isImage in