@solidtv/renderer 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/src/core/CoreNode.js +13 -11
  2. package/dist/src/core/CoreNode.js.map +1 -1
  3. package/dist/src/core/CoreTextNode.js +2 -1
  4. package/dist/src/core/CoreTextNode.js.map +1 -1
  5. package/dist/src/core/lib/utils.d.ts +2 -2
  6. package/dist/src/core/lib/utils.js +21 -21
  7. package/dist/src/core/lib/utils.js.map +1 -1
  8. package/dist/src/core/renderers/CoreRenderer.d.ts +0 -30
  9. package/dist/src/core/renderers/CoreRenderer.js.map +1 -1
  10. package/dist/src/core/renderers/canvas/CanvasRenderer.d.ts +1 -1
  11. package/dist/src/core/renderers/canvas/CanvasRenderer.js +22 -38
  12. package/dist/src/core/renderers/canvas/CanvasRenderer.js.map +1 -1
  13. package/dist/src/core/renderers/canvas/CanvasShaderNode.d.ts +1 -2
  14. package/dist/src/core/renderers/canvas/CanvasShaderNode.js.map +1 -1
  15. package/dist/src/core/renderers/webgl/SdfRenderOp.d.ts +5 -5
  16. package/dist/src/core/renderers/webgl/SdfRenderOp.js +8 -8
  17. package/dist/src/core/renderers/webgl/SdfRenderOp.js.map +1 -1
  18. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js +3 -4
  19. package/dist/src/core/renderers/webgl/WebGlShaderProgram.js.map +1 -1
  20. package/dist/src/core/shaders/canvas/Border.js +8 -11
  21. package/dist/src/core/shaders/canvas/Border.js.map +1 -1
  22. package/dist/src/core/shaders/canvas/HolePunch.js +2 -1
  23. package/dist/src/core/shaders/canvas/HolePunch.js.map +1 -1
  24. package/dist/src/core/shaders/canvas/LinearGradient.js +23 -4
  25. package/dist/src/core/shaders/canvas/LinearGradient.js.map +1 -1
  26. package/dist/src/core/shaders/canvas/RadialGradient.js +7 -5
  27. package/dist/src/core/shaders/canvas/RadialGradient.js.map +1 -1
  28. package/dist/src/core/shaders/canvas/Rounded.js +2 -2
  29. package/dist/src/core/shaders/canvas/Rounded.js.map +1 -1
  30. package/dist/src/core/shaders/canvas/RoundedWithBorder.js +2 -2
  31. package/dist/src/core/shaders/canvas/RoundedWithBorder.js.map +1 -1
  32. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js +5 -4
  33. package/dist/src/core/shaders/canvas/RoundedWithBorderAndShadow.js.map +1 -1
  34. package/dist/src/core/shaders/canvas/RoundedWithShadow.js +5 -4
  35. package/dist/src/core/shaders/canvas/RoundedWithShadow.js.map +1 -1
  36. package/dist/src/core/shaders/canvas/Shadow.js +4 -2
  37. package/dist/src/core/shaders/canvas/Shadow.js.map +1 -1
  38. package/dist/src/core/shaders/canvas/utils/render.js +0 -15
  39. package/dist/src/core/shaders/canvas/utils/render.js.map +1 -1
  40. package/dist/tsconfig.dist.tsbuildinfo +1 -1
  41. package/package.json +1 -1
  42. package/src/core/CoreNode.test.ts +2 -2
  43. package/src/core/CoreNode.ts +13 -11
  44. package/src/core/CoreTextNode.ts +3 -1
  45. package/src/core/lib/utils.ts +23 -25
  46. package/src/core/renderers/CoreRenderer.ts +0 -31
  47. package/src/core/renderers/canvas/CanvasRenderer.ts +24 -42
  48. package/src/core/renderers/canvas/CanvasShaderNode.ts +1 -2
  49. package/src/core/renderers/webgl/SdfRenderOp.ts +7 -7
  50. package/src/core/renderers/webgl/WebGlShaderProgram.ts +3 -6
  51. package/src/core/shaders/canvas/Border.ts +11 -15
  52. package/src/core/shaders/canvas/HolePunch.ts +2 -1
  53. package/src/core/shaders/canvas/LinearGradient.ts +26 -7
  54. package/src/core/shaders/canvas/RadialGradient.ts +7 -10
  55. package/src/core/shaders/canvas/Rounded.ts +5 -5
  56. package/src/core/shaders/canvas/RoundedWithBorder.ts +5 -5
  57. package/src/core/shaders/canvas/RoundedWithBorderAndShadow.ts +9 -8
  58. package/src/core/shaders/canvas/RoundedWithShadow.ts +6 -5
  59. package/src/core/shaders/canvas/Shadow.ts +7 -5
  60. package/src/core/shaders/canvas/utils/render.ts +0 -18
