From 25c660f296f4b4f2db085c0499ac4b23dc1dfc49 Mon Sep 17 00:00:00 2001 From: ci Date: Sat, 15 Aug 2026 12:30:04 +0900 Subject: [PATCH 1/3] perf: optimize silhouette readback context --- src/Silhouette.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Silhouette.js b/src/Silhouette.js index 56c5c55bc..c2a348a6e 100644 --- a/src/Silhouette.js +++ b/src/Silhouette.js @@ -175,7 +175,7 @@ class Silhouette { const canvas = Silhouette._updateCanvas(); canvas.width = width; canvas.height = height; - const ctx = canvas.getContext('2d'); + const ctx = canvas.getContext('2d', {willReadFrequently: true}); ctx.clearRect(0, 0, width, height); ctx.drawImage(this._lazyData, 0, 0, width, height); From 1fa6cc7d23e12aabf8db16e8e3ce400538f44165 Mon Sep 17 00:00:00 2001 From: ci Date: Sat, 15 Aug 2026 12:42:02 +0900 Subject: [PATCH 2/3] perf: optimize text bubble readback context --- src/TextBubbleSkin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TextBubbleSkin.js b/src/TextBubbleSkin.js index aa70c26cc..412440952 100644 --- a/src/TextBubbleSkin.js +++ b/src/TextBubbleSkin.js @@ -69,7 +69,9 @@ class TextBubbleSkin extends Skin { */ this._style = DEFAULT_BUBBLE_STYLE; - this.measurementProvider = new CanvasMeasurementProvider(this._canvas.getContext('2d')); + this.measurementProvider = new CanvasMeasurementProvider( + this._canvas.getContext('2d', {willReadFrequently: true}) + ); this.textWrapper = renderer.createTextWrapper(this.measurementProvider); this._restyleCanvas(); From c69318a6c8d43439fc35fa9e403bf6d2781fdaee Mon Sep 17 00:00:00 2001 From: ci Date: Sat, 15 Aug 2026 13:30:08 +0900 Subject: [PATCH 3/3] perf: scope readback hint to silhouette canvas --- src/TextBubbleSkin.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/TextBubbleSkin.js b/src/TextBubbleSkin.js index 412440952..aa70c26cc 100644 --- a/src/TextBubbleSkin.js +++ b/src/TextBubbleSkin.js @@ -69,9 +69,7 @@ class TextBubbleSkin extends Skin { */ this._style = DEFAULT_BUBBLE_STYLE; - this.measurementProvider = new CanvasMeasurementProvider( - this._canvas.getContext('2d', {willReadFrequently: true}) - ); + this.measurementProvider = new CanvasMeasurementProvider(this._canvas.getContext('2d')); this.textWrapper = renderer.createTextWrapper(this.measurementProvider); this._restyleCanvas();