mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Translation fixes
This commit is contained in:
@@ -78,8 +78,37 @@ public func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
|
||||
context.setBlendMode(.copy)
|
||||
|
||||
if useModernPathCalculation {
|
||||
var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
|
||||
if rects.count > 1 {
|
||||
if rects.count == 1 {
|
||||
let path = UIBezierPath(roundedRect: rects[0], cornerRadius: outerRadius).cgPath
|
||||
context.addPath(path)
|
||||
|
||||
if stroke {
|
||||
context.setStrokeColor(color.cgColor)
|
||||
context.setLineWidth(2.0)
|
||||
context.strokePath()
|
||||
} else {
|
||||
context.fillPath()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var combinedRects: [[CGRect]] = []
|
||||
var currentRects: [CGRect] = []
|
||||
for rect in rects {
|
||||
if rect.width.isZero {
|
||||
combinedRects.append(currentRects)
|
||||
currentRects.removeAll()
|
||||
} else {
|
||||
currentRects.append(rect)
|
||||
}
|
||||
}
|
||||
if !currentRects.isEmpty {
|
||||
combinedRects.append(currentRects)
|
||||
}
|
||||
|
||||
for rects in combinedRects {
|
||||
var rects = rects.map { $0.insetBy(dx: -inset, dy: -inset).offsetBy(dx: -topLeft.x, dy: -topLeft.y) }
|
||||
|
||||
let minRadius: CGFloat = 2.0
|
||||
|
||||
for _ in 0 ..< rects.count * rects.count {
|
||||
@@ -186,20 +215,8 @@ public func generateRectsImage(color: UIColor, rects: [CGRect], inset: CGFloat,
|
||||
} else {
|
||||
context.fillPath()
|
||||
}
|
||||
return
|
||||
} else {
|
||||
let path = UIBezierPath(roundedRect: rects[0], cornerRadius: outerRadius).cgPath
|
||||
context.addPath(path)
|
||||
|
||||
if stroke {
|
||||
context.setStrokeColor(color.cgColor)
|
||||
context.setLineWidth(2.0)
|
||||
context.strokePath()
|
||||
} else {
|
||||
context.fillPath()
|
||||
}
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
for i in 0 ..< rects.count {
|
||||
|
||||
Reference in New Issue
Block a user