src/macosx/classes/sun/lwawt/LWWindowPeer.java

Print this page




 299             // "buffer", that's why numBuffers - 1
 300             assert numBuffers > 1;
 301 
 302             replaceSurfaceData(numBuffers - 1, caps);
 303         } catch (InvalidPipeException z) {
 304             throw new AWTException(z.toString());
 305         }
 306     }
 307 
 308     @Override
 309     public final Image getBackBuffer() {
 310         synchronized (getStateLock()) {
 311             return backBuffer;
 312         }
 313     }
 314 
 315     @Override
 316     public void flip(int x1, int y1, int x2, int y2,
 317                      BufferCapabilities.FlipContents flipAction)
 318     {
 319         //Note: constraints must be applied. see applyConstrain().
 320         platformWindow.flip(x1, y1, x2, y2, flipAction);

















 321     }
 322 
 323     @Override
 324     public final void destroyBuffers() {
 325         final Image oldBB = getBackBuffer();
 326         synchronized (getStateLock()) {
 327             backBuffer = null;
 328         }
 329         if (oldBB != null) {
 330             oldBB.flush();
 331         }
 332     }
 333 
 334     @Override
 335     public void setBounds(int x, int y, int w, int h, int op) {
 336         if ((op & SET_CLIENT_SIZE) != 0) {
 337             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 338             // instead of pulling 'insets' field up to LWComponentPeer
 339             // no need to add insets since Window's notion of width and height includes insets.
 340             op &= ~SET_CLIENT_SIZE;




 299             // "buffer", that's why numBuffers - 1
 300             assert numBuffers > 1;
 301 
 302             replaceSurfaceData(numBuffers - 1, caps);
 303         } catch (InvalidPipeException z) {
 304             throw new AWTException(z.toString());
 305         }
 306     }
 307 
 308     @Override
 309     public final Image getBackBuffer() {
 310         synchronized (getStateLock()) {
 311             return backBuffer;
 312         }
 313     }
 314 
 315     @Override
 316     public void flip(int x1, int y1, int x2, int y2,
 317                      BufferCapabilities.FlipContents flipAction)
 318     {
 319         final BufferedImage buffer = (BufferedImage)getBackBuffer();
 320         if (buffer == null) {
 321             throw new IllegalStateException("Buffers have not been created");
 322         }
 323         final Graphics g = getGraphics();
 324         try {
 325             g.drawImage(buffer, x1, y1, x2, y2, x1, y1, x2, y2, null);
 326         } finally {
 327             g.dispose();
 328         }
 329         if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
 330             final Graphics2D bg = (Graphics2D) buffer.getGraphics();
 331             try {
 332                 bg.setBackground(getBackground());
 333                 bg.clearRect(0, 0, buffer.getWidth(), buffer.getHeight());
 334             } finally {
 335                 bg.dispose();
 336             }
 337         }
 338     }
 339 
 340     @Override
 341     public final void destroyBuffers() {
 342         final Image oldBB = getBackBuffer();
 343         synchronized (getStateLock()) {
 344             backBuffer = null;
 345         }
 346         if (oldBB != null) {
 347             oldBB.flush();
 348         }
 349     }
 350 
 351     @Override
 352     public void setBounds(int x, int y, int w, int h, int op) {
 353         if ((op & SET_CLIENT_SIZE) != 0) {
 354             // SET_CLIENT_SIZE is only applicable to window peers, so handle it here
 355             // instead of pulling 'insets' field up to LWComponentPeer
 356             // no need to add insets since Window's notion of width and height includes insets.
 357             op &= ~SET_CLIENT_SIZE;