Commit bbfaf62
authored
Reuse the BufferedImage in SwingOffscreenRenderer (#996)
Fix for
https://youtrack.jetbrains.com/issue/CMP-6722/Excessive-garbage-generation-from-redrawing
Previously, the `draw` method would allocate a `BufferedImage` on every
redraw, which is wasteful. This fix changed `SwingOffscreenRenderer` to
reuse the same instance of `BufferedImage` and only clear it on redraws.
Only changing the draw size would allocate a new `BufferedImage`.1 parent b73b374 commit bbfaf62
File tree
1 file changed
+11
-1
lines changed- skiko/src/awtMain/kotlin/org/jetbrains/skiko/swing
1 file changed
+11
-1
lines changedLines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
56 | 58 | | |
57 | 59 | | |
58 | 60 | | |
59 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
60 | 70 | | |
61 | 71 | | |
62 | 72 | | |
| |||
0 commit comments