Skip to content
This repository was archived by the owner on Mar 26, 2024. It is now read-only.

Commit bce0735

Browse files
committed
Fix drawing semi-transparent windows in double buffering mode
1 parent 250177d commit bce0735

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

projector-client-common/src/commonMain/kotlin/org/jetbrains/projector/client/common/canvas/buffering/DoubleBufferedRenderingSurface.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ class DoubleBufferedRenderingSurface(bufferCanvasFactory: CanvasFactory, private
4949
// optimization: flush only if the buffer is changed
5050
if (buffer.changed) {
5151
buffer.resetChanged()
52-
target.context2d.drawImage(buffer.imageSource, 0.0, 0.0)
52+
target.context2d.apply {
53+
// clear canvas so that semi-transparent parts won't stack on top of each other
54+
clearRect(0.0, 0.0, buffer.width.toDouble(), buffer.height.toDouble())
55+
drawImage(buffer.imageSource, 0.0, 0.0)
56+
}
5357
}
5458
}
5559

0 commit comments

Comments
 (0)