Skip to content

Commit 60acf0d

Browse files
committed
fix(canvas): ios fix for drawImage
1 parent 1524e18 commit 60acf0d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/ui-canvas/canvas.ios.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,7 +1475,11 @@ export class Canvas implements ICanvas {
14751475
CGContextScaleCTM(ctx, 1.0, -1.0);
14761476
CGContextDrawImage(ctx, CGRectMake(0, 0, image.size.width, image.size.height), cgImage);
14771477
} else {
1478+
const src = args[1] instanceof Rect ? args[1].cgRect : null;
14781479
const dst = args[2] instanceof Rect ? args[2].cgRect : CGRectMake(args[1], args[2], image.size.width, image.size.height);
1480+
if (src) {
1481+
cgImage = CGImageCreateWithImageInRect(cgImage, src);
1482+
}
14791483
CGContextTranslateCTM(ctx, 0, dst.origin.y + dst.size.height);
14801484
CGContextScaleCTM(ctx, 1.0, -1.0);
14811485
CGContextDrawImage(ctx, CGRectMake(dst.origin.x, 0, dst.size.width, dst.size.height), cgImage);

0 commit comments

Comments
 (0)