From 32bbacb39e6c4cf7f0ffd976e62c011f24108c60 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Thu, 29 Jun 2023 06:54:19 +0200 Subject: [PATCH] Remove debug --- .../MetalResources/EditorDual.metal | 7 +--- .../Sources/VideoTextureSource.swift | 35 ++++--------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/submodules/TelegramUI/Components/MediaEditor/MetalResources/EditorDual.metal b/submodules/TelegramUI/Components/MediaEditor/MetalResources/EditorDual.metal index 104ee33f8f..c45b5ec9ff 100644 --- a/submodules/TelegramUI/Components/MediaEditor/MetalResources/EditorDual.metal +++ b/submodules/TelegramUI/Components/MediaEditor/MetalResources/EditorDual.metal @@ -38,10 +38,5 @@ fragment half4 dualFragmentShader(RasterizerData in [[stage_in]], float side = 1.0 * aspectRatio; float distance = smoothstep(t, -t, sdfRoundedRectangle(uv, float2(0.0, 0.0), float2(side, mix(1.0, side, roundness)), side * roundness)); - if (roundness > 0.0) { - return half4(in.localPos.x, 0.0, 0.0, 1.0); - } else { - - return mix(half4(color, 0.0), half4(color, 1.0 * alpha), distance); - } + return mix(half4(color, 0.0), half4(color, 1.0 * alpha), distance); } diff --git a/submodules/TelegramUI/Components/MediaEditor/Sources/VideoTextureSource.swift b/submodules/TelegramUI/Components/MediaEditor/Sources/VideoTextureSource.swift index baee278657..fb017e0585 100644 --- a/submodules/TelegramUI/Components/MediaEditor/Sources/VideoTextureSource.swift +++ b/submodules/TelegramUI/Components/MediaEditor/Sources/VideoTextureSource.swift @@ -342,8 +342,8 @@ private func verticesData( } let relativeSize = CGSize( - width: size.width / containerSize.width * 2.0, - height: size.height / containerSize.height * 2.0 + width: size.width / containerSize.width, + height: size.height / containerSize.height ) let relativeOffset = CGPoint( x: position.x / containerSize.width, @@ -358,48 +358,27 @@ private func verticesData( size: relativeSize ) - let cosAngle = Float(cos(rotation)) - let sinAngle = Float(sin(rotation)) - - let centerX = Float(rect.midX) - let centerY = Float(rect.midY) - - let halfWidth = Float(rect.width) / 2.0 - let halfHeight = Float(rect.height) / 2.0 - - let x1 = centerX + (halfWidth * cosAngle) - (halfHeight * sinAngle) - let y1 = centerY + (halfWidth * sinAngle) + (halfHeight * cosAngle) - - let x2 = centerX - (halfWidth * cosAngle) - (halfHeight * sinAngle) - let y2 = centerY - (halfWidth * sinAngle) + (halfHeight * cosAngle) - - let x3 = centerX + (halfWidth * cosAngle) + (halfHeight * sinAngle) - let y3 = centerY + (halfWidth * sinAngle) - (halfHeight * cosAngle) - - let x4 = centerX - (halfWidth * cosAngle) + (halfHeight * sinAngle) - let y4 = centerY - (halfWidth * sinAngle) - (halfHeight * cosAngle) - return [ VertexData( - pos: simd_float4(x: x1, y: y1, z: z, w: 1), + pos: simd_float4(x: Float(rect.minX) * 2.0, y: Float(rect.minY) * 2.0, z: z, w: 1), texCoord: topLeft, localPos: simd_float2(0.0, 0.0) ), VertexData( - pos: simd_float4(x: x2, y: y2, z: z, w: 1), + pos: simd_float4(x: Float(rect.maxX) * 2.0, y: Float(rect.minY) * 2.0, z: z, w: 1), texCoord: topRight, localPos: simd_float2(1.0, 0.0) ), VertexData( - pos: simd_float4(x: x3, y: y3, z: z, w: 1), + pos: simd_float4(x: Float(rect.minX) * 2.0, y: Float(rect.maxY) * 2.0, z: z, w: 1), texCoord: bottomLeft, localPos: simd_float2(0.0, 1.0) ), VertexData( - pos: simd_float4(x: x4, y: y4, z: z, w: 1), + pos: simd_float4(x: Float(rect.maxX) * 2.0, y: Float(rect.maxY) * 2.0, z: z, w: 1), texCoord: bottomRight, localPos: simd_float2(1.0, 1.0) - ), + ) ] }