mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Scale legacy builtin wallpaper thumbnail
This commit is contained in:
parent
54e048b610
commit
02e1cc66cb
@ -720,7 +720,7 @@ private func builtinWallpaperData() -> Signal<UIImage, NoError> {
|
|||||||
} |> runOn(Queue.concurrentDefaultQueue())
|
} |> runOn(Queue.concurrentDefaultQueue())
|
||||||
}
|
}
|
||||||
|
|
||||||
public func settingsBuiltinWallpaperImage(account: Account) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
public func settingsBuiltinWallpaperImage(account: Account, thumbnail: Bool = false) -> Signal<(TransformImageArguments) -> DrawingContext?, NoError> {
|
||||||
return builtinWallpaperData() |> map { fullSizeImage in
|
return builtinWallpaperData() |> map { fullSizeImage in
|
||||||
return { arguments in
|
return { arguments in
|
||||||
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
let context = DrawingContext(size: arguments.drawingSize, clear: true)
|
||||||
@ -738,6 +738,11 @@ public func settingsBuiltinWallpaperImage(account: Account) -> Signal<(Transform
|
|||||||
|
|
||||||
context.withFlippedContext { c in
|
context.withFlippedContext { c in
|
||||||
c.setBlendMode(.copy)
|
c.setBlendMode(.copy)
|
||||||
|
if thumbnail {
|
||||||
|
c.translateBy(x: fittedRect.midX, y: fittedRect.midY)
|
||||||
|
c.scaleBy(x: 3.4, y: 3.4)
|
||||||
|
c.translateBy(x: -fittedRect.midX, y: -fittedRect.midY)
|
||||||
|
}
|
||||||
if let fullSizeImage = fullSizeImage.cgImage {
|
if let fullSizeImage = fullSizeImage.cgImage {
|
||||||
c.interpolationQuality = .medium
|
c.interpolationQuality = .medium
|
||||||
drawImage(context: c, image: fullSizeImage, orientation: .up, in: fittedRect)
|
drawImage(context: c, image: fullSizeImage, orientation: .up, in: fittedRect)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user