@@ -2,11 +2,7 @@ import type { CoreNode } from '../../CoreNode.js';
2
2
  import { SubTexture } from '../../textures/SubTexture.js';
3
3
  import { TextureType, type Texture } from '../../textures/Texture.js';
4
4
  import type { CoreContextTexture } from '../CoreContextTexture.js';
5
- import {
6
- CoreRenderer,
7
- type CoreRendererOptions,
8
- type QuadOptions,
9
- } from '../CoreRenderer.js';
5
+ import { CoreRenderer, type CoreRendererOptions } from '../CoreRenderer.js';
10
6
  import { CanvasTexture } from './CanvasTexture.js';
11
7
  import { parseColor } from '../../lib/colorParser.js';
12
8
  import { CanvasShaderNode, type CanvasShaderType } from './CanvasShaderNode.js';
@@ -52,7 +48,7 @@ export class CanvasRenderer extends CoreRenderer {
52
48
  const ctx = this.context;
53
49
  const { tx, ty, ta, tb, tc, td } = node.globalTransform!;
54
50
  const clippingRect = node.clippingRect;
55
- let texture = node.renderTexture;
51
+ let texture = (node.props.texture || this.stage.defaultTexture) as Texture;
56
52
  // The Canvas2D renderer only supports image textures, no textures are used for color blocks
57
53
  if (texture !== null) {
58
54
  const textureType = texture.type;
@@ -67,7 +63,7 @@ export class CanvasRenderer extends CoreRenderer {
67
63
  }
68
64
 
69
65
  const hasTransform = ta !== 1;
70
- const hasClipping = clippingRect.width !== 0 && clippingRect.height !== 0;
66
+ const hasClipping = clippingRect.w !== 0 && clippingRect.h !== 0;
71
67
  const shader = node.props.shader;
72
68
  const hasShader = shader !== null;
73
69
 
@@ -82,8 +78,8 @@ export class CanvasRenderer extends CoreRenderer {
82
78
 
83
79
  if (hasClipping === true) {
84
80
  const path = new Path2D();
85
- const { x, y, width, height } = clippingRect;
86
- path.rect(x, y, width, height);
81
+ const { x, y, w, h } = clippingRect;
82
+ path.rect(x, y, w, h);
87
83
  ctx.clip(path);
88
84
  }
89
85
 
@@ -104,40 +100,13 @@ export class CanvasRenderer extends CoreRenderer {
104
100
 
105
101
  if (hasShader === true) {
106
102
  let renderContext: (() => void) | null = () => {
107
- this.renderContext(node);
108
- };
109
- const quad: QuadOptions = {
110
- width: node.props.w,
111
- height: node.props.h,
112
- colorTl: node.premultipliedColorTl,
113
- colorTr: node.premultipliedColorTr,
114
- colorBl: node.premultipliedColorBl,
115
- colorBr: node.premultipliedColorBr,
116
- texture: texture,
117
- textureOptions: node.props.textureOptions,
118
- textureCoords: node.renderTextureCoords,
119
- zIndex: node.zIndex, // zIndex usage?
120
- shader: shader,
121
- alpha: node.worldAlpha,
122
- clippingRect: clippingRect,
123
- tx,
124
- ty,
125
- ta,
126
- tb,
127
- tc,
128
- td,
129
- renderCoords: node.renderCoords,
130
- rtt: node.props.rtt,
131
- parentHasRenderTexture: node.parentHasRenderTexture,
132
- framebufferDimensions: node.parentHasRenderTexture
133
- ? node.parentFramebufferDimensions
134
- : null,
103
+ this.renderContext(node, texture);
135
104
  };
136
105
 
137
- (shader as CanvasShaderNode).render(ctx, quad, renderContext);
106
+ (shader as CanvasShaderNode).render(ctx, node, renderContext);
138
107
  renderContext = null;
139
108
  } else {
140
- this.renderContext(node);
109
+ this.renderContext(node, texture);
141
110
  }
142
111
 
143
112
  if (saveAndRestore) {
@@ -145,9 +114,8 @@ export class CanvasRenderer extends CoreRenderer {
145
114
  }
146
115
  }
147
116
 
148
- renderContext(node: CoreNode) {
117
+ renderContext(node: CoreNode, texture: Texture) {
149
118
  const color = node.premultipliedColorTl;
150
- const texture = node.renderTexture!;
151
119
  const textureType = texture.type;
152
120
  const tx = node.globalTransform!.tx;
153
121
  const ty = node.globalTransform!.ty;
@@ -201,8 +169,22 @@ export class CanvasRenderer extends CoreRenderer {
201
169
  endY = ty;
202
170
  endColor = node.premultipliedColorTr;
203
171
  }
172
+
173
+ let startColor = color;
174
+ const startAlpha = (startColor >>> 24) & 0xff;
175
+ const endAlpha = (endColor >>> 24) & 0xff;
176
+
177
+ // if one of the colors has 0 alpha, we want to match the RGB channels
178
+ // to the other color to prevent white bleed during zero alpha interpolation.
179
+ if (startAlpha === 0 && endAlpha > 0) {
180
+ startColor =
181
+ ((startColor & 0xff000000) | (endColor & 0x00ffffff)) >>> 0;
182
+ } else if (endAlpha === 0 && startAlpha > 0) {
183
+ endColor = ((endColor & 0xff000000) | (startColor & 0x00ffffff)) >>> 0;
184
+ }
185
+
204
186
  const gradient = this.context.createLinearGradient(tx, ty, endX, endY);
205
- gradient.addColorStop(0, normalizeCanvasColor(color));
187
+ gradient.addColorStop(0, normalizeCanvasColor(startColor));
206
188
  gradient.addColorStop(1, normalizeCanvasColor(endColor));
207
189
  this.context.fillStyle = gradient;
208
190
  this.context.fillRect(tx, ty, width, height);
@@ -1,7 +1,6 @@
1
1
  import type { CoreNode } from '../../CoreNode.js';
2
2
  import { normalizeCanvasColor } from '../../lib/colorCache.js';
3
3
  import type { Stage } from '../../Stage.js';
4
- import type { QuadOptions } from '../CoreRenderer.js';
5
4
  import { CoreShaderNode, type CoreShaderType } from '../CoreShaderNode.js';
6
5
 
7
6
  export type CanvasShaderType<
@@ -11,7 +10,7 @@ export type CanvasShaderType<
11
10
  render: (
12
11
  this: CanvasShaderNode<T, C>,
13
12
  ctx: CanvasRenderingContext2D,
14
- quad: QuadOptions,
13
+ node: CoreNode,
15
14
  renderContext: () => void,
16
15
  ) => void;
17
16
  update?: (this: CanvasShaderNode<T, C>, node: CoreNode) => void;
@@ -33,10 +33,10 @@ export class SdfRenderOp extends CoreRenderOp {
33
33
  readonly renderer: WebGlRenderer,
34
34
  readonly shader: WebGlShaderNode,
35
35
  readonly quadBufferCollection: BufferCollection,
36
- public worldAlpha: number,
37
- public clippingRect: RectWithValid,
38
- readonly width: number,
39
- readonly height: number,
36
+ readonly worldAlpha: number,
37
+ readonly clippingRect: RectWithValid,
38
+ readonly w: number,
39
+ readonly h: number,
40
40
  readonly rtt: boolean,
41
41
  public parentHasRenderTexture: boolean,
42
42
  public framebufferDimensions: Dimensions | null,
@@ -70,8 +70,8 @@ export class SdfRenderOp extends CoreRenderOp {
70
70
  const pixelRatio =
71
71
  USE_RTT && this.parentHasRenderTexture ? 1 : stage.pixelRatio;
72
72
  const clipX = Math.round(this.clippingRect.x * pixelRatio);
73
- const clipWidth = Math.round(this.clippingRect.width * pixelRatio);
74
- const clipHeight = Math.round(this.clippingRect.height * pixelRatio);
73
+ const clipWidth = Math.round(this.clippingRect.w * pixelRatio);
74
+ const clipHeight = Math.round(this.clippingRect.h * pixelRatio);
75
75
  let clipY = Math.round(
76
76
  options.canvas.height - clipHeight - this.clippingRect.y * pixelRatio,
77
77
  );
@@ -79,7 +79,7 @@ export class SdfRenderOp extends CoreRenderOp {
79
79
  // to be relative to the parent's framebuffer
80
80
  if (USE_RTT && this.parentHasRenderTexture) {
81
81
  clipY = this.framebufferDimensions
82
- ? this.framebufferDimensions.h - this.height
82
+ ? this.framebufferDimensions.h - this.h
83
83
  : 0;
84
84
  }
85
85
 
@@ -134,7 +134,7 @@ export class WebGlShaderProgram implements CoreShaderProgram {
134
134
  return this.lifecycle.canBatch(node, currentRenderOp);
135
135
  }
136
136
 
137
- const { time, worldAlpha, width, height } = node;
137
+ const { time, worldAlpha, w, h } = node;
138
138
 
139
139
  if (this.useTimeValue === true) {
140
140
  if (time !== currentRenderOp.time) {
@@ -149,10 +149,7 @@ export class WebGlShaderProgram implements CoreShaderProgram {
149
149
  }
150
150
 
151
151
  if (this.useSystemDimensions === true) {
152
- if (
153
- width !== currentRenderOp.width ||
154
- height !== currentRenderOp.height
155
- ) {
152
+ if (w !== currentRenderOp.w || h !== currentRenderOp.h) {
156
153
  return false;
157
154
  }
158
155
  }
@@ -235,7 +232,7 @@ export class WebGlShaderProgram implements CoreShaderProgram {
235
232
  }
236
233
 
237
234
  if (this.useSystemDimensions === true) {
238
- this.glw.uniform2f('u_dimensions', renderOp.width, renderOp.height);
235
+ this.glw.uniform2f('u_dimensions', renderOp.w, renderOp.h);
239
236
  }
240
237
 
241
238
  const shader = renderOp.shader as WebGlShaderNode;
@@ -72,39 +72,35 @@ export const Border: CanvasShaderType<BorderProps, ComputedBorderValues> = {
72
72
  this.computed.innerW = outerW - l - r;
73
73
  this.computed.innerH = outerH - t - b;
74
74
  },
75
- render(ctx, quad, renderContext) {
75
+ render(ctx, node, renderContext) {
76
76
  renderContext();
77
77
  const computed = this.computed as ComputedBorderValues;
78
+ const { tx, ty } = node.globalTransform!;
79
+ const { w, h } = node.props;
78
80
  ctx.strokeStyle = computed.borderColor!;
79
81
  if (computed.borderAsym === false && this.props!.w[0] > 0) {
80
82
  ctx.lineWidth = this.props!.w[0];
81
83
  ctx.beginPath();
82
84
  ctx.strokeRect(
83
- quad.tx + computed.outerX,
84
- quad.ty + computed.outerY,
85
- quad.width + computed.outerW,
86
- quad.height + computed.outerH,
85
+ tx + computed.outerX,
86
+ ty + computed.outerY,
87
+ w + computed.outerW,
88
+ h + computed.outerH,
87
89
  );
88
90
  return;
89
91
  }
90
92
 
91
- // Pre-calculate common values
92
- const tx = quad.tx;
93
- const ty = quad.ty;
94
- const width = quad.width;
95
- const height = quad.height;
96
-
97
93
  // Calculate outer rectangle (including border)
98
94
  const outerX = tx + computed.outerX;
99
95
  const outerY = ty + computed.outerY;
100
- const outerW = width + computed.outerW;
101
- const outerH = height + computed.outerH;
96
+ const outerW = w + computed.outerW;
97
+ const outerH = h + computed.outerH;
102
98
 
103
99
  // Calculate inner rectangle (excluding border)
104
100
  const innerX = tx + computed.innerX;
105
101
  const innerY = ty + computed.innerY;
106
- const innerW = width + computed.innerW;
107
- const innerH = height + computed.innerH;
102
+ const innerW = w + computed.innerW;
103
+ const innerH = h + computed.innerH;
108
104
 
109
105
  // Use clip to subtract inner from outer
110
106
  ctx.save();
@@ -27,8 +27,9 @@ export const HolePunch: CanvasShaderType<
27
27
  ctx.save();
28
28
  renderContext();
29
29
  const { x, y, w, h } = this.props!;
30
+ const gt = quad.globalTransform!;
30
31
  ctx.beginPath();
31
- roundRect(ctx, quad.tx + x, quad.ty + y, w, h, this.computed.radius!);
32
+ roundRect(ctx, gt.tx + x, gt.ty + y, w, h, this.computed.radius!);
32
33
  ctx.closePath();
33
34
  ctx.fillStyle = 'black';
34
35
  ctx.globalCompositeOperation = 'destination-out';
@@ -31,17 +31,36 @@ export const LinearGradient: CanvasShaderType<
31
31
  y0: line * Math.sin(angle) + nHeight * 0.5,
32
32
  x1: line * Math.cos(angle + Math.PI) + nWidth * 0.5,
33
33
  y1: line * Math.sin(angle + Math.PI) + nHeight * 0.5,
34
- colors: this.props!.colors.map((value) => this.toColorString(value)),
34
+ colors: this.props!.colors.map((value, i, arr) => {
35
+ const alpha = (value >>> 24) & 0xff;
36
+ if (alpha === 0) {
37
+ let nearestRGB = value & 0x00ffffff;
38
+ for (let step = 1; step < arr.length; step++) {
39
+ if (i - step >= 0 && ((arr[i - step]! >>> 24) & 0xff) > 0) {
40
+ nearestRGB = arr[i - step]! & 0x00ffffff;
41
+ break;
42
+ }
43
+ if (i + step < arr.length && ((arr[i + step]! >>> 24) & 0xff) > 0) {
44
+ nearestRGB = arr[i + step]! & 0x00ffffff;
45
+ break;
46
+ }
47
+ }
48
+ value = (value & 0xff000000) | nearestRGB;
49
+ }
50
+ return this.toColorString(value);
51
+ }),
35
52
  };
36
53
  },
37
- render(ctx, quad, renderContext) {
54
+ render(ctx, node, renderContext) {
38
55
  renderContext();
39
56
  const computed = this.computed as ComputedLinearGradientValues;
57
+ const { tx, ty } = node.globalTransform!;
58
+ const { w, h } = node.props;
40
59
  const gradient = ctx.createLinearGradient(
41
- quad.tx + computed.x0,
42
- quad.ty + computed.y0,
43
- quad.tx + computed.x1,
44
- quad.ty + computed.y1,
60
+ tx + computed.x0,
61
+ ty + computed.y0,
62
+ tx + computed.x1,
63
+ ty + computed.y1,
45
64
  );
46
65
  const colors = computed.colors;
47
66
  const stops = this.props!.stops;
@@ -49,6 +68,6 @@ export const LinearGradient: CanvasShaderType<
49
68
  gradient.addColorStop(stops[i]!, colors[i]!);
50
69
  }
51
70
  ctx.fillStyle = gradient;
52
- ctx.fillRect(quad.tx, quad.ty, quad.width, quad.height);
71
+ ctx.fillRect(tx, ty, w, h);
53
72
  },
54
73
  };
@@ -39,12 +39,14 @@ export const RadialGradient: CanvasShaderType<
39
39
  colors: props.colors.map((value) => this.toColorString(value)),
40
40
  };
41
41
  },
42
- render(ctx, quad, renderContext) {
42
+ render(ctx, node, renderContext) {
43
43
  renderContext();
44
44
  const { scaleX, scaleY, pivotX, pivotY, colors, size } = this
45
45
  .computed as ComputedRadialGradientValues;
46
- let x = quad.tx + pivotX;
47
- let y = quad.ty + pivotY;
46
+ const { tx, ty } = node.globalTransform!;
47
+ const { w, h } = node.props;
48
+ let x = tx + pivotX;
49
+ let y = ty + pivotY;
48
50
  const stops = this.props!.stops;
49
51
 
50
52
  if (scaleX === scaleY) {
@@ -55,7 +57,7 @@ export const RadialGradient: CanvasShaderType<
55
57
  }
56
58
 
57
59
  ctx.fillStyle = gradient;
58
- ctx.fillRect(quad.tx, quad.ty, quad.width, quad.height);
60
+ ctx.fillRect(tx, ty, w, h);
59
61
  return;
60
62
  }
61
63
 
@@ -70,12 +72,7 @@ export const RadialGradient: CanvasShaderType<
70
72
  }
71
73
 
72
74
  ctx.fillStyle = gradient;
73
- ctx.fillRect(
74
- quad.tx / scaleX,
75
- quad.ty / scaleY,
76
- quad.width / scaleX,
77
- quad.height / scaleY,
78
- );
75
+ ctx.fillRect(tx / scaleX, ty / scaleY, w / scaleX, h / scaleY);
79
76
 
80
77
  ctx.restore();
81
78
  },
@@ -21,14 +21,14 @@ export const Rounded: CanvasShaderType<RoundedProps, ComputedRoundedValues> = {
21
21
  node.h,
22
22
  );
23
23
  },
24
- render(ctx, quad, renderContext) {
24
+ render(ctx, node, renderContext) {
25
25
  const path = new Path2D();
26
26
  roundRect(
27
27
  path,
28
- quad.tx,
29
- quad.ty,
30
- quad.width,
31
- quad.height,
28
+ node.globalTransform!.tx,
29
+ node.globalTransform!.ty,
30
+ node.props.w,
31
+ node.props.h,
32
32
  this.computed.radius!,
33
33
  );
34
34
  ctx.clip(path);
@@ -78,14 +78,14 @@ export const RoundedWithBorder: CanvasShaderType<
78
78
  Math.max(0.0, this.computed.outerBorderRadius[3] - Math.max(l, r)),
79
79
  ];
80
80
  },
81
- render(ctx, quad, renderContext) {
81
+ render(ctx, node, renderContext) {
82
82
  const computed = this.computed as ComputedRoundedWithBorderValues;
83
83
  roundedRectWithBorder(
84
84
  ctx,
85
- quad.tx,
86
- quad.ty,
87
- quad.width,
88
- quad.height,
85
+ node.globalTransform!.tx,
86
+ node.globalTransform!.ty,
87
+ node.props.w,
88
+ node.props.h,
89
89
  computed.radius,
90
90
  this.props!['border-gap'] as number,
91
91
  computed.outerX,
@@ -79,15 +79,16 @@ export const RoundedWithBorderAndShadow: CanvasShaderType<
79
79
  (value) => value + props['shadow-blur'],
80
80
  ) as Vec4;
81
81
  },
82
- render(ctx, quad, renderContext) {
83
- const { tx, ty, width, height } = quad;
82
+ render(ctx, node, renderContext) {
83
+ const { tx, ty } = node.globalTransform!;
84
+ const { w, h } = node.props;
84
85
  const computed = this.computed as ComputedValues;
85
86
  render.shadow(
86
87
  ctx,
87
88
  tx + computed.outerX,
88
89
  ty + computed.outerY,
89
- height + computed.outerH,
90
- width + computed.outerW,
90
+ w + computed.outerW,
91
+ h + computed.outerH,
91
92
  computed.shadowColor,
92
93
  this.props!['shadow-projection'],
93
94
  computed.shadowRadius,
@@ -95,10 +96,10 @@ export const RoundedWithBorderAndShadow: CanvasShaderType<
95
96
  );
96
97
  render.roundedRectWithBorder(
97
98
  ctx,
98
- quad.tx,
99
- quad.ty,
100
- quad.width,
101
- quad.height,
99
+ tx,
100
+ ty,
101
+ w,
102
+ h,
102
103
  computed.radius,
103
104
  this.props!['border-gap'] as number,
104
105
  computed.outerX,
@@ -30,8 +30,9 @@ export const RoundedWithShadow: CanvasShaderType<
30
30
  (value) => value + props['shadow-blur'],
31
31
  ) as Vec4;
32
32
  },
33
- render(ctx, quad, renderContext) {
34
- const { tx, ty, width, height } = quad;
33
+ render(ctx, node, renderContext) {
34
+ const { tx, ty } = node.globalTransform!;
35
+ const { w, h } = node.props;
35
36
  const computed = this.computed as ComputedValues;
36
37
 
37
38
  if (this.props!['shadow-color'] !== 0) {
@@ -39,8 +40,8 @@ export const RoundedWithShadow: CanvasShaderType<
39
40
  ctx,
40
41
  tx,
41
42
  ty,
42
- width,
43
- height,
43
+ w,
44
+ h,
44
45
  computed.shadowColor,
45
46
  this.props!['shadow-projection'],
46
47
  computed.shadowRadius,
@@ -49,7 +50,7 @@ export const RoundedWithShadow: CanvasShaderType<
49
50
  }
50
51
 
51
52
  const path = new Path2D();
52
- render.roundRect(path, tx, ty, width, height, computed.radius);
53
+ render.roundRect(path, tx, ty, w, h, computed.radius);
53
54
  ctx.clip(path);
54
55
  renderContext();
55
56
  },
@@ -18,13 +18,15 @@ export const Shadow: CanvasShaderType<ShadowProps, ComputedShadowValues> = {
18
18
  const blur = this.props!['blur'];
19
19
  this.computed.shadowRadius = [blur, blur, blur, blur];
20
20
  },
21
- render(ctx, quad, renderContext) {
21
+ render(ctx, node, renderContext) {
22
+ const { tx, ty } = node.globalTransform!;
23
+ const { w, h } = node.props;
22
24
  shadow(
23
25
  ctx,
24
- quad.tx,
25
- quad.ty,
26
- quad.width,
27
- quad.height,
26
+ tx,
27
+ ty,
28
+ w,
29
+ h,
28
30
  this.computed.shadowColor!,
29
31
  this.props!['projection'],
30
32
  this.computed.shadowRadius!,
@@ -55,24 +55,6 @@ export function roundedRectWithBorder(
55
55
  innerW += width;
56
56
  innerH += height;
57
57
 
58
- // no gap render strategy - to avoid artifacts between border and node
59
- if (borderGap === 0) {
60
- //draw outer border rounded rect
61
- ctx.beginPath();
62
- roundRect(ctx, outerX, outerY, outerW, outerH, outerBorderRadius);
63
- ctx.fillStyle = borderColor;
64
- ctx.fill();
65
- ctx.closePath();
66
-
67
- const path = new Path2D();
68
- roundRect(path, innerX, innerY, innerW, innerH, innerBorderRadius as Vec4);
69
- ctx.clip(path);
70
- renderContext();
71
- return;
72
- }
73
-
74
- // with gap render strategy
75
-
76
58
  //draw node content first
77
59
  ctx.save();
78
60
  const path = new Path2D();