mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
Refactoring
This commit is contained in:
parent
95a03d9931
commit
d147c63b68
23 changed files with 2739 additions and 2762 deletions
|
|
@ -31,6 +31,7 @@ swift_library(
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/Display:Display",
|
"//submodules/Display:Display",
|
||||||
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
||||||
|
"//submodules/TelegramUI/Components/DCTAnimationCacheImpl:DCTAnimationCacheImpl",
|
||||||
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
||||||
"//submodules/rlottie:RLottieBinding",
|
"//submodules/rlottie:RLottieBinding",
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import UIKit
|
||||||
|
|
||||||
import Display
|
import Display
|
||||||
import AnimationCache
|
import AnimationCache
|
||||||
|
import DCTAnimationCacheImpl
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import VideoAnimationCache
|
import VideoAnimationCache
|
||||||
import LottieAnimationCache
|
import LottieAnimationCache
|
||||||
|
|
@ -50,7 +51,7 @@ public final class ViewController: UIViewController {
|
||||||
let basePath = NSTemporaryDirectory() + "/animation-cache"
|
let basePath = NSTemporaryDirectory() + "/animation-cache"
|
||||||
let _ = try? FileManager.default.removeItem(atPath: basePath)
|
let _ = try? FileManager.default.removeItem(atPath: basePath)
|
||||||
let _ = try? FileManager.default.createDirectory(at: URL(fileURLWithPath: basePath), withIntermediateDirectories: true)
|
let _ = try? FileManager.default.createDirectory(at: URL(fileURLWithPath: basePath), withIntermediateDirectories: true)
|
||||||
self.cache = AnimationCacheImpl(basePath: basePath, allocateTempFile: {
|
self.cache = DCTAnimationCacheImpl(basePath: basePath, allocateTempFile: {
|
||||||
return basePath + "/\(Int64.random(in: 0 ... Int64.max))"
|
return basePath + "/\(Int64.random(in: 0 ... Int64.max))"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ swift_library(
|
||||||
"//submodules/TelegramUI/Components/EntityKeyboard:EntityKeyboard",
|
"//submodules/TelegramUI/Components/EntityKeyboard:EntityKeyboard",
|
||||||
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
||||||
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
||||||
|
"//submodules/TelegramUI/Components/DCTMultiAnimationRendererImpl:DCTMultiAnimationRendererImpl",
|
||||||
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
||||||
"//submodules/Components/ComponentDisplayAdapters:ComponentDisplayAdapters",
|
"//submodules/Components/ComponentDisplayAdapters:ComponentDisplayAdapters",
|
||||||
"//submodules/TextFormat:TextFormat",
|
"//submodules/TextFormat:TextFormat",
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import EntityKeyboard
|
||||||
import ComponentDisplayAdapters
|
import ComponentDisplayAdapters
|
||||||
import AnimationCache
|
import AnimationCache
|
||||||
import MultiAnimationRenderer
|
import MultiAnimationRenderer
|
||||||
|
import DCTMultiAnimationRendererImpl
|
||||||
import EmojiTextAttachmentView
|
import EmojiTextAttachmentView
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import GZip
|
import GZip
|
||||||
|
|
@ -504,8 +505,8 @@ public final class ReactionContextNode: ASDisplayNode, ASScrollViewDelegate {
|
||||||
self.reactionsLocked = reactionsLocked
|
self.reactionsLocked = reactionsLocked
|
||||||
|
|
||||||
self.animationCache = animationCache
|
self.animationCache = animationCache
|
||||||
self.animationRenderer = MultiAnimationRendererImpl()
|
self.animationRenderer = DCTMultiAnimationRendererImpl()
|
||||||
(self.animationRenderer as? MultiAnimationRendererImpl)?.useYuvA = context.sharedContext.immediateExperimentalUISettings.compressedEmojiCache
|
(self.animationRenderer as? DCTMultiAnimationRendererImpl)?.useYuvA = context.sharedContext.immediateExperimentalUISettings.compressedEmojiCache
|
||||||
|
|
||||||
self.backgroundMaskNode = ASDisplayNode()
|
self.backgroundMaskNode = ASDisplayNode()
|
||||||
var backgroundGlassParams: ReactionContextBackgroundNode.GlassParams?
|
var backgroundGlassParams: ReactionContextBackgroundNode.GlassParams?
|
||||||
|
|
@ -3341,7 +3342,7 @@ public final class StandaloneReactionAnimation: ASDisplayNode {
|
||||||
if let currentItemNode = currentItemNode {
|
if let currentItemNode = currentItemNode {
|
||||||
itemNode = currentItemNode
|
itemNode = currentItemNode
|
||||||
} else {
|
} else {
|
||||||
let animationRenderer = MultiAnimationRendererImpl()
|
let animationRenderer = DCTMultiAnimationRendererImpl()
|
||||||
itemNode = ReactionNode(context: context, theme: theme, item: reaction, icon: .none, animationCache: animationCache, animationRenderer: animationRenderer, loopIdle: false, isLocked: false)
|
itemNode = ReactionNode(context: context, theme: theme, item: reaction, icon: .none, animationCache: animationCache, animationRenderer: animationRenderer, loopIdle: false, isLocked: false)
|
||||||
}
|
}
|
||||||
self.itemNode = itemNode
|
self.itemNode = itemNode
|
||||||
|
|
|
||||||
|
|
@ -283,6 +283,8 @@ swift_library(
|
||||||
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
||||||
|
"//submodules/TelegramUI/Components/DCTAnimationCacheImpl:DCTAnimationCacheImpl",
|
||||||
|
"//submodules/TelegramUI/Components/DCTMultiAnimationRendererImpl:DCTMultiAnimationRendererImpl",
|
||||||
"//submodules/TelegramUI/Components/ChatInputPanelContainer:ChatInputPanelContainer",
|
"//submodules/TelegramUI/Components/ChatInputPanelContainer:ChatInputPanelContainer",
|
||||||
"//submodules/TelegramUI/Components/TextNodeWithEntities:TextNodeWithEntities",
|
"//submodules/TelegramUI/Components/TextNodeWithEntities:TextNodeWithEntities",
|
||||||
"//submodules/TelegramUI/Components/EmojiSuggestionsComponent:EmojiSuggestionsComponent",
|
"//submodules/TelegramUI/Components/EmojiSuggestionsComponent:EmojiSuggestionsComponent",
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,6 @@ swift_library(
|
||||||
],
|
],
|
||||||
deps = [
|
deps = [
|
||||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
"//submodules/CryptoUtils:CryptoUtils",
|
|
||||||
"//submodules/ManagedFile:ManagedFile",
|
|
||||||
"//submodules/TelegramUI/Components/AnimationCache/ImageDCT:ImageDCT",
|
|
||||||
"//third-party/subcodec:SubcodecObjC",
|
|
||||||
],
|
],
|
||||||
visibility = [
|
visibility = [
|
||||||
"//visibility:public",
|
"//visibility:public",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
23
submodules/TelegramUI/Components/DCTAnimationCacheImpl/BUILD
Normal file
23
submodules/TelegramUI/Components/DCTAnimationCacheImpl/BUILD
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||||
|
|
||||||
|
swift_library(
|
||||||
|
name = "DCTAnimationCacheImpl",
|
||||||
|
module_name = "DCTAnimationCacheImpl",
|
||||||
|
srcs = glob([
|
||||||
|
"Sources/**/*.swift",
|
||||||
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
|
"//submodules/CryptoUtils:CryptoUtils",
|
||||||
|
"//submodules/ManagedFile:ManagedFile",
|
||||||
|
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
||||||
|
"//submodules/TelegramUI/Components/AnimationCache/ImageDCT:ImageDCT",
|
||||||
|
"//third-party/subcodec:SubcodecObjC",
|
||||||
|
],
|
||||||
|
visibility = [
|
||||||
|
"//visibility:public",
|
||||||
|
],
|
||||||
|
)
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,5 +1,6 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import AnimationCache
|
||||||
import ImageDCT
|
import ImageDCT
|
||||||
import Accelerate
|
import Accelerate
|
||||||
|
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||||
|
|
||||||
|
swift_library(
|
||||||
|
name = "DCTMultiAnimationRendererImpl",
|
||||||
|
module_name = "DCTMultiAnimationRendererImpl",
|
||||||
|
srcs = glob([
|
||||||
|
"Sources/**/*.swift",
|
||||||
|
]),
|
||||||
|
copts = [
|
||||||
|
"-warnings-as-errors",
|
||||||
|
],
|
||||||
|
deps = [
|
||||||
|
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||||
|
"//submodules/Display:Display",
|
||||||
|
"//submodules/TelegramUI/Components/AnimationCache:AnimationCache",
|
||||||
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
||||||
|
],
|
||||||
|
visibility = [
|
||||||
|
"//visibility:public",
|
||||||
|
],
|
||||||
|
)
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -23,6 +23,7 @@ swift_library(
|
||||||
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
||||||
|
"//submodules/TelegramUI/Components/DCTMultiAnimationRendererImpl:DCTMultiAnimationRendererImpl",
|
||||||
"//submodules/ShimmerEffect:ShimmerEffect",
|
"//submodules/ShimmerEffect:ShimmerEffect",
|
||||||
"//submodules/TelegramUIPreferences",
|
"//submodules/TelegramUIPreferences",
|
||||||
"//submodules/TelegramUI/Components/Utils/GenerateStickerPlaceholderImage",
|
"//submodules/TelegramUI/Components/Utils/GenerateStickerPlaceholderImage",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import AnimationCache
|
||||||
import LottieAnimationCache
|
import LottieAnimationCache
|
||||||
import VideoAnimationCache
|
import VideoAnimationCache
|
||||||
import MultiAnimationRenderer
|
import MultiAnimationRenderer
|
||||||
|
import DCTMultiAnimationRendererImpl
|
||||||
import ShimmerEffect
|
import ShimmerEffect
|
||||||
import TextFormat
|
import TextFormat
|
||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
|
|
@ -817,7 +818,7 @@ public final class InlineStickerItemLayer: MultiAnimationRenderTarget {
|
||||||
let isThumbnailCancelled = Atomic<Bool>(value: false)
|
let isThumbnailCancelled = Atomic<Bool>(value: false)
|
||||||
self.loadDisposable = arguments.renderer.loadFirstFrame(target: self, cache: arguments.cache, itemId: file.resource.id.stringRepresentation, size: arguments.pixelSize, fetch: animationCacheFetchFile(postbox: arguments.context.postbox, userLocation: arguments.userLocation, userContentType: .sticker, resource: .media(media: .standalone(media: file), resource: file.resource), type: AnimationCacheAnimationType(file: file), keyframeOnly: true, customColor: isTemplate ? .white : nil), completion: { [weak self] result, isFinal in
|
self.loadDisposable = arguments.renderer.loadFirstFrame(target: self, cache: arguments.cache, itemId: file.resource.id.stringRepresentation, size: arguments.pixelSize, fetch: animationCacheFetchFile(postbox: arguments.context.postbox, userLocation: arguments.userLocation, userContentType: .sticker, resource: .media(media: .standalone(media: file), resource: file.resource), type: AnimationCacheAnimationType(file: file), keyframeOnly: true, customColor: isTemplate ? .white : nil), completion: { [weak self] result, isFinal in
|
||||||
if !result {
|
if !result {
|
||||||
MultiAnimationRendererImpl.firstFrameQueue.async {
|
DCTMultiAnimationRendererImpl.firstFrameQueue.async {
|
||||||
let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: pointSize, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: placeholderColor)
|
let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: pointSize, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: placeholderColor)
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ swift_library(
|
||||||
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
"//submodules/TelegramUI/Components/LottieAnimationCache:LottieAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
"//submodules/TelegramUI/Components/VideoAnimationCache:VideoAnimationCache",
|
||||||
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer:MultiAnimationRenderer",
|
||||||
|
"//submodules/TelegramUI/Components/DCTMultiAnimationRendererImpl:DCTMultiAnimationRendererImpl",
|
||||||
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
"//submodules/TelegramUI/Components/EmojiTextAttachmentView:EmojiTextAttachmentView",
|
||||||
"//submodules/TelegramUI/Components/EmojiStatusComponent:EmojiStatusComponent",
|
"//submodules/TelegramUI/Components/EmojiStatusComponent:EmojiStatusComponent",
|
||||||
"//submodules/TelegramUI/Components/LottieComponent",
|
"//submodules/TelegramUI/Components/LottieComponent",
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import Postbox
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import MultiAnimationRenderer
|
import MultiAnimationRenderer
|
||||||
import AnimationCache
|
import AnimationCache
|
||||||
|
import DCTMultiAnimationRendererImpl
|
||||||
import AccountContext
|
import AccountContext
|
||||||
import TelegramUIPreferences
|
import TelegramUIPreferences
|
||||||
import GenerateStickerPlaceholderImage
|
import GenerateStickerPlaceholderImage
|
||||||
|
|
@ -277,7 +278,7 @@ public final class InlineFileIconLayer: MultiAnimationRenderTarget {
|
||||||
size: arguments.pixelSize,
|
size: arguments.pixelSize,
|
||||||
fetch: animationCacheFetchFile(postbox: arguments.context.postbox, userLocation: arguments.userLocation, userContentType: .sticker, resource: .media(media: .standalone(media: file), resource: file.resource), type: AnimationCacheAnimationType(file: file), keyframeOnly: true, customColor: isTemplate ? .white : nil), completion: { [weak self] result, isFinal in
|
fetch: animationCacheFetchFile(postbox: arguments.context.postbox, userLocation: arguments.userLocation, userContentType: .sticker, resource: .media(media: .standalone(media: file), resource: file.resource), type: AnimationCacheAnimationType(file: file), keyframeOnly: true, customColor: isTemplate ? .white : nil), completion: { [weak self] result, isFinal in
|
||||||
if !result {
|
if !result {
|
||||||
MultiAnimationRendererImpl.firstFrameQueue.async {
|
DCTMultiAnimationRendererImpl.firstFrameQueue.async {
|
||||||
let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: pointSize, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: placeholderColor)
|
let image = generateStickerPlaceholderImage(data: file.immediateThumbnailData, size: pointSize, scale: min(2.0, UIScreenScale), imageSize: file.dimensions?.cgSize ?? CGSize(width: 512.0, height: 512.0), backgroundColor: nil, foregroundColor: placeholderColor)
|
||||||
|
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,4 @@
|
||||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||||
load(
|
|
||||||
"@build_bazel_rules_apple//apple:resources.bzl",
|
|
||||||
"apple_resource_bundle",
|
|
||||||
"apple_resource_group",
|
|
||||||
)
|
|
||||||
load("//build-system/bazel-utils:plist_fragment.bzl",
|
|
||||||
"plist_fragment",
|
|
||||||
)
|
|
||||||
|
|
||||||
filegroup(
|
|
||||||
name = "MultiAnimationRendererMetalResources",
|
|
||||||
srcs = glob([
|
|
||||||
"Resources/**/*.metal",
|
|
||||||
]),
|
|
||||||
visibility = ["//visibility:public"],
|
|
||||||
)
|
|
||||||
|
|
||||||
plist_fragment(
|
|
||||||
name = "WallpaperBackgroundNodeBundleInfoPlist",
|
|
||||||
extension = "plist",
|
|
||||||
template =
|
|
||||||
"""
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>org.telegram.MultiAnimationRenderer</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
|
||||||
<string>en</string>
|
|
||||||
<key>CFBundleName</key>
|
|
||||||
<string>MultiAnimationRenderer</string>
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
apple_resource_bundle(
|
|
||||||
name = "MultiAnimationRendererBundle",
|
|
||||||
infoplists = [
|
|
||||||
":WallpaperBackgroundNodeBundleInfoPlist",
|
|
||||||
],
|
|
||||||
resources = [
|
|
||||||
":MultiAnimationRendererMetalResources",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
swift_library(
|
swift_library(
|
||||||
name = "MultiAnimationRenderer",
|
name = "MultiAnimationRenderer",
|
||||||
|
|
@ -46,9 +6,6 @@ swift_library(
|
||||||
srcs = glob([
|
srcs = glob([
|
||||||
"Sources/**/*.swift",
|
"Sources/**/*.swift",
|
||||||
]),
|
]),
|
||||||
data = [
|
|
||||||
":MultiAnimationRendererBundle",
|
|
||||||
],
|
|
||||||
copts = [
|
copts = [
|
||||||
"-warnings-as-errors",
|
"-warnings-as-errors",
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
#include <metal_stdlib>
|
|
||||||
using namespace metal;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
packed_float2 position;
|
|
||||||
packed_float2 texCoord;
|
|
||||||
} Vertex;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
float4 position[[position]];
|
|
||||||
float2 texCoord;
|
|
||||||
} Varyings;
|
|
||||||
|
|
||||||
vertex Varyings multiAnimationVertex(
|
|
||||||
unsigned int vid[[vertex_id]],
|
|
||||||
constant Vertex *verticies[[buffer(0)]],
|
|
||||||
constant uint2 &resolution[[buffer(1)]],
|
|
||||||
constant uint2 &slotSize[[buffer(2)]],
|
|
||||||
constant uint2 &slotPosition[[buffer(3)]]
|
|
||||||
) {
|
|
||||||
Varyings out;
|
|
||||||
constant Vertex &v = verticies[vid];
|
|
||||||
|
|
||||||
out.position = float4(float2(v.position), 0.0, 1.0);
|
|
||||||
out.texCoord = v.texCoord;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
fragment half4 multiAnimationFragment(
|
|
||||||
Varyings in[[stage_in]],
|
|
||||||
texture2d<float, access::sample> textureY[[texture(0)]],
|
|
||||||
texture2d<float, access::sample> textureU[[texture(1)]],
|
|
||||||
texture2d<float, access::sample> textureV[[texture(2)]],
|
|
||||||
texture2d<float, access::sample> textureA[[texture(3)]]
|
|
||||||
) {
|
|
||||||
constexpr sampler s(address::clamp_to_edge, filter::linear);
|
|
||||||
|
|
||||||
half y = textureY.sample(s, in.texCoord).r;
|
|
||||||
half u = textureU.sample(s, in.texCoord).r - 0.5;
|
|
||||||
half v = textureV.sample(s, in.texCoord).r - 0.5;
|
|
||||||
half a = textureA.sample(s, in.texCoord).r;
|
|
||||||
|
|
||||||
half4 out = half4(1.5748 * v + y, -0.1873 * v + y, 1.8556 * u + y, a);
|
|
||||||
return half4(out.b, out.g, out.r, out.a);
|
|
||||||
}
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -36,6 +36,8 @@ swift_library(
|
||||||
"//submodules/TelegramUI/Components/TelegramUIDeclareEncodables",
|
"//submodules/TelegramUI/Components/TelegramUIDeclareEncodables",
|
||||||
"//submodules/TelegramUI/Components/AnimationCache",
|
"//submodules/TelegramUI/Components/AnimationCache",
|
||||||
"//submodules/TelegramUI/Components/MultiAnimationRenderer",
|
"//submodules/TelegramUI/Components/MultiAnimationRenderer",
|
||||||
|
"//submodules/TelegramUI/Components/DCTAnimationCacheImpl:DCTAnimationCacheImpl",
|
||||||
|
"//submodules/TelegramUI/Components/DCTMultiAnimationRendererImpl:DCTMultiAnimationRendererImpl",
|
||||||
"//submodules/TelegramUI/Components/TelegramAccountAuxiliaryMethods",
|
"//submodules/TelegramUI/Components/TelegramAccountAuxiliaryMethods",
|
||||||
"//submodules/TelegramUI/Components/PeerSelectionController",
|
"//submodules/TelegramUI/Components/PeerSelectionController",
|
||||||
"//submodules/TelegramUI/Components/ContextMenuScreen",
|
"//submodules/TelegramUI/Components/ContextMenuScreen",
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,8 @@ import ManagedFile
|
||||||
import TelegramUIDeclareEncodables
|
import TelegramUIDeclareEncodables
|
||||||
import AnimationCache
|
import AnimationCache
|
||||||
import MultiAnimationRenderer
|
import MultiAnimationRenderer
|
||||||
|
import DCTAnimationCacheImpl
|
||||||
|
import DCTMultiAnimationRendererImpl
|
||||||
import TelegramUIDeclareEncodables
|
import TelegramUIDeclareEncodables
|
||||||
import TelegramAccountAuxiliaryMethods
|
import TelegramAccountAuxiliaryMethods
|
||||||
import PeerSelectionController
|
import PeerSelectionController
|
||||||
|
|
@ -105,14 +107,14 @@ private final class ShareControllerAccountContextExtension: ShareControllerAccou
|
||||||
self.stateManager = stateManager
|
self.stateManager = stateManager
|
||||||
self.engineData = TelegramEngine.EngineData(accountPeerId: stateManager.accountPeerId, postbox: stateManager.postbox)
|
self.engineData = TelegramEngine.EngineData(accountPeerId: stateManager.accountPeerId, postbox: stateManager.postbox)
|
||||||
let cacheStorageBox = stateManager.postbox.mediaBox.cacheStorageBox
|
let cacheStorageBox = stateManager.postbox.mediaBox.cacheStorageBox
|
||||||
self.animationCache = AnimationCacheImpl(basePath: stateManager.postbox.mediaBox.basePath + "/animation-cache", allocateTempFile: {
|
self.animationCache = DCTAnimationCacheImpl(basePath: stateManager.postbox.mediaBox.basePath + "/animation-cache", allocateTempFile: {
|
||||||
return TempBox.shared.tempFile(fileName: "file").path
|
return TempBox.shared.tempFile(fileName: "file").path
|
||||||
}, updateStorageStats: { path, size in
|
}, updateStorageStats: { path, size in
|
||||||
if let pathData = path.data(using: .utf8) {
|
if let pathData = path.data(using: .utf8) {
|
||||||
cacheStorageBox.update(id: pathData, size: size)
|
cacheStorageBox.update(id: pathData, size: size)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.animationRenderer = MultiAnimationRendererImpl()
|
self.animationRenderer = DCTMultiAnimationRendererImpl()
|
||||||
self.contentSettings = contentSettings
|
self.contentSettings = contentSettings
|
||||||
self.appConfiguration = appConfiguration
|
self.appConfiguration = appConfiguration
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ import FetchManagerImpl
|
||||||
import InAppPurchaseManager
|
import InAppPurchaseManager
|
||||||
import AnimationCache
|
import AnimationCache
|
||||||
import MultiAnimationRenderer
|
import MultiAnimationRenderer
|
||||||
|
import DCTAnimationCacheImpl
|
||||||
|
import DCTMultiAnimationRendererImpl
|
||||||
import AppBundle
|
import AppBundle
|
||||||
import DirectMediaImageCache
|
import DirectMediaImageCache
|
||||||
|
|
||||||
|
|
@ -317,15 +319,15 @@ public final class AccountContextImpl: AccountContext {
|
||||||
self.cachedGroupCallContexts = AccountGroupCallContextCacheImpl()
|
self.cachedGroupCallContexts = AccountGroupCallContextCacheImpl()
|
||||||
|
|
||||||
let cacheStorageBox = self.account.postbox.mediaBox.cacheStorageBox
|
let cacheStorageBox = self.account.postbox.mediaBox.cacheStorageBox
|
||||||
self.animationCache = AnimationCacheImpl(basePath: self.account.postbox.mediaBox.basePath + "/animation-cache", allocateTempFile: {
|
self.animationCache = DCTAnimationCacheImpl(basePath: self.account.postbox.mediaBox.basePath + "/animation-cache", allocateTempFile: {
|
||||||
return TempBox.shared.tempFile(fileName: "file").path
|
return TempBox.shared.tempFile(fileName: "file").path
|
||||||
}, updateStorageStats: { path, size in
|
}, updateStorageStats: { path, size in
|
||||||
if let pathData = path.data(using: .utf8) {
|
if let pathData = path.data(using: .utf8) {
|
||||||
cacheStorageBox.update(id: pathData, size: size)
|
cacheStorageBox.update(id: pathData, size: size)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
self.animationRenderer = MultiAnimationRendererImpl()
|
self.animationRenderer = DCTMultiAnimationRendererImpl()
|
||||||
(self.animationRenderer as? MultiAnimationRendererImpl)?.useYuvA = sharedContext.immediateExperimentalUISettings.compressedEmojiCache
|
(self.animationRenderer as? DCTMultiAnimationRendererImpl)?.useYuvA = sharedContext.immediateExperimentalUISettings.compressedEmojiCache
|
||||||
|
|
||||||
let updatedLimitsConfiguration = account.postbox.preferencesView(keys: [PreferencesKeys.limitsConfiguration])
|
let updatedLimitsConfiguration = account.postbox.preferencesView(keys: [PreferencesKeys.limitsConfiguration])
|
||||||
|> map { preferences -> LimitsConfiguration in
|
|> map { preferences -> LimitsConfiguration in
|
||||||
|
|
@ -496,7 +498,7 @@ public final class AccountContextImpl: AccountContext {
|
||||||
guard let settings = sharedData.entries[ApplicationSpecificSharedDataKeys.experimentalUISettings]?.get(ExperimentalUISettings.self) else {
|
guard let settings = sharedData.entries[ApplicationSpecificSharedDataKeys.experimentalUISettings]?.get(ExperimentalUISettings.self) else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
(self.animationRenderer as? MultiAnimationRendererImpl)?.useYuvA = settings.compressedEmojiCache
|
(self.animationRenderer as? DCTMultiAnimationRendererImpl)?.useYuvA = settings.compressedEmojiCache
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue