openpencil/tests/engine/render/canvas
Danila Poyarkov d2e380ea9d
fix(core): draw gradient and image strokes as the paint they are (#868)
* fix(core): draw gradient and image strokes as the paint they are

A stroke carried the paint vocabulary already, but nothing read it: the
.fig reader sent every stroke paint through resolvedPaintColor, which
returns black for a gradient or image, the renderer set a flat color on
strokePaint, and the writer emitted a SOLID paint.

Strokes now go through the same conversion fills do in both directions,
and applyGradientFill and applyImageFill take the target Paint so a
stroke reuses the fill shader path instead of growing a second one.
forVisibleStrokes is the single place every stroke draw passes through,
so the shader is set and cleared there rather than threaded through each
draw helper.

Closes #797 for rendering and .fig; authoring a gradient stroke from the
stroke panel is still to come.

* feat(app): author gradient and image strokes from the stroke panel

StrokeSection opened a solid-only colour picker and synthesised a fake
fill for the swatch, so a stroke could never be anything but one flat
colour. It now opens FillPicker like the fill panel does, and
applyStrokePaint keeps the stroke's weight, align, cap, join and dashes
across a paint change.

Completes #797.

* fix(core): let a gradient stroke reach vector outlines and arrowheads

A vector stroke draws its outline as a filled shape with fillPaint, a
dashed one strokes the path, and arrowheads are filled shapes of their
own; each cleared the shader first, so a gradient or image stroke on a
vector drew black. The stroke pass now configures both paints and owns
clearing them, and those helpers keep what it set.

Resolve each gradient stop against the stroke's own colour binding
rather than the stop's position, which looked up another stroke's.

Reported in review of #868.

* fix(core): release the shaders a paint no longer owns

Every gradient and image shader was handed to a paint and then leaked:
the paint takes its own reference, so the caller's handle has to go or
WASM memory grows with each redraw. Only the diamond branch did this.

A gradient stroke now configures two paints, which doubled the leak.

Reported in review of #868.

* test(render): model a shader handle the caller deletes

The pattern shader double returned a plain string, so deleting the
handle the paint no longer owns threw instead of passing.
2026-10-04 13:25:45 +00:00
..
chunks feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
effects fix(core): draw gradient and image strokes as the paint they are (#868) 2026-10-04 13:25:45 +00:00
guides feat(canvas): add Figma guide feedback parity 2026-08-20 14:02:33 +03:00
labels perf(canvas): reuse labels with shared font fallback 2026-09-15 23:08:53 +03:00
tiles feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
visual ci: shard unit tests by owner and cut the quick suite from 100 s to 13 s (#715) 2026-09-17 10:18:16 +03:00
arrow-heads-draw.test.ts feat(canvas): render arrow stroke caps on lines and open vectors 2026-08-31 21:25:38 +03:00
blend.test.ts feat(editor): checkpoint live interaction improvements 2026-09-15 11:36:17 +03:00
boolean.test.ts refactor(canvas): adopt immutable CanvasKit paths (#554) 2026-08-18 23:09:45 +03:00
cache.test.ts
component-label-text.test.ts
corner-smoothing.test.ts refactor(canvas): adopt immutable CanvasKit paths (#554) 2026-08-18 23:09:45 +03:00
culling.test.ts feat(editor): checkpoint live interaction improvements 2026-09-15 11:36:17 +03:00
derived-text.test.ts feat(fig): occurrence-scoped instance interpretation as the single .fig reader 2026-10-01 11:20:27 +04:00
diamond-gradient.test.ts fix(canvas): preserve paint geometry and color fidelity 2026-09-16 02:57:56 +03:00
effect-raster-cache.test.ts refactor(canvas): share bounded resource cache bookkeeping 2026-09-15 21:28:16 +03:00
effect-raster-integration.test.ts refactor(canvas): share bounded resource cache bookkeeping 2026-09-15 21:28:16 +03:00
font-readiness.test.ts feat: split SceneGraph and Pen packages 2026-06-30 10:54:32 +03:00
gradient.test.ts
image-fill.test.ts fix(renderer): preserve proportions of FIT image fills 2026-09-13 13:48:11 +03:00
label-cache.test.ts test: align label cache contracts with component members 2026-09-16 16:14:12 +03:00
layout-grids.test.ts feat: split SceneGraph and Pen packages 2026-06-30 10:54:32 +03:00
line.test.ts feat(scene-graph)!: make a stroke a paint (#864) 2026-10-04 13:38:05 +04:00
masks.test.ts feat(editor): checkpoint live interaction improvements 2026-09-15 11:36:17 +03:00
measurement.test.ts feat(canvas): measure distances between layers (#515) 2026-08-14 18:18:55 +03:00
normalize-dash-pattern.test.ts fix(canvas): normalize imported dash patterns 2026-08-31 22:25:48 +03:00
painted-text.test.ts test(canvas): load painted-text font fixtures explicitly 2026-09-16 03:27:10 +03:00
picture-invalidation.test.ts refactor(canvas): share bounded resource cache bookkeeping 2026-09-15 21:28:16 +03:00
raster-export.test.ts fix(fig): preserve component instance rendering 2026-08-10 04:30:06 -03:00
renderer-lifecycle.test.ts feat: preview streamed JSX on the canvas (#692) 2026-10-01 10:52:36 +04:00
retained-backing-pixels.test.ts fix(canvas): discard stale zoom fallback pictures 2026-09-15 17:40:34 +03:00
retained-backing.test.ts fix(renderer): rasterize settled scenes at viewport origin 2026-09-15 13:25:43 +03:00
schema-fill-fallback.test.ts fix(core): draw gradient and image strokes as the paint they are (#868) 2026-10-04 13:25:45 +00:00
surface-replacement.test.ts perf(canvas): rebuild navigation rendering (#591) 2026-08-31 13:39:40 +03:00
text-font-variations.test.ts fix(text): render variable font styles at their named instances (#773) 2026-09-26 11:25:01 +04:00
text-preparation-cache.test.ts perf(text): preserve coverage across paragraph eviction 2026-09-15 16:32:07 +03:00
text.test.ts fix(fonts): explain PingFang substitution and draw its CJK text (#781) 2026-09-26 11:14:30 +04:00
variable-modes.test.ts fix(fig): honor node-scoped variable modes 2026-07-21 00:23:00 +03:00