diff --git a/Classes/LinphoneUI/UIRoundedImageView.m b/Classes/LinphoneUI/UIRoundedImageView.m index 2bed32d38..5f30e34e5 100644 --- a/Classes/LinphoneUI/UIRoundedImageView.m +++ b/Classes/LinphoneUI/UIRoundedImageView.m @@ -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]; } diff --git a/Classes/Utils/Utils.m b/Classes/Utils/Utils.m index 673255747..8c75d9f63 100644 --- a/Classes/Utils/Utils.m +++ b/Classes/Utils/Utils.m @@ -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;