diff --git a/submodules/FastBlur/Sources/FastBlur.m b/submodules/FastBlur/Sources/FastBlur.m index 2c7849384f..4c9b887860 100644 --- a/submodules/FastBlur/Sources/FastBlur.m +++ b/submodules/FastBlur/Sources/FastBlur.m @@ -207,18 +207,23 @@ void stickerThumbnailAlphaBlur(int imageWidth, int imageHeight, int imageStride, srcBuffer.rowBytes = imageStride; srcBuffer.data = pixels; + void *tempBytes = malloc(imageHeight * imageStride); + { vImage_Buffer dstBuffer; dstBuffer.width = imageWidth; dstBuffer.height = imageHeight; dstBuffer.rowBytes = imageStride; - dstBuffer.data = pixels; + dstBuffer.data = tempBytes; int boxSize = 2; boxSize = boxSize - (boxSize % 2) + 1; vImageBoxConvolve_ARGB8888(&srcBuffer, &dstBuffer, NULL, 0, 0, boxSize, boxSize, NULL, kvImageEdgeExtend); } + + memcpy(pixels, tempBytes, imageHeight * imageStride); + free(tempBytes); } static void modifyImage(void *pixels, unsigned int width, unsigned int height, unsigned int stride, int16_t * _Nonnull matrix) diff --git a/submodules/StickerResources/Sources/StickerResources.swift b/submodules/StickerResources/Sources/StickerResources.swift index 3063bc9cad..b5561992b3 100644 --- a/submodules/StickerResources/Sources/StickerResources.swift +++ b/submodules/StickerResources/Sources/StickerResources.swift @@ -387,6 +387,9 @@ public func chatMessageStickerPackThumbnail(postbox: Postbox, resource: MediaRes public func chatMessageSticker(postbox: Postbox, userLocation: MediaResourceUserLocation, file: TelegramMediaFile, small: Bool, fetched: Bool = false, onlyFullSize: Bool = false, thumbnail: Bool = false, synchronousLoad: Bool = false, colorSpace: CGColorSpace? = nil) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> { let signal: Signal, NoError> + + let thumbnail = "".isEmpty + if thumbnail { signal = chatMessageStickerThumbnailData(postbox: postbox, userLocation: userLocation, file: file, synchronousLoad: synchronousLoad) |> map { data -> Tuple3in diff --git a/submodules/WebPBinding/Sources/UIImage+WebP.m b/submodules/WebPBinding/Sources/UIImage+WebP.m index c4a07eed72..f209b7e3b2 100644 --- a/submodules/WebPBinding/Sources/UIImage+WebP.m +++ b/submodules/WebPBinding/Sources/UIImage+WebP.m @@ -10,6 +10,11 @@ return nil; } + UIImage *osImage = [[UIImage alloc] initWithData:imgData scale:1.0]; + if (osImage != nil) { + return osImage; + } + int width = 0, height = 0; if (!WebPGetInfo([imgData bytes], [imgData length], &width, &height)) { NSMutableDictionary *errorDetail = [NSMutableDictionary dictionary];