Skip to content

Commit

Permalink
8239312: [macOS] javax/swing/JFrame/NSTexturedJFrame/NSTexturedJFrame…
Browse files Browse the repository at this point in the history
….java

Reviewed-by: aph, andrew
Backport-of: 40e667c174269a73cd9b5612673c5e4b2293d6c0
  • Loading branch information
mrserb committed Sep 9, 2024
1 parent cb95a72 commit 068ed1f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.Color;
import java.awt.image.BufferedImage;

import javax.swing.JFrame;
Expand Down Expand Up @@ -74,9 +75,16 @@ public static void main(final String[] args) throws Exception {
private static void testImages(BufferedImage img1, BufferedImage img2,
boolean shouldbeDifferent) {
boolean different = false;
int tol = 5;
for (int x = 0; x < img1.getWidth(); ++x) {
for (int y = 0; y < img1.getHeight(); ++y) {
if (img1.getRGB(x, y) != img2.getRGB(x, y)) {
Color c1 = new Color(img1.getRGB(x, y));
Color c2 = new Color(img2.getRGB(x, y));

if ((Math.abs(c1.getRed() - c2.getRed()) > tol) &&
(Math.abs(c1.getBlue() - c2.getBlue()) > tol) &&
(Math.abs(c1.getGreen() - c2.getGreen()) > tol )) {

different = true;
}
}
Expand Down

0 comments on commit 068ed1f

Please sign in to comment.