comparison src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 563:5bbe53b47d0a

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 03 Feb 2020 15:19:30 +0900
parents 87ae979b88cd
children e93a8058344d
comparison
equal deleted inserted replaced
562:87ae979b88cd 563:5bbe53b47d0a
521 ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>(); 521 ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>();
522 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); 522 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
523 GraphicsDevice[] gs = ge.getScreenDevices(); 523 GraphicsDevice[] gs = ge.getScreenDevices();
524 524
525 for (GraphicsDevice gd : gs) { 525 for (GraphicsDevice gd : gs) {
526 int screenNumber = 0;
527 for (GraphicsConfiguration r : gd.getConfigurations()) { 526 for (GraphicsConfiguration r : gd.getConfigurations()) {
528 Rectangle rect = r.getBounds(); 527 Rectangle rect = r.getBounds();
529 //System.out.println("screen "+ screenNumber +":"+rect); 528 //System.out.println("screen "+ rectangles.length() +":"+rect);
530 rectangles.add(rect); 529 rectangles.add(rect);
531 screenNumber++;
532 } 530 }
533 } 531 }
534 Point offset = getScreenOffset(rectangles); 532 Point offset = getScreenOffset(rectangles);
535 ArrayList<FbRectangle> fbRectangles = new ArrayList<FbRectangle>(); 533 ArrayList<FbRectangle> fbRectangles = new ArrayList<FbRectangle>();
536 int screenNumber = 0; 534 int screenNumber = 0;
540 fbrect.setYfb(rect.y + offset.y); 538 fbrect.setYfb(rect.y + offset.y);
541 fbRectangles.add(fbrect); 539 fbRectangles.add(fbrect);
542 screenNumber++; 540 screenNumber++;
543 } 541 }
544 542
545 fbRectangles.sort(new Comparator<FbRectangle>() { 543 fbRectangles.sort((t0, t1) -> t0.getX() < t1.getX() ? -1 : t0.getX() == t1.getX() ? 0 : 1);
546 @Override
547 public int compare(FbRectangle t0, FbRectangle t1) {
548 return t0.getX() < t1.getX() ? -1 : t0.getX() == t1.getX() ? 0 : 1;
549 }
550 });
551 544
552 int retinaOffsetX = 0; 545 int retinaOffsetX = 0;
553 FbRectangle fbRectanglesPrev = fbRectangles.get(0); 546 FbRectangle fbRectanglesPrev = fbRectangles.get(0);
554 for (int i = 1; i < fbRectangles.size(); i++) { 547 for (int i = 1; i < fbRectangles.size(); i++) {
555 FbRectangle fbRect = fbRectangles.get(i); 548 FbRectangle fbRect = fbRectangles.get(i);
561 } 554 }
562 fbRect.setXfb((int) (fbRect.getXfb() + retinaOffsetX)); 555 fbRect.setXfb((int) (fbRect.getXfb() + retinaOffsetX));
563 fbRectanglesPrev = fbRect; 556 fbRectanglesPrev = fbRect;
564 } 557 }
565 558
566 fbRectangles.sort(new Comparator<FbRectangle>() { 559 fbRectangles.sort((t0, t1) -> t0.getY() < t1.getY() ? -1 : t0.getY() == t1.getY() ? 0 : 1);
567 @Override
568 public int compare(FbRectangle t0, FbRectangle t1) {
569 return t0.getY() < t1.getY() ? -1 : t0.getY() == t1.getY() ? 0 : 1;
570 }
571 });
572 560
573 int retinaOffsetY = 0; 561 int retinaOffsetY = 0;
574 fbRectanglesPrev = fbRectangles.get(0); 562 fbRectanglesPrev = fbRectangles.get(0);
575 for (int i = 1; i < fbRectangles.size(); i++) { 563 for (int i = 1; i < fbRectangles.size(); i++) {
576 FbRectangle fbRect = fbRectangles.get(i); 564 FbRectangle fbRect = fbRectangles.get(i);