10 Replies Latest reply on Jan 12, 2009 11:45 AM by 800626

    Double Buffering Slow..is it in the code? or..

      Hi all..
      i make small application which use double buffering..
      here's the code:
      public void update(Graphics g){
              Dimension d = getSize();        
              if (offscreenImage == null || offscreenImage.getWidth(null) < d.width || offscreenImage.getHeight(null) < d.height){
                  if (offscreenImage != null) offscreenImage.flush();
                  offscreenImage = createImage(d.width, d.height);
                  offscreenSize = d;
                  offscreenGraphics = offscreenImage.getGraphics();
              offscreenGraphics.clearRect(0, 0, d.width, d.height);
              g.drawImage(offscreenImage, 0, 0, null);
              System.out.println("DRAW OFFSCREEN GRAPH " + tys_c + " --- " + tys_a + " ---- " + tys_b);
      then i run it on my desktop PC, which specs are
      Core 2 duo E4500 - 2.20Ghz, 2 Gb RAM , Vista Home Premium
      its works fine..took 10 ms

      but when i try on Sony vaio laptop, which specs are:
      core 2 duo T8100 - 2.1Gghz, 2Gb RAM, Vista home premium
      its so slow..took average about 800-900ms (80-90 times slower)

      did i do something wrong with my code...i've been searching all day...but seems no answer

      but all i can think..is not about the code..because it works fine in my desktop...
      but i dunno what cause this problem?
      any body can help?or ever have this kind of problem willing to share?