changeset 4889:ecbd4c9fc9c1

7124219: [macosx] Unable to draw images to fullscreen Reviewed-by: serb
author bae
date Sun, 11 Mar 2012 10:51:45 +0400
parents ffdd6fa55445
children a2fe76236162
files src/macosx/classes/sun/lwawt/LWWindowPeer.java
diffstat 1 files changed, 19 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Wed Mar 07 09:18:46 2012 -0500
+++ b/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Sun Mar 11 10:51:45 2012 +0400
@@ -316,8 +316,25 @@
     public void flip(int x1, int y1, int x2, int y2,
                      BufferCapabilities.FlipContents flipAction)
     {
-        //Note: constraints must be applied. see applyConstrain().
-        platformWindow.flip(x1, y1, x2, y2, flipAction);
+        final BufferedImage buffer = (BufferedImage)getBackBuffer();
+        if (buffer == null) {
+            throw new IllegalStateException("Buffers have not been created");
+        }
+        final Graphics g = getGraphics();
+        try {
+            g.drawImage(buffer, x1, y1, x2, y2, x1, y1, x2, y2, null);
+        } finally {
+            g.dispose();
+        }
+        if (flipAction == BufferCapabilities.FlipContents.BACKGROUND) {
+            final Graphics2D bg = (Graphics2D) buffer.getGraphics();
+            try {
+                bg.setBackground(getBackground());
+                bg.clearRect(0, 0, buffer.getWidth(), buffer.getHeight());
+            } finally {
+                bg.dispose();
+            }
+        }
     }
 
     @Override