src/demo/share/java2d/J2DBench/src/j2dbench/tests/ImageTests.java

Print this page




 754                     } while (--numReps > 0);
 755                 }
 756             } else {
 757                 tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
 758                 if (ictx.touchSrc) {
 759                     Graphics srcG = src.getGraphics();
 760                     do {
 761                         srcG.fillRect(0, 0, 1, 1);
 762                         g.drawImage(src, tx, null);
 763                     } while (--numReps > 0);
 764                 } else {
 765                     do {
 766                         g.drawImage(src, tx, null);
 767                     } while (--numReps > 0);
 768                 }
 769             }
 770             g.translate(-ictx.orgX, -ictx.orgY);
 771         }
 772     }
 773 
 774     private static abstract class ImageOpTests extends ImageTests {
 775         ImageOpTests(Group parent, String nodeName, String desc) {
 776             super(parent, nodeName, desc,
 777                   new Modifier.Filter() {
 778                       public boolean isCompatible(Object val) {
 779                           // Filter out all non-BufferedImage sources
 780                           DrawableImage di = (DrawableImage) val;
 781                           Group imgtype = di.getParent();
 782                           return
 783                               !(imgtype instanceof VolatileImg) &&
 784                               !(imgtype instanceof OffScreen);
 785                       }
 786                   });
 787             addDependencies(imageOpOptRoot, true);
 788         }
 789 
 790         private static class Context extends ImageTests.Context {
 791             BufferedImageOp bufImgOp;
 792             BufferedImage   bufSrc;
 793             BufferedImage   bufDst;
 794 




 754                     } while (--numReps > 0);
 755                 }
 756             } else {
 757                 tx.setTransform(1.0, 0.1, 0.1, 1.0, x, y);
 758                 if (ictx.touchSrc) {
 759                     Graphics srcG = src.getGraphics();
 760                     do {
 761                         srcG.fillRect(0, 0, 1, 1);
 762                         g.drawImage(src, tx, null);
 763                     } while (--numReps > 0);
 764                 } else {
 765                     do {
 766                         g.drawImage(src, tx, null);
 767                     } while (--numReps > 0);
 768                 }
 769             }
 770             g.translate(-ictx.orgX, -ictx.orgY);
 771         }
 772     }
 773 
 774     private abstract static class ImageOpTests extends ImageTests {
 775         ImageOpTests(Group parent, String nodeName, String desc) {
 776             super(parent, nodeName, desc,
 777                   new Modifier.Filter() {
 778                       public boolean isCompatible(Object val) {
 779                           // Filter out all non-BufferedImage sources
 780                           DrawableImage di = (DrawableImage) val;
 781                           Group imgtype = di.getParent();
 782                           return
 783                               !(imgtype instanceof VolatileImg) &&
 784                               !(imgtype instanceof OffScreen);
 785                       }
 786                   });
 787             addDependencies(imageOpOptRoot, true);
 788         }
 789 
 790         private static class Context extends ImageTests.Context {
 791             BufferedImageOp bufImgOp;
 792             BufferedImage   bufSrc;
 793             BufferedImage   bufDst;
 794