Skip to content

Commit 93788c2

Browse files
authored
Merge pull request #31 from SDWebImage/bugfix_scale
Fix the calculation when aspect ratio == true
2 parents 5038c71 + fc04ccd commit 93788c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

SDWebImageSVGCoder/Classes/SDImageSVGCoder.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,14 +214,16 @@ - (UIImage *)createBitmapSVGWithData:(nonnull NSData *)data targetSize:(CGSize)t
214214
if (targetSize.width <= 0) {
215215
yScale = yRatio;
216216
xScale = yRatio;
217-
targetSize.width = size.width * yRatio;
217+
targetSize.width = size.width * xScale;
218218
} else if (targetSize.height <= 0) {
219219
xScale = xRatio;
220220
yScale = xRatio;
221-
targetSize.height = size.height * xRatio;
221+
targetSize.height = size.height * yScale;
222222
} else {
223223
xScale = MIN(xRatio, yRatio);
224224
yScale = MIN(xRatio, yRatio);
225+
targetSize.width = size.width * xScale;
226+
targetSize.height = size.height * yScale;
225227
}
226228
} else {
227229
// If we specify only one length of the size but don't keep the ratio, use original size

0 commit comments

Comments
 (0)