Skip to content

Commit 4a5493b

Browse files
committed
fix(ios): mapPoints function fix
1 parent d6207c5 commit 4a5493b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Diff for: src/canvas.ios.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -373,11 +373,11 @@ export class Matrix implements IMatrix {
373373
}
374374
public mapPoints(...args) {
375375
let src: number[];
376-
let dstIndex: number,
376+
let dstIndex: number = 0,
377377
srcIndex: number = 0,
378378
pointCount: number;
379379
const pts: number[] = args[0];
380-
if (args.length === 2) {
380+
if (args.length <= 2) {
381381
src = args[1];
382382
} else {
383383
dstIndex = args[1] || 0;
@@ -386,7 +386,7 @@ export class Matrix implements IMatrix {
386386
src = args[2];
387387
}
388388
src = src || pts;
389-
pointCount = Math.floor(pointCount || src.length);
389+
pointCount = Math.floor(pointCount || src.length / 2);
390390
for (let index = 0; index < pointCount; index += 2) {
391391
const cgPoint = CGPointApplyAffineTransform(CGPointMake(src[index + srcIndex], src[index + srcIndex + 1]), this._transform);
392392
pts[index + dstIndex] = cgPoint.x;
@@ -2121,7 +2121,7 @@ export class LinearGradient {
21212121
if (!this._gradient) {
21222122
if (Array.isArray(this.colors)) {
21232123
const cgColors = this.colors.map((c) => (c instanceof Color ? c : new Color(c)).ios.CGColor);
2124-
this._gradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), cgColors as any, null);
2124+
this._gradient = CGGradientCreateWithColors(CGColorSpaceCreateDeviceRGB(), cgColors as any, this.stops);
21252125
CFRetain(this._gradient);
21262126
} else {
21272127
const cgColors = [this.colors, this.stops].map((c) => (c instanceof Color ? c : new Color(c)).ios.CGColor);

0 commit comments

Comments
 (0)