OK, I've checked and it appears that we don't use the
  DirectDraw scale loops for Bilinear filtering,
  presumably because we can't control the filtering
  algorithm when doing a DirectDraw stretch Blit.

  The OpenGL pipeline handles it just fine, though.
  As well as the upcoming Direct3D 9 -based pipeline.

  Thanks,
    Dmitri


[EMAIL PROTECTED] wrote:
Thanks for the reply. I've tried using the Volatile Images (which seems to be 
the right approach as suggested by you and also in previous posts). However, 
the scaling the backbuffer is for some reason painfully slow. It takes 4 
seconds for a frame, instead of the 40ms with software based scaling. The 
following short snipped reproduces the problem (justs scales a red square):

private static JFrame frame;
private static JPanel panel;
private static VolatileImage dummyImage;
private static Graphics dummyGraphics;

public static void main(String[] args) throws InterruptedException {
        frame = new JFrame("...");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        panel = new JPanel() {
                public void paintComponent(Graphics g) {
                        if (dummyImage != null) {
                                dummyGraphics.setColor(Color.RED);
                                dummyGraphics.fillRect(700, 350, 100, 100);

                                ((Graphics2D) 
g).setRenderingHint(RenderingHints.KEY_INTERPOLATION, 
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
                                long s = System.nanoTime();
                                g.drawImage(dummyImage, 0, 0, 1600, 900, 0, 0, 
800, 450, null);
                                System.out.println((System.nanoTime() - s) / 
1000000);
                                        
System.out.println(dummyImage.getCapabilities().isAccelerated() + " " + 
((Graphics2D) g).getDeviceConfiguration().getImageCapabilities().isAccelerated());
                        }
                }
        };
        frame.add(panel);
        frame.setSize(1700, 1000);

        GraphicsEnvironment ge = 
GraphicsEnvironment.getLocalGraphicsEnvironment();
        GraphicsConfiguration gc = 
ge.getDefaultScreenDevice().getDefaultConfiguration();
        dummyImage = gc.createCompatibleVolatileImage(800, 450, 
Transparency.OPAQUE);
        dummyGraphics = dummyImage.getGraphics();
        System.out.println(dummyImage.validate(gc));
        System.out.println(dummyImage.validate(gc));

        frame.setVisible(true);

        Thread.sleep(4000);
        for (int i = 0; i < 1000; i++) {
                Thread.sleep(100);
                frame.repaint();
        }
}

The console output is:

Direct3D pipeline enabled on screen 0
1
0
4120
true true
4113
true true
4112
true true
3 calls to sun.java2d.windows.DDBlitLoops::Blit("Integer RGB DirectDraw", SrcNoEa, 
"Integer RGB DirectDraw")
10 calls to D3DFillRect
3 calls to sun.java2d.loops.TransformHelper::TransformHelper(IntRgb, SrcNoEa, 
IntArgbPre)
16 total calls to 3 different primitives

The VM params are:

 -Dsun.java2d.d3d=True -Dsun.java2d.ddscale=true -Dsun.java2d.trace=count

It is the same result with the two PCs mentioned in the previous post. Only way 
I can think of that it gets that slow is that the images are kept in the video 
buffer but for some reason scaling is still done in software. Any ideas of what 
is wrong? Am I missing something?

Thanks, Remo
[Message sent by forum member 'remmeier' (remmeier)]

http://forums.java.net/jive/thread.jspa?messageID=223021

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to