Skip to content

Conversation

@shai-almog
Copy link
Collaborator

Motivation

  • Screenshot tests produced different images across JDK8 and JDK17/21 due to platform-dependent Graphics drawing and coordinate-based arc sizing.
  • The intent is to make screenshot output deterministic and independent of JVM rendering differences.

Description

  • Replaced on-the-fly Graphics gradient drawing in DrawGradient with a deterministic pixel buffer via a new buildGradientImage method and draw the cached Image instead.
  • Added size-aware caching (gradientImage, cachedWidth, cachedHeight) so the pixel buffer is rebuilt only when dimensions change.
  • Implemented rasterized gradient helpers (fillLinearGradient, fillRadialGradient, fillRectRadialGradient, blendColor, angleInArc) that produce consistent pixel output using integer RGB buffers and Image.createImage(int[], width, height).
  • Fixed FillArc to compute arc width/height from bounds (rather than using coordinate arithmetic) and added a guard to stop when dimensions become non-positive before calling fillArc.

Testing

  • No automated tests were executed in this change (mvn/CI runs were not requested).

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants