Fix small sticker alpha blur (iOS 17)

This commit is contained in:
Ali 2023-10-29 23:05:51 +04:00
parent 736e070503
commit c29cd1bbba
3 changed files with 14 additions and 1 deletions
submodules
FastBlur/Sources
StickerResources/Sources
WebPBinding/Sources

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

@ -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<Tuple3<Data?, Data?, Bool>, NoError>
let thumbnail = "".isEmpty
if thumbnail {
signal = chatMessageStickerThumbnailData(postbox: postbox, userLocation: userLocation, file: file, synchronousLoad: synchronousLoad)
|> map { data -> Tuple3<Data?, Data?, Bool>in

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