* @function LevelRenderer.Shape.prototype.doClip *
(ctx)
| 389 | * |
| 390 | */ |
| 391 | doClip(ctx) { |
| 392 | var clipShapeInvTransform = SUtil.Util_matrix.create(); |
| 393 | |
| 394 | if (this.__clipShapes) { |
| 395 | for (var i = 0; i < this.__clipShapes.length; i++) { |
| 396 | var clipShape = this.__clipShapes[i]; |
| 397 | if (clipShape.needTransform) { |
| 398 | let m = clipShape.transform; |
| 399 | SUtil.Util_matrix.invert(clipShapeInvTransform, m); |
| 400 | ctx.transform( |
| 401 | m[0], m[1], |
| 402 | m[2], m[3], |
| 403 | m[4], m[5] |
| 404 | ); |
| 405 | } |
| 406 | ctx.beginPath(); |
| 407 | clipShape.buildPath(ctx, clipShape.style); |
| 408 | ctx.clip(); |
| 409 | // Transform back |
| 410 | if (clipShape.needTransform) { |
| 411 | let m = clipShapeInvTransform; |
| 412 | ctx.transform( |
| 413 | m[0], m[1], |
| 414 | m[2], m[3], |
| 415 | m[4], m[5] |
| 416 | ); |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | } |
| 421 | |
| 422 | |
| 423 | /** |
no test coverage detected