mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
UI: always square images before rounding
This commit is contained in:
parent
2813422b79
commit
c3a5ae91b3
2 changed files with 4 additions and 4 deletions
|
|
@ -45,7 +45,7 @@ INIT_WITH_COMMON {
|
|||
|
||||
- (void)setImage:(UIImage *)image bordered:(BOOL)bordered withRoundedRadius:(BOOL)rounded {
|
||||
// We have to scale image to layers limits so that when we round image, we have a proper circle
|
||||
[super setImage:image];
|
||||
[super setImage:[image squareCrop]];
|
||||
[self setBordered:bordered];
|
||||
[self setRoundRadius];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -457,10 +457,10 @@ void linphone_iphone_log_handler(int lev, const char *fmt, va_list args) {
|
|||
- (UIImage *)squareCrop {
|
||||
// This calculates the crop area.
|
||||
|
||||
float originalWidth = self.size.width;
|
||||
float originalHeight = self.size.height;
|
||||
size_t originalWidth = CGImageGetWidth(self.CGImage);
|
||||
size_t originalHeight = CGImageGetHeight(self.CGImage);
|
||||
|
||||
float edge = fminf(originalWidth, originalHeight);
|
||||
size_t edge = MIN(originalWidth, originalHeight);
|
||||
|
||||
float posX = (originalWidth - edge) / 2.0f;
|
||||
float posY = (originalHeight - edge) / 2.0f;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue