[SKIKO-1082] Fix Metal Swing offscreen rendering crash when drawing to a SW renderer (#1190)
This PR fixes Metal Swing offscreen rendering behavior when the active `GraphicsConfiguration` is not compatible with JBR shared textures, and adds focused regression tests for the fallback path. `AcceleratedSwingPainter` now explicitly falls back to software painting for incompatible graphics configurations (for example, offscreen/`BufferedImage` paint flows). ## Changes - Introduced `SharedTexturesAdapter` as a small abstraction over JBR shared textures so production code keeps using JBR while tests can inject a fake adapter. - Updated `MetalSwingRedrawer` to create and pass the shared texture adapter into `AcceleratedSwingPainter`. - Updated `AcceleratedSwingPainter` to support test injection and preserve fallback behaviour for incompatible graphics configurations. - Added minimal test hooks in `AcceleratedSwingPainter` with `org.jetbrains.annotations.VisibleForTesting` so tests can validate cache-reset behaviour. - Added `org.jetbrains:annotations` as an `awtMain` dependency to use `VisibleForTesting`. I can undo this and remove the annotation, but I think it's worth keeping... - Added `AcceleratedSwingPainterTest` covering: - fallback is used for incompatible `GraphicsConfiguration` - accelerated cache state is cleared on fallback - `dispose()` delegates to fallback painter --- Fixes https://youtrack.jetbrains.com/issue/SKIKO-1082 --------- Co-authored-by:Igor Demin <igordmn@users.noreply.github.com>
Showing