• Sebastiano Poggi's avatar
    [SKIKO-1082] Fix Metal Swing offscreen rendering crash when drawing to a SW renderer (#1190) · 74ce67b5
    Sebastiano Poggi authored
    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: 's avatarIgor Demin <igordmn@users.noreply.github.com>
    74ce67b5
Name
Last commit
Last update
.github Loading commit data...
.run Loading commit data...
gradle/wrapper Loading commit data...
samples Loading commit data...
skiko Loading commit data...
.gitignore Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DEVELOPMENT.md Loading commit data...
LICENSE Loading commit data...
NOTICE Loading commit data...
README.md Loading commit data...
SECURITY.md Loading commit data...
dependencies.toml Loading commit data...
gradle.properties Loading commit data...
gradlew Loading commit data...
gradlew.bat Loading commit data...
settings.gradle.kts Loading commit data...