PageRenderTime 47ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 1ms

/patches/openjdk/6633275-shaped_translucent_windows.patch

https://bitbucket.org/xiaoqiangnk/icedtea6
Patch | 6255 lines | 6090 code | 165 blank | 0 comment | 0 complexity | eed296f75b0858bbc1642a0a31b1d178 MD5 | raw file
Possible License(s): GPL-2.0
  1. diff -Nru openjdk.orig/jdk/make/sun/awt/FILES_c_windows.gmk openjdk/jdk/make/sun/awt/FILES_c_windows.gmk
  2. --- openjdk.orig/jdk/make/sun/awt/FILES_c_windows.gmk 2011-02-16 00:40:21.000000000 +0000
  3. +++ openjdk/jdk/make/sun/awt/FILES_c_windows.gmk 2011-02-16 01:27:24.988327481 +0000
  4. @@ -1,5 +1,5 @@
  5. #
  6. -# Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  7. +# Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  8. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  9. #
  10. # This code is free software; you can redistribute it and/or modify it
  11. @@ -104,7 +104,8 @@
  12. OGLVertexCache.c \
  13. WGLGraphicsConfig.c \
  14. WGLSurfaceData.c \
  15. - AccelGlyphCache.c
  16. + AccelGlyphCache.c \
  17. + rect.c
  18. FILES_cpp = \
  19. CmdIDList.cpp \
  20. diff -Nru openjdk.orig/jdk/make/sun/awt/make.depend openjdk/jdk/make/sun/awt/make.depend
  21. --- openjdk.orig/jdk/make/sun/awt/make.depend 2011-02-16 00:40:21.000000000 +0000
  22. +++ openjdk/jdk/make/sun/awt/make.depend 2011-02-16 01:27:25.000326551 +0000
  23. @@ -16,7 +16,7 @@
  24. $(OBJDIR)/awt_AWTEvent.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  25. -$(OBJDIR)/awt_BitmapUtil.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  26. +$(OBJDIR)/awt_BitmapUtil.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h ../../../src/windows/native/sun/awt/utility/rect.h
  27. $(OBJDIR)/awt_Brush.obj:: $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  28. @@ -32,7 +32,7 @@
  29. $(OBJDIR)/awt_Color.obj:: $(CLASSHDRDIR)/sun_awt_windows_WColor.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Color.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  30. -$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  31. +$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h ../../../src/windows/native/sun/awt/utility/rect.h
  32. $(OBJDIR)/awt_Container.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  33. @@ -150,9 +150,9 @@
  34. $(OBJDIR)/awt_Window.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Container.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_ComponentEvent.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_dlls.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_IconCursor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Panel.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  35. -$(OBJDIR)/Blit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_Blit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  36. +$(OBJDIR)/Blit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_Blit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
  37. -$(OBJDIR)/BlitBg.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_BlitBg.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  38. +$(OBJDIR)/BlitBg.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_BlitBg.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
  39. $(OBJDIR)/BufferedMaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedMaskBlit.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedOpCodes.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntBgr.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/IntRgb.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  40. @@ -246,11 +246,11 @@
  41. $(OBJDIR)/GDIRenderer.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_geom_PathIterator.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIRenderer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  42. -$(OBJDIR)/GDIWindowSurfaceData.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIWindowSurfaceData.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/Disposer.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/java2d/windows/WindowsFlags.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  43. +$(OBJDIR)/GDIWindowSurfaceData.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIWindowSurfaceData.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/Disposer.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/java2d/windows/WindowsFlags.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Unicode.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  44. $(OBJDIR)/gifdecoder.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
  45. -$(OBJDIR)/GraphicsPrimitiveMgr.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_GraphicsPrimitiveMgr.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  46. +$(OBJDIR)/GraphicsPrimitiveMgr.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_GraphicsPrimitiveMgr.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
  47. $(OBJDIR)/Hashtable.obj:: $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_MMStub.h ../../../src/windows/native/sun/windows/awt_Multimon.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  48. @@ -278,7 +278,7 @@
  49. $(OBJDIR)/IntRgbx.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/AnyInt.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/ByteIndexed.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntArgbBm.h ../../../src/share/native/sun/java2d/loops/IntArgbPre.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/IntRgb.h ../../../src/share/native/sun/java2d/loops/IntRgbx.h ../../../src/share/native/sun/java2d/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/LoopMacros.h ../../../src/share/native/sun/java2d/loops/ThreeByteBgr.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  50. -$(OBJDIR)/MaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  51. +$(OBJDIR)/MaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
  52. $(OBJDIR)/MaskFill.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskFill.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  53. @@ -290,7 +290,7 @@
  54. $(OBJDIR)/OGLBufImgOps.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLBufImgOps.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
  55. -$(OBJDIR)/OGLContext.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h $(CLASSHDRDIR)/sun_java2d_SunGraphics2D.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
  56. +$(OBJDIR)/OGLContext.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h $(CLASSHDRDIR)/sun_java2d_SunGraphics2D.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h ../../../src/windows/native/sun/awt/utility/rect.h
  57. $(OBJDIR)/OGLFuncs.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
  58. @@ -312,11 +312,11 @@
  59. $(OBJDIR)/ProcessPath.obj:: $(CLASSHDRDIR)/java_awt_geom_PathIterator.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/ProcessPath.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  60. -$(OBJDIR)/Region.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
  61. +$(OBJDIR)/Region.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/awt/utility/rect.h
  62. $(OBJDIR)/RenderBuffer.obj:: $(CLASSHDRDIR)/sun_java2d_pipe_RenderBuffer.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
  63. -$(OBJDIR)/ScaledBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_ScaledBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  64. +$(OBJDIR)/ScaledBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_ScaledBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
  65. $(OBJDIR)/ShapeSpanIterator.obj:: $(CLASSHDRDIR)/java_awt_geom_PathIterator.h $(CLASSHDRDIR)/sun_java2d_pipe_ShapeSpanIterator.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/PathConsumer2D.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  66. @@ -332,7 +332,7 @@
  67. $(OBJDIR)/Trace.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h
  68. -$(OBJDIR)/TransformHelper.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_loops_TransformHelper.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
  69. +$(OBJDIR)/TransformHelper.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_loops_TransformHelper.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
  70. $(OBJDIR)/UnicowsLoader.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/windows/UnicowsLoader.h
  71. diff -Nru openjdk.orig/jdk/make/sun/awt/Makefile openjdk/jdk/make/sun/awt/Makefile
  72. --- openjdk.orig/jdk/make/sun/awt/Makefile 2011-02-16 00:40:21.000000000 +0000
  73. +++ openjdk/jdk/make/sun/awt/Makefile 2011-02-16 01:27:24.996326861 +0000
  74. @@ -1,5 +1,5 @@
  75. #
  76. -# Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
  77. +# Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  78. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  79. #
  80. # This code is free software; you can redistribute it and/or modify it
  81. @@ -224,6 +224,7 @@
  82. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/shell
  83. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/medialib
  84. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/debug
  85. +vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/utility
  86. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d
  87. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/loops
  88. vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
  89. diff -Nru openjdk.orig/jdk/make/sun/awt/mapfile-mawt-vers openjdk/jdk/make/sun/awt/mapfile-mawt-vers
  90. --- openjdk.orig/jdk/make/sun/awt/mapfile-mawt-vers 2011-02-16 00:40:21.000000000 +0000
  91. +++ openjdk/jdk/make/sun/awt/mapfile-mawt-vers 2011-02-16 01:27:25.000326551 +0000
  92. @@ -291,6 +291,7 @@
  93. Java_sun_awt_X11GraphicsConfig_createBackBuffer;
  94. Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
  95. Java_sun_awt_X11GraphicsConfig_swapBuffers;
  96. + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
  97. Java_sun_awt_X11GraphicsDevice_isDBESupported;
  98. Java_sun_awt_X11GraphicsDevice_getDisplay;
  99. Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
  100. diff -Nru openjdk.orig/jdk/make/sun/awt/mapfile-vers-linux openjdk/jdk/make/sun/awt/mapfile-vers-linux
  101. --- openjdk.orig/jdk/make/sun/awt/mapfile-vers-linux 2011-02-16 00:40:21.000000000 +0000
  102. +++ openjdk/jdk/make/sun/awt/mapfile-vers-linux 2011-02-16 01:27:25.000326551 +0000
  103. @@ -406,6 +406,7 @@
  104. Java_sun_awt_X11GraphicsConfig_getNumColors;
  105. Java_sun_awt_X11GraphicsConfig_getXResolution;
  106. Java_sun_awt_X11GraphicsConfig_getYResolution;
  107. + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
  108. Java_sun_awt_X11GraphicsDevice_isDBESupported;
  109. Java_sun_awt_X11GraphicsDevice_getDisplay;
  110. Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
  111. diff -Nru openjdk.orig/jdk/make/sun/xawt/mapfile-vers openjdk/jdk/make/sun/xawt/mapfile-vers
  112. --- openjdk.orig/jdk/make/sun/xawt/mapfile-vers 2011-02-16 00:40:21.000000000 +0000
  113. +++ openjdk/jdk/make/sun/xawt/mapfile-vers 2011-02-16 01:27:25.000326551 +0000
  114. @@ -216,6 +216,7 @@
  115. Java_sun_awt_X11GraphicsConfig_createBackBuffer;
  116. Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
  117. Java_sun_awt_X11GraphicsConfig_swapBuffers;
  118. + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
  119. Java_java_awt_Insets_initIDs;
  120. Java_java_awt_KeyboardFocusManager_initIDs;
  121. Java_java_awt_Font_initIDs;
  122. diff -Nru openjdk.orig/jdk/src/share/classes/com/sun/awt/AWTUtilities.java openjdk/jdk/src/share/classes/com/sun/awt/AWTUtilities.java
  123. --- openjdk.orig/jdk/src/share/classes/com/sun/awt/AWTUtilities.java 2011-02-16 00:40:21.000000000 +0000
  124. +++ openjdk/jdk/src/share/classes/com/sun/awt/AWTUtilities.java 2011-02-16 01:27:25.000326551 +0000
  125. @@ -26,17 +26,37 @@
  126. package com.sun.awt;
  127. import java.awt.*;
  128. -import sun.awt.AWTAccessor;
  129. +import sun.awt.AWTAccessor;
  130. +import sun.awt.SunToolkit;
  131. /**
  132. * A collection of utility methods for AWT.
  133. *
  134. * The functionality provided by the static methods of the class includes:
  135. * <ul>
  136. + * <li>Setting shapes on top-level windows
  137. + * <li>Setting a constant alpha value for each pixel of a top-level window
  138. + * <li>Making a window non-opaque, after that it paints only explicitly
  139. + * painted pixels on the screen, with arbitrary alpha values for every pixel.
  140. * <li>Setting a 'mixing-cutout' shape for a component.
  141. * </ul>
  142. * <p>
  143. + * A "top-level window" is an instance of the {@code Window} class (or its
  144. + * descendant, such as {@code JFrame}).
  145. + * <p>
  146. + * Some of the mentioned features may not be supported by the native platform.
  147. + * To determine whether a particular feature is supported, the user must use
  148. + * the {@code isTranslucencySupported()} method of the class passing a desired
  149. + * translucency kind (a member of the {@code Translucency} enum) as an
  150. + * argument.
  151. + * <p>
  152. + * The per-pixel alpha feature also requires the user to create her/his
  153. + * windows using a translucency-capable graphics configuration.
  154. + * The {@code isTranslucencyCapable()} method must
  155. + * be used to verify whether any given GraphicsConfiguration supports
  156. + * the trasnlcency effects.
  157. + * <p>
  158. * <b>WARNING</b>: This class is an implementation detail and only meant
  159. * for limited use outside of the core platform. This API may change
  160. * drastically between update release, and it may even be
  161. @@ -50,6 +70,344 @@
  162. private AWTUtilities() {
  163. }
  164. + /** Kinds of translucency supported by the underlying system.
  165. + * @see #isTranslucencySupported
  166. + */
  167. + public static enum Translucency {
  168. + /**
  169. + * Represents support in the underlying system for windows each pixel
  170. + * of which is guaranteed to be either completely opaque, with
  171. + * an alpha value of 1.0, or completely transparent, with an alpha
  172. + * value of 0.0.
  173. + */
  174. + PERPIXEL_TRANSPARENT,
  175. +
  176. + /**
  177. + * Represents support in the underlying system for windows all of
  178. + * the pixels of which have the same alpha value between or including
  179. + * 0.0 and 1.0.
  180. + */
  181. + TRANSLUCENT,
  182. +
  183. + /**
  184. + * Represents support in the underlying system for windows that
  185. + * contain or might contain pixels with arbitrary alpha values
  186. + * between and including 0.0 and 1.0.
  187. + */
  188. + PERPIXEL_TRANSLUCENT;
  189. + }
  190. +
  191. +
  192. + /**
  193. + * Returns whether the given level of translucency is supported by
  194. + * the underlying system.
  195. + *
  196. + * Note that this method may sometimes return the value
  197. + * indicating that the particular level is supported, but
  198. + * the native windowing system may still not support the
  199. + * given level of translucency (due to the bugs in
  200. + * the windowing system).
  201. + *
  202. + * @param translucencyKind a kind of translucency support
  203. + * (either PERPIXEL_TRANSPARENT,
  204. + * TRANSLUCENT, or PERPIXEL_TRANSLUCENT)
  205. + * @return whether the given translucency kind is supported
  206. + */
  207. + public static boolean isTranslucencySupported(Translucency translucencyKind) {
  208. + switch (translucencyKind) {
  209. + case PERPIXEL_TRANSPARENT:
  210. + return isWindowShapingSupported();
  211. + case TRANSLUCENT:
  212. + return isWindowOpacitySupported();
  213. + case PERPIXEL_TRANSLUCENT:
  214. + return isWindowTranslucencySupported();
  215. + }
  216. + return false;
  217. + }
  218. +
  219. +
  220. + /**
  221. + * Returns whether the windowing system supports changing the opacity
  222. + * value of top-level windows.
  223. + * Note that this method may sometimes return true, but the native
  224. + * windowing system may still not support the concept of
  225. + * translucency (due to the bugs in the windowing system).
  226. + */
  227. + private static boolean isWindowOpacitySupported() {
  228. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  229. + if (!(curToolkit instanceof SunToolkit)) {
  230. + return false;
  231. + }
  232. + return ((SunToolkit)curToolkit).isWindowOpacitySupported();
  233. + }
  234. +
  235. + /**
  236. + * Set the opacity of the window. The opacity is at the range [0..1].
  237. + * Note that setting the opacity level of 0 may or may not disable
  238. + * the mouse event handling on this window. This is
  239. + * a platform-dependent behavior.
  240. + *
  241. + * In order for this method to enable the translucency effect,
  242. + * the isTranslucencySupported() method should indicate that the
  243. + * TRANSLUCENT level of translucency is supported.
  244. + *
  245. + * <p>Also note that the window must not be in the full-screen mode
  246. + * when setting the opacity value &lt; 1.0f. Otherwise
  247. + * the IllegalArgumentException is thrown.
  248. + *
  249. + * @param window the window to set the opacity level to
  250. + * @param opacity the opacity level to set to the window
  251. + * @throws NullPointerException if the window argument is null
  252. + * @throws IllegalArgumentException if the opacity is out of
  253. + * the range [0..1]
  254. + * @throws IllegalArgumentException if the window is in full screen mode,
  255. + * and the opacity is less than 1.0f
  256. + * @throws UnsupportedOperationException if the TRANSLUCENT translucency
  257. + * kind is not supported
  258. + */
  259. + public static void setWindowOpacity(Window window, float opacity) {
  260. + if (window == null) {
  261. + throw new NullPointerException(
  262. + "The window argument should not be null.");
  263. + }
  264. +
  265. + AWTAccessor.getWindowAccessor().setOpacity(window, opacity);
  266. + }
  267. +
  268. + /**
  269. + * Get the opacity of the window. If the opacity has not
  270. + * yet being set, this method returns 1.0.
  271. + *
  272. + * @param window the window to get the opacity level from
  273. + * @throws NullPointerException if the window argument is null
  274. + */
  275. + public static float getWindowOpacity(Window window) {
  276. + if (window == null) {
  277. + throw new NullPointerException(
  278. + "The window argument should not be null.");
  279. + }
  280. +
  281. + return AWTAccessor.getWindowAccessor().getOpacity(window);
  282. + }
  283. +
  284. + /**
  285. + * Returns whether the windowing system supports changing the shape
  286. + * of top-level windows.
  287. + * Note that this method may sometimes return true, but the native
  288. + * windowing system may still not support the concept of
  289. + * shaping (due to the bugs in the windowing system).
  290. + */
  291. + public static boolean isWindowShapingSupported() {
  292. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  293. + if (!(curToolkit instanceof SunToolkit)) {
  294. + return false;
  295. + }
  296. + return ((SunToolkit)curToolkit).isWindowShapingSupported();
  297. + }
  298. +
  299. + /**
  300. + * Returns an object that implements the Shape interface and represents
  301. + * the shape previously set with the call to the setWindowShape() method.
  302. + * If no shape has been set yet, or the shape has been reset to null,
  303. + * this method returns null.
  304. + *
  305. + * @param window the window to get the shape from
  306. + * @return the current shape of the window
  307. + * @throws NullPointerException if the window argument is null
  308. + */
  309. + public static Shape getWindowShape(Window window) {
  310. + if (window == null) {
  311. + throw new NullPointerException(
  312. + "The window argument should not be null.");
  313. + }
  314. + return AWTAccessor.getWindowAccessor().getShape(window);
  315. + }
  316. +
  317. + /**
  318. + * Sets a shape for the given window.
  319. + * If the shape argument is null, this methods restores
  320. + * the default shape making the window rectangular.
  321. + * <p>Note that in order to set a shape, the window must be undecorated.
  322. + * If the window is decorated, this method ignores the {@code shape}
  323. + * argument and resets the shape to null.
  324. + * <p>Also note that the window must not be in the full-screen mode
  325. + * when setting a non-null shape. Otherwise the IllegalArgumentException
  326. + * is thrown.
  327. + * <p>Depending on the platform, the method may return without
  328. + * effecting the shape of the window if the window has a non-null warning
  329. + * string ({@link Window#getWarningString()}). In this case the passed
  330. + * shape object is ignored.
  331. + *
  332. + * @param window the window to set the shape to
  333. + * @param shape the shape to set to the window
  334. + * @throws NullPointerException if the window argument is null
  335. + * @throws IllegalArgumentException if the window is in full screen mode,
  336. + * and the shape is not null
  337. + * @throws UnsupportedOperationException if the PERPIXEL_TRANSPARENT
  338. + * translucency kind is not supported
  339. + */
  340. + public static void setWindowShape(Window window, Shape shape) {
  341. + if (window == null) {
  342. + throw new NullPointerException(
  343. + "The window argument should not be null.");
  344. + }
  345. + AWTAccessor.getWindowAccessor().setShape(window, shape);
  346. + }
  347. +
  348. + private static boolean isWindowTranslucencySupported() {
  349. + /*
  350. + * Per-pixel alpha is supported if all the conditions are TRUE:
  351. + * 1. The toolkit is a sort of SunToolkit
  352. + * 2. The toolkit supports translucency in general
  353. + * (isWindowTranslucencySupported())
  354. + * 3. There's at least one translucency-capable
  355. + * GraphicsConfiguration
  356. + */
  357. +
  358. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  359. + if (!(curToolkit instanceof SunToolkit)) {
  360. + return false;
  361. + }
  362. +
  363. + if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
  364. + return false;
  365. + }
  366. +
  367. + GraphicsEnvironment env =
  368. + GraphicsEnvironment.getLocalGraphicsEnvironment();
  369. +
  370. + // If the default GC supports translucency return true.
  371. + // It is important to optimize the verification this way,
  372. + // see CR 6661196 for more details.
  373. + if (isTranslucencyCapable(env.getDefaultScreenDevice()
  374. + .getDefaultConfiguration()))
  375. + {
  376. + return true;
  377. + }
  378. +
  379. + // ... otherwise iterate through all the GCs.
  380. + GraphicsDevice[] devices = env.getScreenDevices();
  381. +
  382. + for (int i = 0; i < devices.length; i++) {
  383. + GraphicsConfiguration[] configs = devices[i].getConfigurations();
  384. + for (int j = 0; j < configs.length; j++) {
  385. + if (isTranslucencyCapable(configs[j])) {
  386. + return true;
  387. + }
  388. + }
  389. + }
  390. +
  391. + return false;
  392. + }
  393. +
  394. + /**
  395. + * Enables the per-pixel alpha support for the given window.
  396. + * Once the window becomes non-opaque (the isOpaque is set to false),
  397. + * the drawing sub-system is starting to respect the alpha value of each
  398. + * separate pixel. If a pixel gets painted with alpha color component
  399. + * equal to zero, it becomes visually transparent, if the alpha of the
  400. + * pixel is equal to 255, the pixel is fully opaque. Interim values
  401. + * of the alpha color component make the pixel semi-transparent (i.e.
  402. + * translucent).
  403. + * <p>Note that in order for the window to support the per-pixel alpha
  404. + * mode, the window must be created using the GraphicsConfiguration
  405. + * for which the {@link #isTranslucencyCapable}
  406. + * method returns true.
  407. + * <p>Also note that some native systems enable the per-pixel translucency
  408. + * mode for any window created using the translucency-compatible
  409. + * graphics configuration. However, it is highly recommended to always
  410. + * invoke the setWindowOpaque() method for these windows, at least for
  411. + * the sake of cross-platform compatibility reasons.
  412. + * <p>Also note that the window must not be in the full-screen mode
  413. + * when making it non-opaque. Otherwise the IllegalArgumentException
  414. + * is thrown.
  415. + * <p>If the window is a {@code Frame} or a {@code Dialog}, the window must
  416. + * be undecorated prior to enabling the per-pixel translucency effect (see
  417. + * {@link Frame#setUndecorated()} and/or {@link Dialog#setUndecorated()}).
  418. + * If the window becomes decorated through a subsequent call to the
  419. + * corresponding {@code setUndecorated()} method, the per-pixel
  420. + * translucency effect will be disabled and the opaque property reset to
  421. + * {@code true}.
  422. + * <p>Depending on the platform, the method may return without
  423. + * effecting the opaque property of the window if the window has a non-null
  424. + * warning string ({@link Window#getWarningString()}). In this case
  425. + * the passed 'isOpaque' value is ignored.
  426. + *
  427. + * @param window the window to set the shape to
  428. + * @param isOpaque whether the window must be opaque (true),
  429. + * or translucent (false)
  430. + * @throws NullPointerException if the window argument is null
  431. + * @throws IllegalArgumentException if the window uses
  432. + * a GraphicsConfiguration for which the
  433. + * {@code isTranslucencyCapable()}
  434. + * method returns false
  435. + * @throws IllegalArgumentException if the window is in full screen mode,
  436. + * and the isOpaque is false
  437. + * @throws IllegalArgumentException if the window is decorated and the
  438. + * isOpaque argument is {@code false}.
  439. + * @throws UnsupportedOperationException if the PERPIXEL_TRANSLUCENT
  440. + * translucency kind is not supported
  441. + */
  442. + public static void setWindowOpaque(Window window, boolean isOpaque) {
  443. + if (window == null) {
  444. + throw new NullPointerException(
  445. + "The window argument should not be null.");
  446. + }
  447. + if (!isOpaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) {
  448. + throw new UnsupportedOperationException(
  449. + "The PERPIXEL_TRANSLUCENT translucency kind is not supported");
  450. + }
  451. + AWTAccessor.getWindowAccessor().setOpaque(window, isOpaque);
  452. + }
  453. +
  454. + /**
  455. + * Returns whether the window is opaque or translucent.
  456. + *
  457. + * @param window the window to set the shape to
  458. + * @return whether the window is currently opaque (true)
  459. + * or translucent (false)
  460. + * @throws NullPointerException if the window argument is null
  461. + */
  462. + public static boolean isWindowOpaque(Window window) {
  463. + if (window == null) {
  464. + throw new NullPointerException(
  465. + "The window argument should not be null.");
  466. + }
  467. +
  468. + return AWTAccessor.getWindowAccessor().isOpaque(window);
  469. + }
  470. +
  471. + /**
  472. + * Verifies whether a given GraphicsConfiguration supports
  473. + * the PERPIXEL_TRANSLUCENT kind of translucency.
  474. + * All windows that are intended to be used with the {@link #setWindowOpaque}
  475. + * method must be created using a GraphicsConfiguration for which this method
  476. + * returns true.
  477. + * <p>Note that some native systems enable the per-pixel translucency
  478. + * mode for any window created using a translucency-capable
  479. + * graphics configuration. However, it is highly recommended to always
  480. + * invoke the setWindowOpaque() method for these windows, at least
  481. + * for the sake of cross-platform compatibility reasons.
  482. + *
  483. + * @param gc GraphicsConfiguration
  484. + * @throws NullPointerException if the gc argument is null
  485. + * @return whether the given GraphicsConfiguration supports
  486. + * the translucency effects.
  487. + */
  488. + public static boolean isTranslucencyCapable(GraphicsConfiguration gc) {
  489. + if (gc == null) {
  490. + throw new NullPointerException("The gc argument should not be null");
  491. + }
  492. + /*
  493. + return gc.isTranslucencyCapable();
  494. + */
  495. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  496. + if (!(curToolkit instanceof SunToolkit)) {
  497. + return false;
  498. + }
  499. + return ((SunToolkit)curToolkit).isTranslucencyCapable(gc);
  500. + }
  501. +
  502. /**
  503. * Sets a 'mixing-cutout' shape for the given component.
  504. *
  505. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/Component.java openjdk/jdk/src/share/classes/java/awt/Component.java
  506. --- openjdk.orig/jdk/src/share/classes/java/awt/Component.java 2011-02-16 00:40:21.000000000 +0000
  507. +++ openjdk/jdk/src/share/classes/java/awt/Component.java 2011-02-16 02:00:18.147235768 +0000
  508. @@ -1,5 +1,5 @@
  509. /*
  510. - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
  511. + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  512. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  513. *
  514. * This code is free software; you can redistribute it and/or modify it
  515. @@ -806,18 +806,27 @@
  516. }
  517. }
  518. - static {
  519. - AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
  520. - public AccessControlContext getAccessControlContext(Component comp) {
  521. - return comp.getAccessControlContext();
  522. - }
  523. -
  524. - });
  525. - }
  526. -
  527. + // Whether this Component has had the background erase flag
  528. + // specified via SunToolkit.disableBackgroundErase(). This is
  529. + // needed in order to make this function work on X11 platforms,
  530. + // where currently there is no chance to interpose on the creation
  531. + // of the peer and therefore the call to XSetBackground.
  532. + transient boolean backgroundEraseDisabled;
  533. static {
  534. AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
  535. + public AccessControlContext getAccessControlContext(Component comp) {
  536. + return comp.getAccessControlContext();
  537. + }
  538. + public void setBackgroundEraseDisabled(Component comp, boolean disabled) {
  539. + comp.backgroundEraseDisabled = disabled;
  540. + }
  541. + public boolean getBackgroundEraseDisabled(Component comp) {
  542. + return comp.backgroundEraseDisabled;
  543. + }
  544. + public Rectangle getBounds(Component comp) {
  545. + return new Rectangle(comp.x, comp.y, comp.width, comp.height);
  546. + }
  547. public void setMixingCutoutShape(Component comp, Shape shape) {
  548. Region region = shape == null ? null :
  549. Region.getInstance(shape, null);
  550. @@ -7454,7 +7463,7 @@
  551. // sometimes most recent focus owner may be null, but focus owner is not
  552. // e.g. we reset most recent focus owner if user removes focus owner
  553. focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
  554. - if (focusOwner != null && getContainingWindow(focusOwner) != window) {
  555. + if (focusOwner != null && focusOwner.getContainingWindow() != window) {
  556. focusOwner = null;
  557. }
  558. }
  559. @@ -8685,30 +8694,8 @@
  560. * null, if component is not a part of window hierarchy
  561. */
  562. Window getContainingWindow() {
  563. - return getContainingWindow(this);
  564. + return SunToolkit.getContainingWindow(this);
  565. }
  566. - /**
  567. - * Returns the <code>Window</code> ancestor of the component <code>comp</code>.
  568. - * @return Window ancestor of the component or component by itself if it is Window;
  569. - * null, if component is not a part of window hierarchy
  570. - */
  571. - static Window getContainingWindow(Component comp) {
  572. - while (comp != null && !(comp instanceof Window)) {
  573. - comp = comp.getParent();
  574. - }
  575. -
  576. - return (Window)comp;
  577. - }
  578. -
  579. -
  580. -
  581. -
  582. -
  583. -
  584. -
  585. -
  586. -
  587. -
  588. /**
  589. * Initialize JNI field and method IDs
  590. @@ -9823,4 +9810,29 @@
  591. }
  592. // ****************** END OF MIXING CODE ********************************
  593. +
  594. + private static boolean doesClassImplement(Class cls, String interfaceName) {
  595. + if (cls == null) return false;
  596. +
  597. + for (Class c : cls.getInterfaces()) {
  598. + if (c.getName().equals(interfaceName)) {
  599. + return true;
  600. + }
  601. + }
  602. + return doesClassImplement(cls.getSuperclass(), interfaceName);
  603. + }
  604. +
  605. + /**
  606. + * Checks that the given object implements the given interface.
  607. + * @param obj Object to be checked
  608. + * @param interfaceName The name of the interface. Must be fully-qualified interface name.
  609. + * @return true, if this object implements the given interface,
  610. + * false, otherwise, or if obj or interfaceName is null
  611. + */
  612. + static boolean doesImplement(Object obj, String interfaceName) {
  613. + if (obj == null) return false;
  614. + if (interfaceName == null) return false;
  615. +
  616. + return doesClassImplement(obj.getClass(), interfaceName);
  617. + }
  618. }
  619. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/Container.java openjdk/jdk/src/share/classes/java/awt/Container.java
  620. --- openjdk.orig/jdk/src/share/classes/java/awt/Container.java 2011-02-16 00:40:21.000000000 +0000
  621. +++ openjdk/jdk/src/share/classes/java/awt/Container.java 2011-02-16 01:27:25.004326241 +0000
  622. @@ -1,5 +1,5 @@
  623. /*
  624. - * Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
  625. + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  626. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  627. *
  628. * This code is free software; you can redistribute it and/or modify it
  629. @@ -167,6 +167,9 @@
  630. transient int listeningBoundsChildren;
  631. transient int descendantsCount;
  632. + /* Non-opaque window support -- see Window.setLayersOpaque */
  633. + transient Color preserveBackgroundColor = null;
  634. +
  635. /**
  636. * JDK 1.1 serialVersionUID
  637. */
  638. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java openjdk/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
  639. --- openjdk.orig/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2011-02-16 00:40:21.000000000 +0000
  640. +++ openjdk/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2011-02-16 01:27:25.004326241 +0000
  641. @@ -480,7 +480,7 @@
  642. // that a Component outside of the focused Window receives a
  643. // FOCUS_GAINED event. We synthesize a WINDOW_GAINED_FOCUS
  644. // event in that case.
  645. - final Window newFocusedWindow = Component.getContainingWindow(newFocusOwner);
  646. + final Window newFocusedWindow = SunToolkit.getContainingWindow(newFocusOwner);
  647. final Window currentFocusedWindow = getGlobalFocusedWindow();
  648. if (newFocusedWindow != null &&
  649. newFocusedWindow != currentFocusedWindow)
  650. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/GraphicsConfiguration.java openjdk/jdk/src/share/classes/java/awt/GraphicsConfiguration.java
  651. --- openjdk.orig/jdk/src/share/classes/java/awt/GraphicsConfiguration.java 2011-01-20 23:54:13.000000000 +0000
  652. +++ openjdk/jdk/src/share/classes/java/awt/GraphicsConfiguration.java 2011-02-16 01:27:25.004326241 +0000
  653. @@ -1,5 +1,5 @@
  654. /*
  655. - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
  656. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  657. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  658. *
  659. * This code is free software; you can redistribute it and/or modify it
  660. @@ -428,4 +428,20 @@
  661. }
  662. return defaultImageCaps;
  663. }
  664. +
  665. + /**
  666. + * Returns whether this GraphicsConfiguration supports
  667. + * the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
  668. + * PERPIXEL_TRANSLUCENT} kind of translucency.
  669. + *
  670. + * @param gc GraphicsConfiguration
  671. + * @throws NullPointerException if the gc argument is null
  672. + * @return whether the given GraphicsConfiguration supports
  673. + * the translucency effects.
  674. + * @see Window#setBackground(Color)
  675. + */
  676. + /*public */boolean isTranslucencyCapable() {
  677. + // Overridden in subclasses
  678. + return false;
  679. }
  680. +}
  681. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/GraphicsDevice.java openjdk/jdk/src/share/classes/java/awt/GraphicsDevice.java
  682. --- openjdk.orig/jdk/src/share/classes/java/awt/GraphicsDevice.java 2011-02-16 00:40:21.000000000 +0000
  683. +++ openjdk/jdk/src/share/classes/java/awt/GraphicsDevice.java 2011-02-16 01:27:25.004326241 +0000
  684. @@ -1,5 +1,5 @@
  685. /*
  686. - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  687. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  688. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  689. *
  690. * This code is free software; you can redistribute it and/or modify it
  691. @@ -27,7 +27,10 @@
  692. package java.awt;
  693. import java.awt.image.ColorModel;
  694. +
  695. +import sun.awt.AWTAccessor;
  696. import sun.awt.AppContext;
  697. +import sun.awt.SunToolkit;
  698. /**
  699. * The <code>GraphicsDevice</code> class describes the graphics devices
  700. @@ -109,6 +112,31 @@
  701. */
  702. public final static int TYPE_IMAGE_BUFFER = 2;
  703. + /** Kinds of translucency supported by the underlying system.
  704. + * @see #isTranslucencySupported
  705. + */
  706. + /*public */static enum WindowTranslucency {
  707. + /**
  708. + * Represents support in the underlying system for windows each pixel
  709. + * of which is guaranteed to be either completely opaque, with
  710. + * an alpha value of 1.0, or completely transparent, with an alpha
  711. + * value of 0.0.
  712. + */
  713. + PERPIXEL_TRANSPARENT,
  714. + /**
  715. + * Represents support in the underlying system for windows all of
  716. + * the pixels of which have the same alpha value between or including
  717. + * 0.0 and 1.0.
  718. + */
  719. + TRANSLUCENT,
  720. + /**
  721. + * Represents support in the underlying system for windows that
  722. + * contain or might contain pixels with arbitrary alpha values
  723. + * between and including 0.0 and 1.0.
  724. + */
  725. + PERPIXEL_TRANSLUCENT;
  726. + }
  727. +
  728. /**
  729. * Returns the type of this <code>GraphicsDevice</code>.
  730. * @return the type of this <code>GraphicsDevice</code>, which can
  731. @@ -235,6 +263,21 @@
  732. * @since 1.4
  733. */
  734. public void setFullScreenWindow(Window w) {
  735. + if (w != null) {
  736. + //XXX: The actions should be documented in some non-update release.
  737. + /*
  738. + if (w.getShape() != null) {
  739. + w.setShape(w, null);
  740. + }
  741. + if (!w.isOpaque()) {
  742. + w.setOpaque(false);
  743. + }
  744. + if (w.getOpacity() < 1.0f) {
  745. + w.setOpacity(1.0f);
  746. + }
  747. + */
  748. + }
  749. +
  750. if (fullScreenWindow != null && windowedModeBounds != null) {
  751. // if the window went into fs mode before it was realized it may
  752. // have (0,0) dimensions
  753. @@ -424,4 +467,94 @@
  754. public int getAvailableAcceleratedMemory() {
  755. return -1;
  756. }
  757. +
  758. + /**
  759. + * Returns whether the given level of translucency is supported
  760. + * this graphics device.
  761. + *
  762. + * @param translucencyKind a kind of translucency support
  763. + * @return whether the given translucency kind is supported
  764. + */
  765. + /*public */boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
  766. + switch (translucencyKind) {
  767. + case PERPIXEL_TRANSPARENT:
  768. + return isWindowShapingSupported();
  769. + case TRANSLUCENT:
  770. + return isWindowOpacitySupported();
  771. + case PERPIXEL_TRANSLUCENT:
  772. + return isWindowPerpixelTranslucencySupported();
  773. + }
  774. + return false;
  775. + }
  776. +
  777. + /**
  778. + * Returns whether the windowing system supports changing the shape
  779. + * of top-level windows.
  780. + * Note that this method may sometimes return true, but the native
  781. + * windowing system may still not support the concept of
  782. + * shaping (due to the bugs in the windowing system).
  783. + */
  784. + static boolean isWindowShapingSupported() {
  785. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  786. + if (!(curToolkit instanceof SunToolkit)) {
  787. + return false;
  788. + }
  789. + return ((SunToolkit)curToolkit).isWindowShapingSupported();
  790. + }
  791. +
  792. + /**
  793. + * Returns whether the windowing system supports changing the opacity
  794. + * value of top-level windows.
  795. + * Note that this method may sometimes return true, but the native
  796. + * windowing system may still not support the concept of
  797. + * translucency (due to the bugs in the windowing system).
  798. + */
  799. + static boolean isWindowOpacitySupported() {
  800. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  801. + if (!(curToolkit instanceof SunToolkit)) {
  802. + return false;
  803. + }
  804. + return ((SunToolkit)curToolkit).isWindowOpacitySupported();
  805. + }
  806. +
  807. + boolean isWindowPerpixelTranslucencySupported() {
  808. + /*
  809. + * Per-pixel alpha is supported if all the conditions are TRUE:
  810. + * 1. The toolkit is a sort of SunToolkit
  811. + * 2. The toolkit supports translucency in general
  812. + * (isWindowTranslucencySupported())
  813. + * 3. There's at least one translucency-capable
  814. + * GraphicsConfiguration
  815. + */
  816. + Toolkit curToolkit = Toolkit.getDefaultToolkit();
  817. + if (!(curToolkit instanceof SunToolkit)) {
  818. + return false;
  819. + }
  820. + if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
  821. + return false;
  822. + }
  823. +
  824. + // TODO: cache translucency capable GC
  825. + return getTranslucencyCapableGC() != null;
  826. + }
  827. +
  828. + GraphicsConfiguration getTranslucencyCapableGC() {
  829. + // If the default GC supports translucency return true.
  830. + // It is important to optimize the verification this way,
  831. + // see CR 6661196 for more details.
  832. + GraphicsConfiguration defaultGC = getDefaultConfiguration();
  833. + if (defaultGC.isTranslucencyCapable()) {
  834. + return defaultGC;
  835. + }
  836. +
  837. + // ... otherwise iterate through all the GCs.
  838. + GraphicsConfiguration[] configs = getConfigurations();
  839. + for (int j = 0; j < configs.length; j++) {
  840. + if (configs[j].isTranslucencyCapable()) {
  841. + return configs[j];
  842. + }
  843. + }
  844. +
  845. + return null;
  846. + }
  847. }
  848. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/KeyboardFocusManager.java openjdk/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
  849. --- openjdk.orig/jdk/src/share/classes/java/awt/KeyboardFocusManager.java 2011-02-16 00:40:21.000000000 +0000
  850. +++ openjdk/jdk/src/share/classes/java/awt/KeyboardFocusManager.java 2011-02-16 01:27:25.004326241 +0000
  851. @@ -2210,7 +2210,7 @@
  852. boolean temporary, boolean focusedWindowChangeAllowed,
  853. long time)
  854. {
  855. - Window parentWindow = Component.getContainingWindow(heavyweight);
  856. + Window parentWindow = SunToolkit.getContainingWindow(heavyweight);
  857. if (parentWindow == null || !parentWindow.syncLWRequests) {
  858. return false;
  859. }
  860. @@ -2544,7 +2544,7 @@
  861. (HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER);
  862. Component activeWindow = ((hwFocusRequest != null)
  863. - ? Component.getContainingWindow(hwFocusRequest.heavyweight)
  864. + ? SunToolkit.getContainingWindow(hwFocusRequest.heavyweight)
  865. : nativeFocusedWindow);
  866. while (activeWindow != null &&
  867. !((activeWindow instanceof Frame) ||
  868. @@ -3015,8 +3015,8 @@
  869. }
  870. private static boolean focusedWindowChanged(Component to, Component from) {
  871. - Window wto = Component.getContainingWindow(to);
  872. - Window wfrom = Component.getContainingWindow(from);
  873. + Window wto = SunToolkit.getContainingWindow(to);
  874. + Window wfrom = SunToolkit.getContainingWindow(from);
  875. if (wto == null && wfrom == null) {
  876. return true;
  877. }
  878. @@ -3030,8 +3030,8 @@
  879. }
  880. private static boolean isTemporary(Component to, Component from) {
  881. - Window wto = Component.getContainingWindow(to);
  882. - Window wfrom = Component.getContainingWindow(from);
  883. + Window wto = SunToolkit.getContainingWindow(to);
  884. + Window wfrom = SunToolkit.getContainingWindow(from);
  885. if (wto == null && wfrom == null) {
  886. return false;
  887. }
  888. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/peer/WindowPeer.java openjdk/jdk/src/share/classes/java/awt/peer/WindowPeer.java
  889. --- openjdk.orig/jdk/src/share/classes/java/awt/peer/WindowPeer.java 2011-01-20 23:54:15.000000000 +0000
  890. +++ openjdk/jdk/src/share/classes/java/awt/peer/WindowPeer.java 2011-02-16 01:27:25.004326241 +0000
  891. @@ -1,5 +1,5 @@
  892. /*
  893. - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
  894. + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  895. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  896. *
  897. * This code is free software; you can redistribute it and/or modify it
  898. @@ -27,6 +27,8 @@
  899. import java.awt.*;
  900. +import java.awt.image.BufferedImage;
  901. +
  902. /**
  903. * The peer interfaces are intended only for use in porting
  904. * the AWT. They are not intended for use by application
  905. @@ -43,4 +45,26 @@
  906. void setModalBlocked(Dialog blocker, boolean blocked);
  907. void updateMinimumSize();
  908. void updateIconImages();
  909. +
  910. + /**
  911. + * Sets the level of opacity for the window.
  912. + *
  913. + * @see Window#setOpacity(float)
  914. + */
  915. + void setOpacity(float opacity);
  916. +
  917. + /**
  918. + * Enables the per-pixel alpha support for the window.
  919. + *
  920. + * @see Window#setBackground(Color)
  921. + */
  922. + void setOpaque(boolean isOpaque);
  923. +
  924. + /**
  925. + * Updates the native part of non-opaque window using
  926. + * the given image with color+alpha values for each pixel.
  927. + *
  928. + * @see Window#setBackground(Color)
  929. + */
  930. + void updateWindow(BufferedImage backBuffer);
  931. }
  932. diff -Nru openjdk.orig/jdk/src/share/classes/java/awt/Window.java openjdk/jdk/src/share/classes/java/awt/Window.java
  933. --- openjdk.orig/jdk/src/share/classes/java/awt/Window.java 2011-01-20 23:54:14.000000000 +0000
  934. +++ openjdk/jdk/src/share/classes/java/awt/Window.java 2011-02-16 01:27:25.004326241 +0000
  935. @@ -1,5 +1,5 @@
  936. /*
  937. - * Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
  938. + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  939. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  940. *
  941. * This code is free software; you can redistribute it and/or modify it
  942. @@ -28,6 +28,7 @@
  943. import java.awt.event.*;
  944. import java.awt.im.InputContext;
  945. import java.awt.image.BufferStrategy;
  946. +import java.awt.image.BufferedImage;
  947. import java.awt.peer.ComponentPeer;
  948. import java.awt.peer.WindowPeer;
  949. import java.beans.PropertyChangeListener;
  950. @@ -50,6 +51,7 @@
  951. import java.util.logging.Logger;
  952. import java.util.concurrent.atomic.AtomicBoolean;
  953. import javax.accessibility.*;
  954. +import sun.awt.AWTAccessor;
  955. import sun.awt.AppContext;
  956. import sun.awt.CausedFocusEvent;
  957. import sun.awt.SunToolkit;
  958. @@ -291,6 +293,25 @@
  959. */
  960. transient boolean isInShow = false;
  961. + /*
  962. + * Opacity level of the window
  963. + *
  964. + * @see #setOpacity(float)
  965. + * @see #getOpacity()
  966. + * @since 1.7
  967. + */
  968. + private float opacity = 1.0f;
  969. +
  970. + /*
  971. + * The shape assigned to this window. This field is set to null if
  972. + * no shape is set (rectangular window).
  973. + *
  974. + * @see #getShape()
  975. + * @see #setShape(Shape)
  976. + * @since 1.7
  977. + */
  978. + private Shape shape = null;
  979. +
  980. private static final String base = "win";
  981. private static int nameCounter = 0;
  982. @@ -661,9 +682,9 @@
  983. }
  984. if (peer == null) {
  985. peer = getToolkit().createWindow(this);
  986. - }
  987. - synchronized (allWindows) {
  988. - allWindows.add(this);
  989. + synchronized (allWindows) {
  990. + allWindows.add(this);
  991. + }
  992. }
  993. super.addNotify();
  994. }
  995. @@ -2765,6 +2786,8 @@
  996. if(aot) {
  997. setAlwaysOnTop(aot); // since 1.5; subject to permission check
  998. }
  999. + shape = (Shape)f.get("shape", null);
  1000. + opacity = (Float)f.get("opacity", 1.0f);
  1001. deserializeResources(s);
  1002. }
  1003. @@ -3184,6 +3207,225 @@
  1004. }
  1005. + // ******************** SHAPES & TRANSPARENCY CODE ********************
  1006. +
  1007. + /**
  1008. + * JavaDoc
  1009. + */
  1010. + /*public */float getOpacity() {
  1011. + synchronized (getTreeLock()) {
  1012. + return opacity;
  1013. + }
  1014. + }
  1015. +
  1016. + /**
  1017. + * JavaDoc
  1018. + */
  1019. + /*public */void setOpacity(float opacity) {
  1020. + synchronized (getTreeLock()) {
  1021. + if (opacity < 0.0f || opacity > 1.0f) {
  1022. + throw new IllegalArgumentException(
  1023. + "The value of opacity should be in the range [0.0f .. 1.0f].");
  1024. + }
  1025. + GraphicsConfiguration gc = getGraphicsConfiguration();
  1026. + GraphicsDevice gd = gc.getDevice();
  1027. + if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
  1028. + throw new UnsupportedOperationException(
  1029. + "TRANSLUCENT translucency is not supported.");
  1030. + }
  1031. + if ((gc.getDevice().getFullScreenWindow() == this) && (opacity < 1.0f)) {
  1032. + throw new IllegalArgumentException(
  1033. + "Setting opacity for full-screen window is not supported.");
  1034. + }
  1035. + this.opacity = opacity;
  1036. + WindowPeer peer = (WindowPeer)getPeer();
  1037. + if (peer != null) {
  1038. + peer.setOpacity(opacity);
  1039. + }
  1040. + }
  1041. + }
  1042. +
  1043. + /**
  1044. + * JavaDoc
  1045. + */
  1046. + /*public */Shape getShape() {
  1047. + synchronized (getTreeLock()) {
  1048. + return shape;
  1049. + }
  1050. + }
  1051. +
  1052. + /**
  1053. + * JavaDoc
  1054. + *
  1055. + * @param window the window to set the shape to
  1056. + * @param shape the shape to set to the window
  1057. + * @throws IllegalArgumentException if the window is in full screen mode,
  1058. + * and the shape is not null
  1059. + */
  1060. + /*public */void setShape(Shape shape) {
  1061. + synchronized (getTreeLock()) {
  1062. + GraphicsConfiguration gc = getGraphicsConfiguration();
  1063. + GraphicsDevice gd = gc.getDevice();
  1064. + if (!gd.isWindowTranslucencySupported(
  1065. + GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
  1066. + {
  1067. + throw new UnsupportedOperationException(
  1068. + "PERPIXEL_TRANSPARENT translucency is not supported.");
  1069. + }
  1070. + if ((gc.getDevice().getFullScreenWindow() == this) && (shape != null)) {
  1071. + throw new IllegalArgumentException(
  1072. + "Setting shape for full-screen window is not supported.");
  1073. + }
  1074. + this.shape = shape;
  1075. + WindowPeer peer = (WindowPeer)getPeer();
  1076. + if (peer != null) {
  1077. + peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
  1078. + }
  1079. + }
  1080. + }
  1081. +
  1082. + /**
  1083. + * JavaDoc
  1084. + */
  1085. +/*
  1086. + @Override
  1087. + public void setBackground(Color bgColor) {
  1088. + int alpha = bgColor.getAlpha();
  1089. + if (alpha < 255) { // non-opaque window
  1090. + GraphicsConfiguration gc = getGraphicsConfiguration();
  1091. + GraphicsDevice gd = gc.getDevice();
  1092. + if (gc.getDevice().getFullScreenWindow() == this) {
  1093. + throw new IllegalArgumentException(
  1094. + "Making full-screen window non opaque is not supported.");
  1095. + }
  1096. + if (!gc.isTranslucencyCapable()) {
  1097. + GraphicsConfiguration capableGC = gd.getTranslucencyCapableGC();
  1098. + if (capableGC == null) {
  1099. + throw new IllegalArgumentException(
  1100. + "PERPIXEL_TRANSLUCENT translucency is not supported");
  1101. + }
  1102. + // TODO: change GC
  1103. + }
  1104. + setLayersOpaque(this, false);
  1105. + }
  1106. +
  1107. + super.setBackground(bgColor);
  1108. +
  1109. + WindowPeer peer = (WindowPeer)getPeer();
  1110. + if (peer != null) {
  1111. + peer.setOpaque(alpha == 255);
  1112. + }
  1113. + }
  1114. +*/
  1115. +
  1116. + private transient boolean opaque = true;
  1117. +
  1118. + void setOpaque(boolean opaque) {
  1119. + synchronized (getTreeLock()) {
  1120. + GraphicsConfiguration gc = getGraphicsConfiguration();
  1121. + if (!opaque && !com.sun.awt.AWTUtilities.isTranslucencyCapable(gc)) {
  1122. + throw new IllegalArgumentException(
  1123. + "The window must use a translucency-compatible graphics configuration");
  1124. + }
  1125. + if (!com.sun.awt.AWTUtilities.isTranslucencySupported(
  1126. + com.sun.awt.AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT))
  1127. + {
  1128. + throw new UnsupportedOperationException(
  1129. + "PERPIXEL_TRANSLUCENT translucency is not supported.");
  1130. + }
  1131. + if ((gc.getDevice().getFullScreenWindow() == this) && !opaque) {
  1132. + throw new IllegalArgumentException(
  1133. + "Making full-screen window non opaque is not supported.");
  1134. + }
  1135. + setLayersOpaque(this, opaque);
  1136. + this.opaque = opaque;
  1137. + WindowPeer peer = (WindowPeer)getPeer();
  1138. + if (peer != null) {
  1139. + peer.setOpaque(opaque);
  1140. + }
  1141. + }
  1142. + }
  1143. +
  1144. + private void updateWindow(BufferedImage backBuffer) {
  1145. + synchronized (getTreeLock()) {
  1146. + WindowPeer peer = (WindowPeer)getPeer();
  1147. + if (peer != null) {
  1148. + peer.updateWindow(backBuffer);
  1149. + }
  1150. + }
  1151. + }
  1152. +
  1153. + private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
  1154. +
  1155. + private static void setLayersOpaque(Component component, boolean isOpaque) {
  1156. + // Shouldn't use instanceof to avoid loading Swing classes
  1157. + // if it's a pure AWT application.
  1158. + if (Component.doesImplement(component, "javax.swing.RootPaneContainer")) {
  1159. + javax.swing.RootPaneContainer rpc = (javax.swing.RootPaneContainer)component;
  1160. + javax.swing.JRootPane root = rpc.getRootPane();
  1161. + javax.swing.JLayeredPane lp = root.getLayeredPane();
  1162. + Container c = root.getContentPane();
  1163. + javax.swing.JComponent content =
  1164. + (c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
  1165. + javax.swing.JComponent gp =
  1166. + (rpc.getGlassPane() instanceof javax.swing.JComponent) ?
  1167. + (javax.swing.JComponent)rpc.getGlassPane() : null;
  1168. + if (gp != null) {
  1169. + gp.setDoubleBuffered(isOpaque);
  1170. + }
  1171. + lp.setOpaque(isOpaque);
  1172. + root.setOpaque(isOpaque);
  1173. + root.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
  1174. + if (content != null) {
  1175. + content.setOpaque(isOpaque);
  1176. + content.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
  1177. +
  1178. + // Iterate down one level to see whether we have a JApplet
  1179. + // (which is also a RootPaneContainer) which requires processing
  1180. + int numChildren = content.getComponentCount();
  1181. + if (numChildren > 0) {
  1182. + Component child = content.getComponent(0);
  1183. + // It's OK to use instanceof here because we've
  1184. + // already loaded the RootPaneContainer class by now
  1185. + if (child instanceof javax.swing.RootPaneContainer) {
  1186. + setLayersOpaque(child, isOpaque);
  1187. + }
  1188. + }
  1189. + }
  1190. + }
  1191. +
  1192. + Color bg = component.getBackground();
  1193. + boolean hasTransparentBg = TRANSPARENT_BACKGROUND_COLOR.equals(bg);
  1194. +
  1195. + Container container = null;
  1196. + if (component instanceof Container) {
  1197. + container = (Container) component;
  1198. + }
  1199. +
  1200. + if (isOpaque) {
  1201. + if (hasTransparentBg) {
  1202. + // Note: we use the SystemColor.window color as the default.
  1203. + // This color is used in the WindowPeer implementations to
  1204. + // initialize the background color of the window if it is null.
  1205. + // (This might not be the right thing to do for other
  1206. + // RootPaneContainers we might be invoked with)
  1207. + Color newColor = null;
  1208. + if (container != null && container.preserveBackgroundColor != null) {
  1209. + newColor = container.preserveBackgroundColor;
  1210. + } else {
  1211. + newColor = SystemColor.window;
  1212. + }
  1213. + component.setBackground(newColor);
  1214. + }
  1215. + } else {
  1216. + if (!hasTransparentBg && container != null) {
  1217. + container.preserveBackgroundColor = bg;
  1218. + }
  1219. + component.setBackground(TRANSPARENT_BACKGROUND_COLOR);
  1220. + }
  1221. + }
  1222. +
  1223. +
  1224. // ************************** MIXING CODE *******************************
  1225. // A window has a parent, but it does NOT have a container
  1226. @@ -3221,6 +3463,42 @@
  1227. // ****************** END OF MIXING CODE ********************************
  1228. + static {
  1229. + AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
  1230. + public float getOpacity(Window window) {
  1231. + return window.opacity;
  1232. + }
  1233. + public void setOpacity(Window window, float opacity) {
  1234. + window.setOpacity(opacity);
  1235. + }
  1236. + public Shape getShape(Window window) {
  1237. + return window.getShape();
  1238. + }
  1239. + public void setShape(Window window, Shape shape) {
  1240. + window.setShape(shape);
  1241. + }
  1242. + public boolean isOpaque(Window window) {
  1243. + /*
  1244. + return window.getBackground().getAlpha() < 255;
  1245. + */
  1246. + synchronized (window.getTreeLock()) {
  1247. + return window.opaque;
  1248. + }
  1249. + }
  1250. + public void setOpaque(Window window, boolean opaque) {
  1251. + /*
  1252. + Color bg = window.getBackground();
  1253. + window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
  1254. + opaque ? 255 : 0));
  1255. + */
  1256. + window.setOpaque(opaque);
  1257. + }
  1258. + public void updateWindow(Window window, BufferedImage backBuffer) {
  1259. + window.updateWindow(backBuffer);
  1260. + }
  1261. + }); // WindowAccessor
  1262. + } // static
  1263. +
  1264. } // class Window
  1265. diff -Nru openjdk.orig/jdk/src/share/classes/javax/swing/RepaintManager.java openjdk/jdk/src/share/classes/javax/swing/RepaintManager.java
  1266. --- openjdk.orig/jdk/src/share/classes/javax/swing/RepaintManager.java 2011-01-20 23:54:21.000000000 +0000
  1267. +++ openjdk/jdk/src/share/classes/javax/swing/RepaintManager.java 2011-02-16 01:27:25.008325931 +0000
  1268. @@ -1,5 +1,5 @@
  1269. /*
  1270. - * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
  1271. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  1272. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1273. *
  1274. * This code is free software; you can redistribute it and/or modify it
  1275. @@ -34,6 +34,7 @@
  1276. import java.util.*;
  1277. import java.applet.*;
  1278. +import sun.awt.AWTAccessor;
  1279. import sun.awt.AppContext;
  1280. import sun.awt.DisplayChangedListener;
  1281. import sun.awt.SunToolkit;
  1282. @@ -681,6 +682,44 @@
  1283. }
  1284. }
  1285. + private Map<Component,Rectangle>
  1286. + updateWindows(Map<Component,Rectangle> dirtyComponents)
  1287. + {
  1288. + Toolkit toolkit = Toolkit.getDefaultToolkit();
  1289. + if (!(toolkit instanceof SunToolkit &&
  1290. + ((SunToolkit)toolkit).needUpdateWindow()))
  1291. + {
  1292. + return dirtyComponents;
  1293. + }
  1294. +
  1295. + Set<Window> windows = new HashSet<Window>();
  1296. + Set<Component> dirtyComps = dirtyComponents.keySet();
  1297. + for (Iterator<Component> it = dirtyComps.iterator(); it.hasNext();) {
  1298. + Component dirty = it.next();
  1299. + Window window = dirty instanceof Window ?
  1300. + (Window)dirty :
  1301. + SwingUtilities.getWindowAncestor(dirty);
  1302. +
  1303. + if (window != null &&
  1304. + !AWTAccessor.getWindowAccessor().isOpaque(window))
  1305. + {
  1306. + // if this component's toplevel is perpixel translucent, it will
  1307. + // be repainted below
  1308. + it.remove();
  1309. + // add to the set of windows to update (so that we don't update
  1310. + // the window many times for each component to be repainted that
  1311. + // belongs to this window)
  1312. + windows.add(window);
  1313. + }
  1314. + }
  1315. +
  1316. + for (Window window : windows) {
  1317. + AWTAccessor.getWindowAccessor().updateWindow(window, null);
  1318. + }
  1319. +
  1320. + return dirtyComponents;
  1321. + }
  1322. +
  1323. /**
  1324. * Paint all of the components that have been marked dirty.
  1325. *
  1326. @@ -714,6 +753,10 @@
  1327. int localBoundsW = 0;
  1328. Enumeration keys;
  1329. + // the components belonging to perpixel-translucent windows will be
  1330. + // removed from the list
  1331. + tmpDirtyComponents = updateWindows(tmpDirtyComponents);
  1332. +
  1333. roots = new ArrayList<Component>(count);
  1334. for (Component dirty : tmpDirtyComponents.keySet()) {
  1335. diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/AWTAccessor.java openjdk/jdk/src/share/classes/sun/awt/AWTAccessor.java
  1336. --- openjdk.orig/jdk/src/share/classes/sun/awt/AWTAccessor.java 2011-02-16 00:40:21.000000000 +0000
  1337. +++ openjdk/jdk/src/share/classes/sun/awt/AWTAccessor.java 2011-02-16 01:43:59.459209438 +0000
  1338. @@ -59,10 +59,29 @@
  1339. * An interface of accessor for the java.awt.Component class.
  1340. */
  1341. public interface ComponentAccessor {
  1342. - // See 6797587
  1343. - // Also see: 6776743, 6768307, and 6768332.
  1344. - /**
  1345. + /*
  1346. + * Sets whether the native background erase for a component
  1347. + * has been disabled via SunToolkit.disableBackgroundErase().
  1348. + */
  1349. + void setBackgroundEraseDisabled(Component comp, boolean disabled);
  1350. + /*
  1351. + * Indicates whether the native background erase for a
  1352. + * component has been disabled via
  1353. + * SunToolkit.disableBackgroundErase().
  1354. + */
  1355. + boolean getBackgroundEraseDisabled(Component comp);
  1356. + /*
  1357. + *
  1358. + * Gets the bounds of this component in the form of a
  1359. + * <code>Rectangle</code> object. The bounds specify this
  1360. + * component's width, height, and location relative to
  1361. + * its parent.
  1362. + */
  1363. + Rectangle getBounds(Component comp);
  1364. + /*
  1365. * Sets the shape of a lw component to cut out from hw components.
  1366. + *
  1367. + * See 6797587, 6776743, 6768307, and 6768332 for details
  1368. */
  1369. void setMixingCutoutShape(Component comp, Shape shape);
  1370. /*
  1371. @@ -72,6 +91,41 @@
  1372. }
  1373. /*
  1374. + * An interface of accessor for java.awt.Window class.
  1375. + */
  1376. + public interface WindowAccessor {
  1377. + /*
  1378. + * Get opacity level of the given window.
  1379. + */
  1380. + float getOpacity(Window window);
  1381. + /*
  1382. + * Set opacity level to the given window.
  1383. + */
  1384. + void setOpacity(Window window, float opacity);
  1385. + /*
  1386. + * Get a shape assigned to the given window.
  1387. + */
  1388. + Shape getShape(Window window);
  1389. + /*
  1390. + * Set a shape to the given window.
  1391. + */
  1392. + void setShape(Window window, Shape shape);
  1393. + /*
  1394. + * Identify whether the given window is opaque (true)
  1395. + * or translucent (false).
  1396. + */
  1397. + boolean isOpaque(Window window);
  1398. + /*
  1399. + * Set the opaque preoperty to the given window.
  1400. + */
  1401. + void setOpaque(Window window, boolean isOpaque);
  1402. + /*
  1403. + * Update the image of a non-opaque (translucent) window.
  1404. + */
  1405. + void updateWindow(Window window, BufferedImage backBuffer);
  1406. + }
  1407. +
  1408. + /*
  1409. * An accessor for the AWTEvent class.
  1410. */
  1411. public interface AWTEventAccessor {
  1412. @@ -101,6 +155,14 @@
  1413. /* The java.awt.Component class accessor object.
  1414. */
  1415. private static ComponentAccessor componentAccessor;
  1416. + /*
  1417. + * The java.awt.Window class accessor object.
  1418. + */
  1419. + private static WindowAccessor windowAccessor;
  1420. +
  1421. + /*
  1422. + * The java.awt.AWTEvent class accessor object.
  1423. + */
  1424. private static AWTEventAccessor awtEventAccessor;
  1425. /*
  1426. @@ -137,4 +199,22 @@
  1427. }
  1428. return awtEventAccessor;
  1429. }
  1430. +
  1431. + /*
  1432. + * Set an accessor object for the java.awt.Window class.
  1433. + */
  1434. + public static void setWindowAccessor(WindowAccessor wa) {
  1435. + windowAccessor = wa;
  1436. + }
  1437. +
  1438. + /*
  1439. + * Retrieve the accessor object for the java.awt.Window class.
  1440. + */
  1441. + public static WindowAccessor getWindowAccessor() {
  1442. + if (windowAccessor == null) {
  1443. + unsafe.ensureClassInitialized(Window.class);
  1444. + }
  1445. + return windowAccessor;
  1446. + }
  1447. +
  1448. }
  1449. diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/EmbeddedFrame.java openjdk/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
  1450. --- openjdk.orig/jdk/src/share/classes/sun/awt/EmbeddedFrame.java 2011-01-20 23:54:24.000000000 +0000
  1451. +++ openjdk/jdk/src/share/classes/sun/awt/EmbeddedFrame.java 2011-02-16 01:27:25.008325931 +0000
  1452. @@ -1,5 +1,5 @@
  1453. /*
  1454. - * Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
  1455. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  1456. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1457. *
  1458. * This code is free software; you can redistribute it and/or modify it
  1459. @@ -579,5 +579,12 @@
  1460. }
  1461. public void updateMinimumSize() {
  1462. }
  1463. - }
  1464. +
  1465. + public void setOpacity(float opacity) {
  1466. + }
  1467. + public void setOpaque(boolean isOpaque) {
  1468. + }
  1469. + public void updateWindow(BufferedImage backBuffer) {
  1470. + }
  1471. + }
  1472. } // class EmbeddedFrame
  1473. diff -Nru openjdk.orig/jdk/src/share/classes/sun/awt/SunToolkit.java openjdk/jdk/src/share/classes/sun/awt/SunToolkit.java
  1474. --- openjdk.orig/jdk/src/share/classes/sun/awt/SunToolkit.java 2011-02-16 00:40:21.000000000 +0000
  1475. +++ openjdk/jdk/src/share/classes/sun/awt/SunToolkit.java 2011-02-16 01:27:25.008325931 +0000
  1476. @@ -1,5 +1,5 @@
  1477. /*
  1478. - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  1479. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  1480. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1481. *
  1482. * This code is free software; you can redistribute it and/or modify it
  1483. @@ -32,14 +32,10 @@
  1484. import java.awt.peer.*;
  1485. import java.awt.event.WindowEvent;
  1486. import java.awt.event.KeyEvent;
  1487. -import java.awt.im.spi.InputMethodDescriptor;
  1488. import java.awt.image.*;
  1489. -import java.awt.geom.AffineTransform;
  1490. import java.awt.TrayIcon;
  1491. import java.awt.SystemTray;
  1492. -import java.io.*;
  1493. import java.net.URL;
  1494. -import java.net.JarURLConnection;
  1495. import java.util.*;
  1496. import java.util.concurrent.TimeUnit;
  1497. import java.util.concurrent.locks.Condition;
  1498. @@ -49,7 +45,6 @@
  1499. import sun.misc.SoftCache;
  1500. import sun.font.FontDesignMetrics;
  1501. import sun.awt.im.InputContext;
  1502. -import sun.awt.im.SimpleInputMethodWindow;
  1503. import sun.awt.image.*;
  1504. import sun.security.action.GetPropertyAction;
  1505. import sun.security.action.GetBooleanAction;
  1506. @@ -825,16 +820,31 @@
  1507. }
  1508. /**
  1509. - * Disables erasing of background on the canvas before painting
  1510. - * if this is supported by the current toolkit.
  1511. - *
  1512. - * @throws IllegalStateException if the canvas is not displayable
  1513. - * @see java.awt.Component#isDisplayable
  1514. + * Disables erasing of background on the canvas before painting if
  1515. + * this is supported by the current toolkit. It is recommended to
  1516. + * call this method early, before the Canvas becomes displayable,
  1517. + * because some Toolkit implementations do not support changing
  1518. + * this property once the Canvas becomes displayable.
  1519. */
  1520. public void disableBackgroundErase(Canvas canvas) {
  1521. - if (!canvas.isDisplayable()) {
  1522. - throw new IllegalStateException("Canvas must have a valid peer");
  1523. - }
  1524. + disableBackgroundEraseImpl(canvas);
  1525. + }
  1526. +
  1527. + /**
  1528. + * Disables the native erasing of the background on the given
  1529. + * component before painting if this is supported by the current
  1530. + * toolkit. This only has an effect for certain components such as
  1531. + * Canvas, Panel and Window. It is recommended to call this method
  1532. + * early, before the Component becomes displayable, because some
  1533. + * Toolkit implementations do not support changing this property
  1534. + * once the Component becomes displayable.
  1535. + */
  1536. + public void disableBackgroundErase(Component component) {
  1537. + disableBackgroundEraseImpl(component);
  1538. + }
  1539. +
  1540. + private void disableBackgroundEraseImpl(Component component) {
  1541. + AWTAccessor.getComponentAccessor().setBackgroundEraseDisabled(component, true);
  1542. }
  1543. /**
  1544. @@ -1973,6 +1983,18 @@
  1545. AWTAutoShutdown.getInstance().dumpPeers(aLog);
  1546. }
  1547. + /**
  1548. + * Returns the <code>Window</code> ancestor of the component <code>comp</code>.
  1549. + * @return Window ancestor of the component or component by itself if it is Window;
  1550. + * null, if component is not a part of window hierarchy
  1551. + */
  1552. + public static Window getContainingWindow(Component comp) {
  1553. + while (comp != null && !(comp instanceof Window)) {
  1554. + comp = comp.getParent();
  1555. + }
  1556. + return (Window)comp;
  1557. + }
  1558. +
  1559. private static Boolean sunAwtDisableMixing = null;
  1560. /**
  1561. @@ -1996,6 +2018,73 @@
  1562. public boolean isNativeGTKAvailable() {
  1563. return false;
  1564. }
  1565. +
  1566. + // Cosntant alpha
  1567. + public boolean isWindowOpacitySupported() {
  1568. + return false;
  1569. + }
  1570. +
  1571. + // Shaping
  1572. + public boolean isWindowShapingSupported() {
  1573. + return false;
  1574. + }
  1575. +
  1576. + // Per-pixel alpha
  1577. + public boolean isWindowTranslucencySupported() {
  1578. + return false;
  1579. + }
  1580. +
  1581. + public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
  1582. + return false;
  1583. + }
  1584. +
  1585. + /**
  1586. + * Returns whether or not a containing top level window for the passed
  1587. + * component is
  1588. + * {@link com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
  1589. + *
  1590. + * @param c a Component which toplevel's to check
  1591. + * @return {@code true} if the passed component is not null and has a
  1592. + * containing toplevel window which is opaque (so per-pixel translucency
  1593. + * is not enabled), {@code false} otherwise
  1594. + * @see com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT
  1595. + * @see com.sun.awt.AWTUtilities#isWindowOpaque(Window)
  1596. + */
  1597. + public static boolean isContainingTopLevelOpaque(Component c) {
  1598. + Window w = getContainingWindow(c);
  1599. + // return w != null && (w).isOpaque();
  1600. + return w != null && com.sun.awt.AWTUtilities.isWindowOpaque(w);
  1601. + }
  1602. +
  1603. + /**
  1604. + * Returns whether or not a containing top level window for the passed
  1605. + * component is
  1606. + * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
  1607. + *
  1608. + * @param c a Component which toplevel's to check
  1609. + * @return {@code true} if the passed component is not null and has a
  1610. + * containing toplevel window which has opacity less than
  1611. + * 1.0f (which means that it is translucent), {@code false} otherwise
  1612. + * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
  1613. + * @see com.sun.awt.AWTUtilities#getWindowOpacity(Window)
  1614. + */
  1615. + public static boolean isContainingTopLevelTranslucent(Component c) {
  1616. + Window w = getContainingWindow(c);
  1617. + // return w != null && (w).getOpacity() < 1.0f;
  1618. + return w != null && com.sun.awt.AWTUtilities.getWindowOpacity((Window)w) < 1.0f;
  1619. + }
  1620. +
  1621. + /**
  1622. + * Returns whether the native system requires using the peer.updateWindow()
  1623. + * method to update the contents of a non-opaque window, or if usual
  1624. + * painting procedures are sufficient. The default return value covers
  1625. + * the X11 systems. On MS Windows this method is overriden in WToolkit
  1626. + * to return true.
  1627. + */
  1628. + public boolean needUpdateWindow() {
  1629. + return false;
  1630. + }
  1631. +
  1632. } // class SunToolkit
  1633. diff -Nru openjdk.orig/jdk/src/share/native/sun/awt/utility/rect.c openjdk/jdk/src/share/native/sun/awt/utility/rect.c
  1634. --- openjdk.orig/jdk/src/share/native/sun/awt/utility/rect.c 1970-01-01 01:00:00.000000000 +0100
  1635. +++ openjdk/jdk/src/share/native/sun/awt/utility/rect.c 2011-02-16 01:27:25.008325931 +0000
  1636. @@ -0,0 +1,102 @@
  1637. +/*
  1638. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  1639. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1640. + *
  1641. + * This code is free software; you can redistribute it and/or modify it
  1642. + * under the terms of the GNU General Public License version 2 only, as
  1643. + * published by the Free Software Foundation. Oracle designates this
  1644. + * particular file as subject to the "Classpath" exception as provided
  1645. + * by Oracle in the LICENSE file that accompanied this code.
  1646. + *
  1647. + * This code is distributed in the hope that it will be useful, but WITHOUT
  1648. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  1649. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  1650. + * version 2 for more details (a copy is included in the LICENSE file that
  1651. + * accompanied this code).
  1652. + *
  1653. + * You should have received a copy of the GNU General Public License version
  1654. + * 2 along with this work; if not, write to the Free Software Foundation,
  1655. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  1656. + *
  1657. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  1658. + * or visit www.oracle.com if you need additional information or have any
  1659. + * questions.
  1660. + */
  1661. +
  1662. +#include "utility/rect.h"
  1663. +
  1664. +#if defined(__cplusplus)
  1665. +extern "C" {
  1666. +#endif
  1667. +
  1668. +/**
  1669. + * bitsPerPixel must be 32 for now.
  1670. + * outBuf must be large enough to conatin all the rectangles.
  1671. + */
  1672. +int BitmapToYXBandedRectangles(int bitsPerPixel, int width, int height, unsigned char * buf, RECT_T * outBuf)
  1673. +{
  1674. + //XXX: we might want to reuse the code in the splashscreen library,
  1675. + // though we'd have to deal with the ALPHA_THRESHOLD and different
  1676. + // image formats in this case.
  1677. + int widthBytes = width * bitsPerPixel / 8;
  1678. + int alignedWidth = (((widthBytes - 1) / 4) + 1) * 4;
  1679. +
  1680. + RECT_T * out = outBuf;
  1681. +
  1682. + RECT_T *pPrevLine = NULL, *pFirst = out, *pThis = pFirst;
  1683. + int i, j, i0;
  1684. + int length;
  1685. +
  1686. + for (j = 0; j < height; j++) {
  1687. + /* generate data for a scanline */
  1688. +
  1689. + unsigned char *pSrc = (unsigned char *) buf + j * alignedWidth;
  1690. + RECT_T *pLine = pThis;
  1691. +
  1692. + i = 0;
  1693. +
  1694. + do {
  1695. + // pSrc[0,1,2] == B,G,R; pSrc[3] == Alpha
  1696. + while (i < width && !pSrc[3]) {
  1697. + pSrc += 4;
  1698. + ++i;
  1699. + }
  1700. + if (i >= width)
  1701. + break;
  1702. + i0 = i;
  1703. + while (i < width && pSrc[3]) {
  1704. + pSrc += 4;
  1705. + ++i;
  1706. + }
  1707. + RECT_SET(*pThis, i0, j, i - i0, 1);
  1708. + ++pThis;
  1709. + } while (i < width);
  1710. +
  1711. + /* check if the previous scanline is exactly the same, merge if so
  1712. + (this is the only optimization we can use for YXBanded rectangles,
  1713. + and win32 supports YXBanded only */
  1714. +
  1715. + length = pThis - pLine;
  1716. + if (pPrevLine && pLine - pPrevLine == length) {
  1717. + for (i = 0; i < length && RECT_EQ_X(pPrevLine[i], pLine[i]); ++i) {
  1718. + }
  1719. + if (i == pLine - pPrevLine) {
  1720. + // do merge
  1721. + for (i = 0; i < length; i++) {
  1722. + RECT_INC_HEIGHT(pPrevLine[i]);
  1723. + }
  1724. + pThis = pLine;
  1725. + continue;
  1726. + }
  1727. + }
  1728. + /* or else use the generated scanline */
  1729. +
  1730. + pPrevLine = pLine;
  1731. + }
  1732. +
  1733. + return pThis - pFirst;
  1734. +}
  1735. +
  1736. +#if defined(__cplusplus)
  1737. +}
  1738. +#endif
  1739. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java openjdk/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
  1740. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java 2011-01-20 23:54:40.000000000 +0000
  1741. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java 2011-02-16 01:27:25.008325931 +0000
  1742. @@ -1,5 +1,5 @@
  1743. /*
  1744. - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
  1745. + * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
  1746. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1747. *
  1748. * This code is free software; you can redistribute it and/or modify it
  1749. @@ -859,14 +859,14 @@
  1750. pw.println("\n\tlong pData;");
  1751. pw.println("\n\tpublic long getPData() { return pData; }");
  1752. - pw.println("\n\n\t" + stp.getJavaClassName() + "(long addr) {");
  1753. + pw.println("\n\n\tpublic " + stp.getJavaClassName() + "(long addr) {");
  1754. if (generateLog) {
  1755. pw.println("\t\tlog.finest(\"Creating\");");
  1756. }
  1757. pw.println("\t\tpData=addr;");
  1758. pw.println("\t\tshould_free_memory = false;");
  1759. pw.println("\t}");
  1760. - pw.println("\n\n\t" + stp.getJavaClassName() + "() {");
  1761. + pw.println("\n\n\tpublic " + stp.getJavaClassName() + "() {");
  1762. if (generateLog) {
  1763. pw.println("\t\tlog.finest(\"Creating\");");
  1764. }
  1765. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt openjdk/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt
  1766. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt 2011-01-20 23:54:40.000000000 +0000
  1767. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt 2011-02-16 01:27:25.008325931 +0000
  1768. @@ -750,6 +750,7 @@
  1769. pixelStride int
  1770. color_data pointer ColorData
  1771. glxInfo pointer
  1772. + isTranslucencySupported int
  1773. AwtScreenData
  1774. numConfigs int
  1775. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
  1776. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java 2011-01-20 23:54:40.000000000 +0000
  1777. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java 2011-02-16 01:27:25.008325931 +0000
  1778. @@ -1,5 +1,5 @@
  1779. /*
  1780. - * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
  1781. + * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
  1782. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1783. *
  1784. * This code is free software; you can redistribute it and/or modify it
  1785. @@ -268,6 +268,8 @@
  1786. XAtom XA_NET_WM_WINDOW_TYPE = XAtom.get("_NET_WM_WINDOW_TYPE");
  1787. XAtom XA_NET_WM_WINDOW_TYPE_DIALOG = XAtom.get("_NET_WM_WINDOW_TYPE_DIALOG");
  1788. + XAtom XA_NET_WM_WINDOW_OPACITY = XAtom.get("_NET_WM_WINDOW_OPACITY");
  1789. +
  1790. /* For _NET_WM_STATE ClientMessage requests */
  1791. final static int _NET_WM_STATE_REMOVE =0; /* remove/unset property */
  1792. final static int _NET_WM_STATE_ADD =1; /* add/set property */
  1793. @@ -304,6 +306,12 @@
  1794. boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_STATE_MODAL);
  1795. return res;
  1796. }
  1797. +
  1798. + boolean doOpacityProtocol() {
  1799. + boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_WINDOW_OPACITY);
  1800. + return res;
  1801. + }
  1802. +
  1803. boolean isWMName(String name) {
  1804. if (!active()) {
  1805. return false;
  1806. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
  1807. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 2011-01-20 23:54:40.000000000 +0000
  1808. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java 2011-02-16 01:27:25.008325931 +0000
  1809. @@ -2181,4 +2181,35 @@
  1810. return new XDesktopPeer();
  1811. }
  1812. + @Override
  1813. + public boolean isWindowOpacitySupported() {
  1814. + XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
  1815. +
  1816. + if (net_protocol == null) {
  1817. + return false;
  1818. + }
  1819. +
  1820. + return net_protocol.doOpacityProtocol();
  1821. + }
  1822. +
  1823. + @Override
  1824. + public boolean isWindowShapingSupported() {
  1825. + return XlibUtil.isShapingSupported();
  1826. + }
  1827. +
  1828. + @Override
  1829. + public boolean isWindowTranslucencySupported() {
  1830. + //NOTE: it may not be supported. The actual check is being performed
  1831. + // at com.sun.awt.AWTUtilities(). In X11 we need to check
  1832. + // whether there's any translucency-capable GC available.
  1833. + return true;
  1834. + }
  1835. +
  1836. + @Override
  1837. + public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
  1838. + if (!(gc instanceof X11GraphicsConfig)) {
  1839. + return false;
  1840. + }
  1841. + return ((X11GraphicsConfig)gc).isTranslucencyCapable();
  1842. + }
  1843. }
  1844. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
  1845. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2011-01-20 23:54:40.000000000 +0000
  1846. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java 2011-02-16 01:27:25.008325931 +0000
  1847. @@ -1,5 +1,5 @@
  1848. /*
  1849. - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
  1850. + * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
  1851. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1852. *
  1853. * This code is free software; you can redistribute it and/or modify it
  1854. @@ -30,6 +30,8 @@
  1855. import java.awt.event.FocusEvent;
  1856. import java.awt.event.WindowEvent;
  1857. +import java.awt.image.BufferedImage;
  1858. +
  1859. import java.awt.peer.ComponentPeer;
  1860. import java.awt.peer.WindowPeer;
  1861. @@ -42,6 +44,7 @@
  1862. import java.util.logging.Level;
  1863. import java.util.logging.Logger;
  1864. +import sun.awt.AWTAccessor;
  1865. import sun.awt.ComponentAccessor;
  1866. import sun.awt.WindowAccessor;
  1867. import sun.awt.DisplayChangedListener;
  1868. @@ -49,6 +52,8 @@
  1869. import sun.awt.X11GraphicsDevice;
  1870. import sun.awt.X11GraphicsEnvironment;
  1871. +import sun.java2d.pipe.Region;
  1872. +
  1873. class XWindowPeer extends XPanelPeer implements WindowPeer,
  1874. DisplayChangedListener, MWMConstants {
  1875. @@ -269,6 +274,10 @@
  1876. XWM.requestWMExtents(getWindow());
  1877. updateIconImages();
  1878. +
  1879. + updateShape();
  1880. + updateOpacity();
  1881. + // no need in updateOpaque() as it is no-op
  1882. }
  1883. public void updateIconImages() {
  1884. @@ -426,6 +435,22 @@
  1885. return defaultIconInfo;
  1886. }
  1887. + private void updateShape() {
  1888. + // Shape shape = ((Window)target).getShape();
  1889. + Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
  1890. + if (shape != null) {
  1891. + applyShape(Region.getInstance(shape, null));
  1892. + }
  1893. + }
  1894. +
  1895. + private void updateOpacity() {
  1896. + // float opacity = ((Window)target).getOpacity();
  1897. + float opacity = AWTAccessor.getWindowAccessor().getOpacity((Window)target);
  1898. + if (opacity < 1.0f) {
  1899. + setOpacity(opacity);
  1900. + }
  1901. + }
  1902. +
  1903. public void updateMinimumSize() {
  1904. //This function only saves minimumSize value in XWindowPeer
  1905. //Setting WMSizeHints is implemented in XDecoratedPeer
  1906. @@ -2122,4 +2147,44 @@
  1907. }
  1908. super.handleButtonPressRelease(xev);
  1909. }
  1910. +
  1911. + public void print(Graphics g) {
  1912. + // We assume we print the whole frame,
  1913. + // so we expect no clip was set previously
  1914. + Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
  1915. + if (shape != null) {
  1916. + g.setClip(shape);
  1917. + }
  1918. + super.print(g);
  1919. + }
  1920. +
  1921. + @Override
  1922. + public void setOpacity(float opacity) {
  1923. + final long maxOpacity = 0xffffffffl;
  1924. + long iOpacity = (long)(opacity * maxOpacity);
  1925. + if (iOpacity < 0) {
  1926. + iOpacity = 0;
  1927. + }
  1928. + if (iOpacity > maxOpacity) {
  1929. + iOpacity = maxOpacity;
  1930. + }
  1931. +
  1932. + XAtom netWmWindowOpacityAtom = XAtom.get("_NET_WM_WINDOW_OPACITY");
  1933. +
  1934. + if (iOpacity == maxOpacity) {
  1935. + netWmWindowOpacityAtom.DeleteProperty(getWindow());
  1936. + } else {
  1937. + netWmWindowOpacityAtom.setCard32Property(getWindow(), iOpacity);
  1938. + }
  1939. + }
  1940. +
  1941. + @Override
  1942. + public void setOpaque(boolean isOpaque) {
  1943. + // no-op
  1944. + }
  1945. +
  1946. + @Override
  1947. + public void updateWindow(BufferedImage backBuffer) {
  1948. + // no-op
  1949. + }
  1950. }
  1951. diff -Nru openjdk.orig/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java openjdk/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java
  1952. --- openjdk.orig/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java 2011-02-16 00:40:21.000000000 +0000
  1953. +++ openjdk/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java 2011-02-16 01:27:25.008325931 +0000
  1954. @@ -1,5 +1,5 @@
  1955. /*
  1956. - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  1957. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  1958. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  1959. *
  1960. * This code is free software; you can redistribute it and/or modify it
  1961. @@ -458,4 +458,13 @@
  1962. return 0x00; // UNDEFINED
  1963. }
  1964. }
  1965. +
  1966. + /*
  1967. + @Override
  1968. + */
  1969. + public boolean isTranslucencyCapable() {
  1970. + return isTranslucencyCapable(getAData());
  1971. + }
  1972. +
  1973. + private native boolean isTranslucencyCapable(long x11ConfigData);
  1974. }
  1975. diff -Nru openjdk.orig/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
  1976. --- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2011-01-20 23:54:42.000000000 +0000
  1977. +++ openjdk/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c 2011-02-16 01:27:25.008325931 +0000
  1978. @@ -323,6 +323,48 @@
  1979. return NULL;
  1980. }
  1981. +/* Note: until we include the <X11/extensions/Xrender.h> explicitly
  1982. + * we have to define a couple of things ourselves.
  1983. + */
  1984. +typedef unsigned long PictFormat;
  1985. +#define PictTypeIndexed 0
  1986. +#define PictTypeDirect 1
  1987. +
  1988. +typedef struct {
  1989. + short red;
  1990. + short redMask;
  1991. + short green;
  1992. + short greenMask;
  1993. + short blue;
  1994. + short blueMask;
  1995. + short alpha;
  1996. + short alphaMask;
  1997. +} XRenderDirectFormat;
  1998. +
  1999. +typedef struct {
  2000. + PictFormat id;
  2001. + int type;
  2002. + int depth;
  2003. + XRenderDirectFormat direct;
  2004. + Colormap colormap;
  2005. +} XRenderPictFormat;
  2006. +
  2007. +#define PictFormatID (1 << 0)
  2008. +#define PictFormatType (1 << 1)
  2009. +#define PictFormatDepth (1 << 2)
  2010. +#define PictFormatRed (1 << 3)
  2011. +#define PictFormatRedMask (1 << 4)
  2012. +#define PictFormatGreen (1 << 5)
  2013. +#define PictFormatGreenMask (1 << 6)
  2014. +#define PictFormatBlue (1 << 7)
  2015. +#define PictFormatBlueMask (1 << 8)
  2016. +#define PictFormatAlpha (1 << 9)
  2017. +#define PictFormatAlphaMask (1 << 10)
  2018. +#define PictFormatColormap (1 << 11)
  2019. +
  2020. +typedef XRenderPictFormat *
  2021. +XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
  2022. +
  2023. static void
  2024. getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
  2025. @@ -336,6 +378,9 @@
  2026. int ind;
  2027. char errmsg[128];
  2028. int xinawareScreen;
  2029. + void* xrenderLibHandle = NULL;
  2030. + XRenderFindVisualFormatFunc *XRenderFindVisualFormat = NULL;
  2031. + int major_opcode, first_event, first_error;
  2032. if (usingXinerama) {
  2033. xinawareScreen = 0;
  2034. @@ -418,6 +463,26 @@
  2035. graphicsConfigs[0] = defaultConfig;
  2036. nConfig = 1; /* reserve index 0 for default config */
  2037. + // Only use the RENDER extension if it is available on the X server
  2038. + if (XQueryExtension(awt_display, "RENDER",
  2039. + &major_opcode, &first_event, &first_error))
  2040. + {
  2041. + xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);
  2042. +
  2043. +#ifndef __linux__ /* SOLARIS */
  2044. + if (xrenderLibHandle == NULL) {
  2045. + xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
  2046. + RTLD_LAZY | RTLD_GLOBAL);
  2047. + }
  2048. +#endif
  2049. +
  2050. + if (xrenderLibHandle != NULL) {
  2051. + XRenderFindVisualFormat =
  2052. + (XRenderFindVisualFormatFunc*)dlsym(xrenderLibHandle,
  2053. + "XRenderFindVisualFormat");
  2054. + }
  2055. + }
  2056. +
  2057. for (i = 0; i < nTrue; i++) {
  2058. if (XVisualIDFromVisual(pVITrue[i].visual) ==
  2059. XVisualIDFromVisual(defaultConfig->awt_visInfo.visual) ||
  2060. @@ -431,6 +496,21 @@
  2061. graphicsConfigs [ind]->awt_depth = pVITrue [i].depth;
  2062. memcpy (&graphicsConfigs [ind]->awt_visInfo, &pVITrue [i],
  2063. sizeof (XVisualInfo));
  2064. + if (XRenderFindVisualFormat != NULL) {
  2065. + XRenderPictFormat *format = XRenderFindVisualFormat (awt_display,
  2066. + pVITrue [i].visual);
  2067. + if (format &&
  2068. + format->type == PictTypeDirect &&
  2069. + format->direct.alphaMask)
  2070. + {
  2071. + graphicsConfigs [ind]->isTranslucencySupported = 1;
  2072. + }
  2073. + }
  2074. + }
  2075. +
  2076. + if (xrenderLibHandle != NULL) {
  2077. + dlclose(xrenderLibHandle);
  2078. + xrenderLibHandle = NULL;
  2079. }
  2080. for (i = 0; i < n8p; i++) {
  2081. @@ -1474,6 +1554,26 @@
  2082. }
  2083. /*
  2084. + * Class: sun_awt_X11GraphicsConfig
  2085. + * Method: isTranslucencyCapable
  2086. + * Signature: (J)V
  2087. + */
  2088. +JNIEXPORT jboolean JNICALL
  2089. +Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable
  2090. + (JNIEnv *env, jobject this, jlong configData)
  2091. +{
  2092. +#ifdef HEADLESS
  2093. + return JNI_FALSE;
  2094. +#else
  2095. + AwtGraphicsConfigDataPtr aData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(configData);
  2096. + if (aData == NULL) {
  2097. + return JNI_FALSE;
  2098. + }
  2099. + return (jboolean)aData->isTranslucencySupported;
  2100. +#endif
  2101. +}
  2102. +
  2103. +/*
  2104. * Class: sun_awt_X11GraphicsDevice
  2105. * Method: isDBESupported
  2106. * Signature: ()Z
  2107. diff -Nru openjdk.orig/jdk/src/solaris/native/sun/awt/awt_p.h openjdk/jdk/src/solaris/native/sun/awt/awt_p.h
  2108. --- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_p.h 2011-01-20 23:54:42.000000000 +0000
  2109. +++ openjdk/jdk/src/solaris/native/sun/awt/awt_p.h 2011-02-16 01:27:25.008325931 +0000
  2110. @@ -1,5 +1,5 @@
  2111. /*
  2112. - * Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
  2113. + * Copyright (c) 1995, 2009, Oracle and/or its affiliates. All rights reserved.
  2114. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2115. *
  2116. * This code is free software; you can redistribute it and/or modify it
  2117. @@ -135,6 +135,7 @@
  2118. int pixelStride; /* Used in X11SurfaceData.c */
  2119. ColorData *color_data;
  2120. struct _GLXGraphicsConfigInfo *glxInfo;
  2121. + int isTranslucencySupported; /* Uses Xrender to find this out. */
  2122. } AwtGraphicsConfigData;
  2123. typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;
  2124. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java openjdk/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java
  2125. --- openjdk.orig/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java 2011-02-16 00:40:21.000000000 +0000
  2126. +++ openjdk/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java 2011-02-16 01:27:25.008325931 +0000
  2127. @@ -1,5 +1,5 @@
  2128. /*
  2129. - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  2130. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  2131. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2132. *
  2133. * This code is free software; you can redistribute it and/or modify it
  2134. @@ -339,4 +339,12 @@
  2135. }
  2136. // the rest of the flip actions are not supported
  2137. }
  2138. +
  2139. + /*
  2140. + @Override
  2141. + */
  2142. + public boolean isTranslucencyCapable() {
  2143. + //XXX: worth checking if 8-bit? Anyway, it doesn't hurt.
  2144. + return true;
  2145. + }
  2146. }
  2147. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java openjdk/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
  2148. --- openjdk.orig/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java 2011-02-16 00:40:21.000000000 +0000
  2149. +++ openjdk/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java 2011-02-16 01:27:25.012325621 +0000
  2150. @@ -1,5 +1,5 @@
  2151. /*
  2152. - * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
  2153. + * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
  2154. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2155. *
  2156. * This code is free software; you can redistribute it and/or modify it
  2157. @@ -379,4 +379,11 @@
  2158. private static void dwmCompositionChanged(boolean enabled) {
  2159. isDWMCompositionEnabled = enabled;
  2160. }
  2161. +
  2162. + /**
  2163. + * Used to find out if the OS is Windows Vista or later.
  2164. + *
  2165. + * @return {@code true} if the OS is Vista or later, {@code false} otherwise
  2166. + */
  2167. + public static native boolean isVistaOS();
  2168. }
  2169. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java openjdk/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
  2170. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java 1970-01-01 01:00:00.000000000 +0100
  2171. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java 2011-02-16 01:27:25.012325621 +0000
  2172. @@ -0,0 +1,398 @@
  2173. +/*
  2174. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  2175. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2176. + *
  2177. + * This code is free software; you can redistribute it and/or modify it
  2178. + * under the terms of the GNU General Public License version 2 only, as
  2179. + * published by the Free Software Foundation. Oracle designates this
  2180. + * particular file as subject to the "Classpath" exception as provided
  2181. + * by Oracle in the LICENSE file that accompanied this code.
  2182. + *
  2183. + * This code is distributed in the hope that it will be useful, but WITHOUT
  2184. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  2185. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  2186. + * version 2 for more details (a copy is included in the LICENSE file that
  2187. + * accompanied this code).
  2188. + *
  2189. + * You should have received a copy of the GNU General Public License version
  2190. + * 2 along with this work; if not, write to the Free Software Foundation,
  2191. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  2192. + *
  2193. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  2194. + * or visit www.oracle.com if you need additional information or have any
  2195. + * questions.
  2196. + */
  2197. +package sun.awt.windows;
  2198. +
  2199. +import java.awt.AlphaComposite;
  2200. +import java.awt.Color;
  2201. +import java.awt.Graphics2D;
  2202. +import java.awt.GraphicsConfiguration;
  2203. +import java.awt.Image;
  2204. +import java.awt.Window;
  2205. +import java.awt.image.BufferedImage;
  2206. +import java.awt.image.DataBufferInt;
  2207. +import java.awt.image.VolatileImage;
  2208. +import java.lang.ref.WeakReference;
  2209. +import java.security.AccessController;
  2210. +import sun.awt.image.BufImgSurfaceData;
  2211. +import sun.java2d.DestSurfaceProvider;
  2212. +import sun.java2d.InvalidPipeException;
  2213. +import sun.java2d.Surface;
  2214. +import sun.java2d.pipe.RenderQueue;
  2215. +import sun.java2d.pipe.hw.AccelGraphicsConfig;
  2216. +import sun.java2d.pipe.hw.AccelSurface;
  2217. +import sun.security.action.GetPropertyAction;
  2218. +
  2219. +import static java.awt.image.VolatileImage.*;
  2220. +import static java.awt.Transparency.*;
  2221. +import static sun.java2d.pipe.hw.AccelSurface.*;
  2222. +import static sun.java2d.pipe.hw.ContextCapabilities.*;
  2223. +
  2224. +/**
  2225. + * This class handles the updates of the non-opaque windows.
  2226. + * The window associated with the peer is updated either given an image or
  2227. + * the window is repainted to an internal buffer which is then used to update
  2228. + * the window.
  2229. + *
  2230. + * Note: this class does not attempt to be thread safe, it is expected to be
  2231. + * called from a single thread (EDT).
  2232. + */
  2233. +public abstract class TranslucentWindowPainter {
  2234. +
  2235. + protected Window window;
  2236. + protected WWindowPeer peer;
  2237. +
  2238. + // REMIND: we probably would want to remove this later
  2239. + private static final boolean forceOpt =
  2240. + Boolean.valueOf(AccessController.doPrivileged(
  2241. + new GetPropertyAction("sun.java2d.twp.forceopt", "false")));
  2242. + private static final boolean forceSW =
  2243. + Boolean.valueOf(AccessController.doPrivileged(
  2244. + new GetPropertyAction("sun.java2d.twp.forcesw", "false")));
  2245. +
  2246. + /**
  2247. + * Creates an instance of the painter for particular peer.
  2248. + */
  2249. + public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
  2250. + GraphicsConfiguration gc = peer.getGraphicsConfiguration();
  2251. + if (!forceSW && gc instanceof AccelGraphicsConfig) {
  2252. + String gcName = gc.getClass().getSimpleName();
  2253. + AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
  2254. + // this is a heuristic to check that we have a pcix board
  2255. + // (those have higher transfer rate from gpu to cpu)
  2256. + if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
  2257. + forceOpt)
  2258. + {
  2259. + // we check for name to avoid loading classes unnecessarily if
  2260. + // a pipeline isn't enabled
  2261. + if (gcName.startsWith("D3D")) {
  2262. + return new VIOptD3DWindowPainter(peer);
  2263. + } else if (forceOpt && gcName.startsWith("WGL")) {
  2264. + // on some boards (namely, ATI, even on pcix bus) ogl is
  2265. + // very slow reading pixels back so for now it is disabled
  2266. + // unless forced
  2267. + return new VIOptWGLWindowPainter(peer);
  2268. + }
  2269. + }
  2270. + }
  2271. + return new BIWindowPainter(peer);
  2272. + }
  2273. +
  2274. + protected TranslucentWindowPainter(WWindowPeer peer) {
  2275. + this.peer = peer;
  2276. + this.window = (Window)peer.getTarget();
  2277. + }
  2278. +
  2279. + /**
  2280. + * Creates (if needed), clears and returns the buffer for this painter.
  2281. + */
  2282. + protected abstract Image getBackBuffer();
  2283. +
  2284. + /**
  2285. + * Updates the the window associated with this painter with the contents
  2286. + * of the passed image.
  2287. + * The image can not be null, and NPE will be thrown if it is.
  2288. + */
  2289. + protected abstract boolean update(Image bb);
  2290. +
  2291. + /**
  2292. + * Flushes the resources associated with the painter. They will be
  2293. + * recreated as needed.
  2294. + */
  2295. + public abstract void flush();
  2296. +
  2297. + /**
  2298. + * Updates the window associated with the painter given the passed image.
  2299. + * If the passed image is null the painter will use its own buffer for
  2300. + * rendering the contents of the window into it and updating the window.
  2301. + *
  2302. + * If the passed buffer has dimensions different from the window, it is
  2303. + * copied into the internal buffer first and the latter is used to update
  2304. + * the window.
  2305. + *
  2306. + * @param bb the image to update the non opaque window with, or null.
  2307. + * If not null, the image must be of ARGB_PRE type.
  2308. + */
  2309. + public void updateWindow(Image bb) {
  2310. + boolean done = false;
  2311. + if (bb != null && (window.getWidth() != bb.getWidth(null) ||
  2312. + window.getHeight() != bb.getHeight(null)))
  2313. + {
  2314. + Image ourBB = getBackBuffer();
  2315. + Graphics2D g = (Graphics2D)ourBB.getGraphics();
  2316. + g.drawImage(bb, 0, 0, null);
  2317. + g.dispose();
  2318. + bb = ourBB;
  2319. + }
  2320. + do {
  2321. + if (bb == null) {
  2322. + bb = getBackBuffer();
  2323. + Graphics2D g = (Graphics2D)bb.getGraphics();
  2324. + try {
  2325. + window.paintAll(g);
  2326. + } finally {
  2327. + g.dispose();
  2328. + }
  2329. + }
  2330. +
  2331. + peer.paintAppletWarning((Graphics2D)bb.getGraphics(),
  2332. + bb.getWidth(null), bb.getHeight(null));
  2333. +
  2334. + done = update(bb);
  2335. + // in case they passed us a lost VI, next time around we'll use our
  2336. + // own bb because we can not validate and restore the contents of
  2337. + // their VI
  2338. + if (!done) {
  2339. + bb = null;
  2340. + }
  2341. + } while (!done);
  2342. + }
  2343. +
  2344. + private static final Image clearImage(Image bb) {
  2345. + Graphics2D g = (Graphics2D)bb.getGraphics();
  2346. + int w = bb.getWidth(null);
  2347. + int h = bb.getHeight(null);
  2348. +
  2349. + g.setComposite(AlphaComposite.Src);
  2350. + g.setColor(new Color(0, 0, 0, 0));
  2351. + g.fillRect(0, 0, w, h);
  2352. +
  2353. + return bb;
  2354. + }
  2355. +
  2356. + /**
  2357. + * A painter which uses BufferedImage as the internal buffer. The window
  2358. + * is painted into this buffer, and the contents then are uploaded
  2359. + * into the layered window.
  2360. + *
  2361. + * This painter handles all types of images passed to its paint(Image)
  2362. + * method (VI, BI, regular Images).
  2363. + */
  2364. + private static class BIWindowPainter extends TranslucentWindowPainter {
  2365. + private WeakReference<BufferedImage> biRef;
  2366. +
  2367. + protected BIWindowPainter(WWindowPeer peer) {
  2368. + super(peer);
  2369. + }
  2370. +
  2371. + private BufferedImage getBIBackBuffer() {
  2372. + int w = window.getWidth();
  2373. + int h = window.getHeight();
  2374. + BufferedImage bb = biRef == null ? null : biRef.get();
  2375. + if (bb == null || bb.getWidth() != w || bb.getHeight() != h) {
  2376. + if (bb != null) {
  2377. + bb.flush();
  2378. + bb = null;
  2379. + }
  2380. + bb = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
  2381. + biRef = new WeakReference<BufferedImage>(bb);
  2382. + }
  2383. + return (BufferedImage)clearImage(bb);
  2384. + }
  2385. +
  2386. + @Override
  2387. + protected Image getBackBuffer() {
  2388. + return getBIBackBuffer();
  2389. + }
  2390. +
  2391. + @Override
  2392. + protected boolean update(Image bb) {
  2393. + VolatileImage viBB = null;
  2394. +
  2395. + if (bb instanceof BufferedImage) {
  2396. + BufferedImage bi = (BufferedImage)bb;
  2397. + int data[] =
  2398. + ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
  2399. + peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
  2400. + return true;
  2401. + } else if (bb instanceof VolatileImage) {
  2402. + viBB = (VolatileImage)bb;
  2403. + if (bb instanceof DestSurfaceProvider) {
  2404. + Surface s = ((DestSurfaceProvider)bb).getDestSurface();
  2405. + if (s instanceof BufImgSurfaceData) {
  2406. + // the image is probably lost, upload the data from the
  2407. + // backup surface to avoid creating another heap-based
  2408. + // image (the parent's buffer)
  2409. + int w = viBB.getWidth();
  2410. + int h = viBB.getHeight();
  2411. + BufImgSurfaceData bisd = (BufImgSurfaceData)s;
  2412. + int data[] = ((DataBufferInt)bisd.getRaster(0,0,w,h).
  2413. + getDataBuffer()).getData();
  2414. + peer.updateWindowImpl(data, w, h);
  2415. + return true;
  2416. + }
  2417. + }
  2418. + }
  2419. +
  2420. + // copy the passed image into our own buffer, then upload
  2421. + BufferedImage bi = getBIBackBuffer();
  2422. + Graphics2D g = (Graphics2D)bi.getGraphics();
  2423. + g.setComposite(AlphaComposite.Src);
  2424. + g.drawImage(bb, 0, 0, null);
  2425. +
  2426. + int data[] =
  2427. + ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
  2428. + peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
  2429. +
  2430. + return (viBB != null ? !viBB.contentsLost() : true);
  2431. + }
  2432. +
  2433. + public void flush() {
  2434. + if (biRef != null) {
  2435. + biRef.clear();
  2436. + }
  2437. + }
  2438. + }
  2439. +
  2440. + /**
  2441. + * A version of the painter which uses VolatileImage as the internal buffer.
  2442. + * The window is painted into this VI and then copied into the parent's
  2443. + * Java heap-based buffer (which is then uploaded to the layered window)
  2444. + */
  2445. + private static class VIWindowPainter extends BIWindowPainter {
  2446. + private WeakReference<VolatileImage> viRef;
  2447. +
  2448. + protected VIWindowPainter(WWindowPeer peer) {
  2449. + super(peer);
  2450. + }
  2451. +
  2452. + @Override
  2453. + protected Image getBackBuffer() {
  2454. + int w = window.getWidth();
  2455. + int h = window.getHeight();
  2456. + GraphicsConfiguration gc = peer.getGraphicsConfiguration();
  2457. +
  2458. + VolatileImage viBB = viRef == null ? null : viRef.get();
  2459. +
  2460. + if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
  2461. + viBB.validate(gc) == IMAGE_INCOMPATIBLE)
  2462. + {
  2463. + if (viBB != null) {
  2464. + viBB.flush();
  2465. + viBB = null;
  2466. + }
  2467. +
  2468. + if (gc instanceof AccelGraphicsConfig) {
  2469. + AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
  2470. + viBB = agc.createCompatibleVolatileImage(w, h,
  2471. + TRANSLUCENT,
  2472. + RT_PLAIN);
  2473. + }
  2474. + if (viBB == null) {
  2475. + viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
  2476. + }
  2477. + viBB.validate(gc);
  2478. + viRef = new WeakReference<VolatileImage>(viBB);
  2479. + }
  2480. +
  2481. + return clearImage(viBB);
  2482. + }
  2483. +
  2484. + @Override
  2485. + public void flush() {
  2486. + if (viRef != null) {
  2487. + VolatileImage viBB = viRef.get();
  2488. + if (viBB != null) {
  2489. + viBB.flush();
  2490. + viBB = null;
  2491. + }
  2492. + viRef.clear();
  2493. + }
  2494. + }
  2495. + }
  2496. +
  2497. + /**
  2498. + * Optimized version of hw painter. Uses VolatileImages for the
  2499. + * buffer, and uses an optimized path to pull the data from those into
  2500. + * the layered window, bypassing Java heap-based image.
  2501. + */
  2502. + private abstract static class VIOptWindowPainter extends VIWindowPainter {
  2503. +
  2504. + protected VIOptWindowPainter(WWindowPeer peer) {
  2505. + super(peer);
  2506. + }
  2507. +
  2508. + protected abstract boolean updateWindowAccel(long psdops, int w, int h);
  2509. +
  2510. + @Override
  2511. + protected boolean update(Image bb) {
  2512. + if (bb instanceof DestSurfaceProvider) {
  2513. + Surface s = ((DestSurfaceProvider)bb).getDestSurface();
  2514. + if (s instanceof AccelSurface) {
  2515. + final int w = bb.getWidth(null);
  2516. + final int h = bb.getHeight(null);
  2517. + final boolean arr[] = { false };
  2518. + final AccelSurface as = (AccelSurface)s;
  2519. + RenderQueue rq = as.getContext().getRenderQueue();
  2520. + rq.lock();
  2521. + try {
  2522. + as.getContext().validateContext(as);
  2523. + rq.flushAndInvokeNow(new Runnable() {
  2524. + public void run() {
  2525. + long psdops = as.getNativeOps();
  2526. + arr[0] = updateWindowAccel(psdops, w, h);
  2527. + }
  2528. + });
  2529. + } catch (InvalidPipeException e) {
  2530. + // ignore, false will be returned
  2531. + } finally {
  2532. + rq.unlock();
  2533. + }
  2534. + return arr[0];
  2535. + }
  2536. + }
  2537. + return super.update(bb);
  2538. + }
  2539. + }
  2540. +
  2541. + private static class VIOptD3DWindowPainter extends VIOptWindowPainter {
  2542. +
  2543. + protected VIOptD3DWindowPainter(WWindowPeer peer) {
  2544. + super(peer);
  2545. + }
  2546. +
  2547. + @Override
  2548. + protected boolean updateWindowAccel(long psdops, int w, int h) {
  2549. + // note: this method is executed on the toolkit thread, no sync is
  2550. + // necessary at the native level, and a pointer to peer can be used
  2551. + return sun.java2d.d3d.D3DSurfaceData.
  2552. + updateWindowAccelImpl(psdops, peer.getData(), w, h);
  2553. + }
  2554. + }
  2555. +
  2556. + private static class VIOptWGLWindowPainter extends VIOptWindowPainter {
  2557. +
  2558. + protected VIOptWGLWindowPainter(WWindowPeer peer) {
  2559. + super(peer);
  2560. + }
  2561. +
  2562. + @Override
  2563. + protected boolean updateWindowAccel(long psdops, int w, int h) {
  2564. + // note: part of this method which deals with GDI will be on the
  2565. + // toolkit thread
  2566. + return sun.java2d.opengl.WGLSurfaceData.
  2567. + updateWindowAccelImpl(psdops, peer, w, h);
  2568. + }
  2569. + }
  2570. +}
  2571. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java openjdk/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
  2572. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java 2011-01-20 23:54:43.000000000 +0000
  2573. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java 2011-02-16 01:27:25.012325621 +0000
  2574. @@ -1,5 +1,5 @@
  2575. /*
  2576. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  2577. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  2578. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2579. *
  2580. * This code is free software; you can redistribute it and/or modify it
  2581. @@ -28,6 +28,7 @@
  2582. import java.awt.peer.*;
  2583. import java.lang.ref.WeakReference;
  2584. import java.lang.reflect.Method;
  2585. +import sun.awt.AWTAccessor;
  2586. import sun.awt.ComponentAccessor;
  2587. import sun.awt.SunToolkit;
  2588. import sun.awt.Win32GraphicsDevice;
  2589. @@ -110,16 +111,20 @@
  2590. }
  2591. public void print(Graphics g) {
  2592. - Dimension d = ((Component)target).getSize();
  2593. - if (g instanceof Graphics2D ||
  2594. - g instanceof sun.awt.Graphics2Delegate) {
  2595. - // background color is setup correctly, so just use clearRect
  2596. - g.clearRect(0, 0, d.width, d.height);
  2597. - } else {
  2598. - // emulate clearRect
  2599. - g.setColor(((Component)target).getBackground());
  2600. - g.fillRect(0, 0, d.width, d.height);
  2601. - g.setColor(((Component)target).getForeground());
  2602. + if (!(target instanceof Window) ||
  2603. + AWTAccessor.getWindowAccessor().isOpaque((Window)target))
  2604. + {
  2605. + Dimension d = ((Component)target).getSize();
  2606. + if (g instanceof Graphics2D ||
  2607. + g instanceof sun.awt.Graphics2Delegate) {
  2608. + // background color is setup correctly, so just use clearRect
  2609. + g.clearRect(0, 0, d.width, d.height);
  2610. + } else {
  2611. + // emulate clearRect
  2612. + g.setColor(((Component)target).getBackground());
  2613. + g.fillRect(0, 0, d.width, d.height);
  2614. + g.setColor(((Component)target).getForeground());
  2615. + }
  2616. }
  2617. super.print(g);
  2618. }
  2619. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java openjdk/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
  2620. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java 2011-02-16 00:40:21.000000000 +0000
  2621. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java 2011-02-16 01:27:25.012325621 +0000
  2622. @@ -1,5 +1,5 @@
  2623. /*
  2624. - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
  2625. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  2626. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2627. *
  2628. * This code is free software; you can redistribute it and/or modify it
  2629. @@ -39,21 +39,22 @@
  2630. import java.awt.event.InvocationEvent;
  2631. import java.awt.event.KeyEvent;
  2632. import sun.awt.Win32GraphicsConfig;
  2633. +import sun.awt.Win32GraphicsEnvironment;
  2634. import sun.java2d.InvalidPipeException;
  2635. import sun.java2d.SurfaceData;
  2636. -import sun.java2d.d3d.D3DScreenUpdateManager;
  2637. -import static sun.java2d.d3d.D3DSurfaceData.*;
  2638. import sun.java2d.ScreenUpdateManager;
  2639. +import sun.java2d.d3d.D3DSurfaceData;
  2640. import sun.java2d.opengl.OGLSurfaceData;
  2641. +import sun.java2d.pipe.Region;
  2642. import sun.awt.DisplayChangedListener;
  2643. import sun.awt.PaintEventDispatcher;
  2644. +import sun.awt.SunToolkit;
  2645. import sun.awt.event.IgnorePaintEvent;
  2646. import java.awt.dnd.DropTarget;
  2647. import java.awt.dnd.peer.DropTargetPeer;
  2648. import sun.awt.ComponentAccessor;
  2649. -
  2650. import java.util.logging.*;
  2651. @@ -193,7 +194,7 @@
  2652. cont.invalidate();
  2653. cont.validate();
  2654. - if (surfaceData instanceof D3DWindowSurfaceData ||
  2655. + if (surfaceData instanceof D3DSurfaceData.D3DWindowSurfaceData ||
  2656. surfaceData instanceof OGLSurfaceData)
  2657. {
  2658. // When OGL or D3D is enabled, it is necessary to
  2659. @@ -265,7 +266,7 @@
  2660. int[] pix = createPrintedPixels(0, startY, totalW, h);
  2661. if (pix != null) {
  2662. BufferedImage bim = new BufferedImage(totalW, h,
  2663. - BufferedImage.TYPE_INT_RGB);
  2664. + BufferedImage.TYPE_INT_ARGB);
  2665. bim.setRGB(0, 0, totalW, h, pix, 0, totalW);
  2666. g.drawImage(bim, 0, startY, null);
  2667. bim.flush();
  2668. @@ -902,25 +903,6 @@
  2669. public void setBoundsOperation(int operation) {
  2670. }
  2671. -
  2672. - native void setRectangularShape(int lox, int loy, int hix, int hiy,
  2673. - sun.java2d.pipe.Region region);
  2674. -
  2675. -
  2676. - // REMIND: Temp workaround for issues with using HW acceleration
  2677. - // in the browser on Vista when DWM is enabled.
  2678. - // @return true if the toplevel container is not an EmbeddedFrame or
  2679. - // if this EmbeddedFrame is acceleration capable, false otherwise
  2680. - private static final boolean isContainingTopLevelAccelCapable(Component c) {
  2681. - while (c != null && !(c instanceof WEmbeddedFrame)) {
  2682. - c = c.getParent();
  2683. - }
  2684. - if (c == null) {
  2685. - return true;
  2686. - }
  2687. - return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable();
  2688. - }
  2689. -
  2690. /**
  2691. * Returns whether this component is capable of being hw accelerated.
  2692. * More specifically, whether rendering to this component or a
  2693. @@ -935,28 +917,36 @@
  2694. * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
  2695. */
  2696. public boolean isAccelCapable() {
  2697. - // REMIND: Temp workaround for issues with using HW acceleration
  2698. - // in the browser on Vista when DWM is enabled
  2699. - if (!isContainingTopLevelAccelCapable((Component)target)) {
  2700. - return false;
  2701. - }
  2702. -
  2703. - // REMIND: translucent windows support-related
  2704. -/*
  2705. boolean isTranslucent =
  2706. SunToolkit.isContainingTopLevelTranslucent((Component)target);
  2707. // D3D/OGL and translucent windows interacted poorly in Windows XP;
  2708. // these problems are no longer present in Vista
  2709. return !isTranslucent || Win32GraphicsEnvironment.isVistaOS();
  2710. -*/
  2711. - return true;
  2712. + }
  2713. +
  2714. + native void setRectangularShape(int lox, int loy, int hix, int hiy,
  2715. + Region region);
  2716. +
  2717. +
  2718. + // REMIND: Temp workaround for issues with using HW acceleration
  2719. + // in the browser on Vista when DWM is enabled.
  2720. + // @return true if the toplevel container is not an EmbeddedFrame or
  2721. + // if this EmbeddedFrame is acceleration capable, false otherwise
  2722. + private static final boolean isContainingTopLevelAccelCapable(Component c) {
  2723. + while (c != null && !(c instanceof WEmbeddedFrame)) {
  2724. + c = c.getParent();
  2725. + }
  2726. + if (c == null) {
  2727. + return true;
  2728. + }
  2729. + return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable();
  2730. }
  2731. /**
  2732. * Applies the shape to the native component window.
  2733. * @since 1.7
  2734. */
  2735. - public void applyShape(sun.java2d.pipe.Region shape) {
  2736. + public void applyShape(Region shape) {
  2737. if (shapeLog.isLoggable(Level.FINER)) {
  2738. shapeLog.finer(
  2739. "*** INFO: Setting shape: PEER: " + this
  2740. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java openjdk/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
  2741. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java 2011-01-20 23:54:43.000000000 +0000
  2742. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java 2011-02-16 01:27:25.012325621 +0000
  2743. @@ -1,5 +1,5 @@
  2744. /*
  2745. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  2746. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  2747. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2748. *
  2749. * This code is free software; you can redistribute it and/or modify it
  2750. @@ -244,4 +244,10 @@
  2751. public boolean isRestackSupported() {
  2752. return false;
  2753. }
  2754. +
  2755. + // The effects are not supported for system dialogs.
  2756. + public void applyShape(sun.java2d.pipe.Region shape) {}
  2757. + public void setOpacity(float opacity) {}
  2758. + public void setOpaque(boolean isOpaque) {}
  2759. + public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
  2760. }
  2761. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java openjdk/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
  2762. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java 2011-01-20 23:54:43.000000000 +0000
  2763. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java 2011-02-16 01:27:25.012325621 +0000
  2764. @@ -1,5 +1,5 @@
  2765. /*
  2766. - * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
  2767. + * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
  2768. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2769. *
  2770. * This code is free software; you can redistribute it and/or modify it
  2771. @@ -156,4 +156,10 @@
  2772. public boolean isRestackSupported() {
  2773. return false;
  2774. }
  2775. +
  2776. + // The effects are not supported for system dialogs.
  2777. + public void applyShape(sun.java2d.pipe.Region shape) {}
  2778. + public void setOpacity(float opacity) {}
  2779. + public void setOpaque(boolean isOpaque) {}
  2780. + public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
  2781. }
  2782. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WToolkit.java openjdk/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
  2783. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WToolkit.java 2011-02-16 00:40:21.000000000 +0000
  2784. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WToolkit.java 2011-02-16 01:27:25.012325621 +0000
  2785. @@ -1,5 +1,5 @@
  2786. /*
  2787. - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
  2788. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  2789. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2790. *
  2791. * This code is free software; you can redistribute it and/or modify it
  2792. @@ -966,4 +966,34 @@
  2793. }
  2794. private static native boolean isProtectedMode();
  2795. +
  2796. + @Override
  2797. + public boolean isWindowOpacitySupported() {
  2798. + // supported in Win2K and later
  2799. + return true;
  2800. + }
  2801. +
  2802. + @Override
  2803. + public boolean isWindowShapingSupported() {
  2804. + return true;
  2805. + }
  2806. +
  2807. + @Override
  2808. + public boolean isWindowTranslucencySupported() {
  2809. + // supported in Win2K and later
  2810. + return true;
  2811. + }
  2812. +
  2813. + @Override
  2814. + public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
  2815. + //XXX: worth checking if 8-bit? Anyway, it doesn't hurt.
  2816. + return true;
  2817. + }
  2818. +
  2819. + // On MS Windows one must use the peer.updateWindow() to implement
  2820. + // non-opaque windows.
  2821. + @Override
  2822. + public boolean needUpdateWindow() {
  2823. + return true;
  2824. + }
  2825. }
  2826. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java openjdk/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
  2827. --- openjdk.orig/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java 2011-01-20 23:54:43.000000000 +0000
  2828. +++ openjdk/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java 2011-02-16 01:27:25.012325621 +0000
  2829. @@ -1,5 +1,5 @@
  2830. /*
  2831. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  2832. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  2833. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  2834. *
  2835. * This code is free software; you can redistribute it and/or modify it
  2836. @@ -31,17 +31,15 @@
  2837. import java.beans.*;
  2838. -import java.lang.ref.*;
  2839. import java.lang.reflect.*;
  2840. -import java.security.*;
  2841. -
  2842. import java.util.*;
  2843. import java.util.List;
  2844. import java.util.logging.*;
  2845. import sun.awt.*;
  2846. -import sun.awt.image.*;
  2847. +
  2848. +import sun.java2d.pipe.Region;
  2849. public class WWindowPeer extends WPanelPeer implements WindowPeer {
  2850. @@ -52,6 +50,10 @@
  2851. // extends WWindowPeer, not WDialogPeer
  2852. private WWindowPeer modalBlocker = null;
  2853. + private boolean isOpaque;
  2854. +
  2855. + private volatile TranslucentWindowPainter painter;
  2856. +
  2857. /*
  2858. * A key used for storing a list of active windows in AppContext. The value
  2859. * is a list of windows, sorted by the time of activation: later a window is
  2860. @@ -90,9 +92,18 @@
  2861. l.remove(this);
  2862. }
  2863. }
  2864. +
  2865. // Remove ourself from the Map of DisplayChangeListeners
  2866. GraphicsConfiguration gc = getGraphicsConfiguration();
  2867. ((Win32GraphicsDevice)gc.getDevice()).removeDisplayChangedListener(this);
  2868. +
  2869. + TranslucentWindowPainter currentPainter = painter;
  2870. + if (currentPainter != null) {
  2871. + currentPainter.flush();
  2872. + // don't set the current one to null here; reduces the chances of
  2873. + // MT issues (like NPEs)
  2874. + }
  2875. +
  2876. super.disposeImpl();
  2877. }
  2878. @@ -164,6 +175,10 @@
  2879. }
  2880. updateIconImages();
  2881. +
  2882. + updateShape();
  2883. + updateOpacity();
  2884. + updateOpaque();
  2885. }
  2886. native void createAwtWindow(WComponentPeer parent);
  2887. @@ -197,6 +212,8 @@
  2888. if (((Window)target).isAlwaysOnTopSupported() && alwaysOnTop) {
  2889. setAlwaysOnTop(alwaysOnTop);
  2890. }
  2891. +
  2892. + updateWindow(null);
  2893. }
  2894. // Synchronize the insets members (here & in helper) with actual window
  2895. @@ -279,6 +296,31 @@
  2896. }
  2897. }
  2898. + private void updateShape() {
  2899. + // Shape shape = ((Window)target).getShape();
  2900. + Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
  2901. + if (shape != null) {
  2902. + applyShape(Region.getInstance(shape, null));
  2903. + }
  2904. + }
  2905. +
  2906. + private void updateOpacity() {
  2907. + // float opacity = ((Window)target).getOpacity();
  2908. + float opacity = AWTAccessor.getWindowAccessor().getOpacity((Window)target);
  2909. + if (opacity < 1.0f) {
  2910. + setOpacity(opacity);
  2911. + }
  2912. + }
  2913. +
  2914. + private void updateOpaque() {
  2915. + this.isOpaque = true;
  2916. + // boolean opaque = ((Window)target).isOpaque();
  2917. + boolean opaque = AWTAccessor.getWindowAccessor().isOpaque((Window)target);
  2918. + if (!opaque) {
  2919. + setOpaque(opaque);
  2920. + }
  2921. + }
  2922. +
  2923. native void setMinSize(int width, int height);
  2924. /*
  2925. @@ -531,6 +573,135 @@
  2926. super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op);
  2927. }
  2928. + @Override
  2929. + public void print(Graphics g) {
  2930. + // We assume we print the whole frame,
  2931. + // so we expect no clip was set previously
  2932. + Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
  2933. + if (shape != null) {
  2934. + g.setClip(shape);
  2935. + }
  2936. + super.print(g);
  2937. + }
  2938. +
  2939. + private void replaceSurfaceDataRecursively(Component c) {
  2940. + if (c instanceof Container) {
  2941. + for (Component child : ((Container)c).getComponents()) {
  2942. + replaceSurfaceDataRecursively(child);
  2943. + }
  2944. + }
  2945. + ComponentPeer cp = c.getPeer();
  2946. + if (cp instanceof WComponentPeer) {
  2947. + ((WComponentPeer)cp).replaceSurfaceDataLater();
  2948. + }
  2949. + }
  2950. +
  2951. + private native void setOpacity(int iOpacity);
  2952. +
  2953. + public void setOpacity(float opacity) {
  2954. + if (!((SunToolkit)((Window)target).getToolkit()).
  2955. + isWindowOpacitySupported())
  2956. + {
  2957. + return;
  2958. + }
  2959. +
  2960. + replaceSurfaceDataRecursively((Component)getTarget());
  2961. +
  2962. + final int maxOpacity = 0xff;
  2963. + int iOpacity = (int)(opacity * maxOpacity);
  2964. + if (iOpacity < 0) {
  2965. + iOpacity = 0;
  2966. + }
  2967. + if (iOpacity > maxOpacity) {
  2968. + iOpacity = maxOpacity;
  2969. + }
  2970. +
  2971. + setOpacity(iOpacity);
  2972. + updateWindow(null);
  2973. + }
  2974. +
  2975. + private native void setOpaqueImpl(boolean isOpaque);
  2976. +
  2977. + public void setOpaque(boolean isOpaque) {
  2978. + Window target = (Window)getTarget();
  2979. +
  2980. + SunToolkit sunToolkit = (SunToolkit)target.getToolkit();
  2981. + if (!sunToolkit.isWindowTranslucencySupported() ||
  2982. + !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration()))
  2983. + {
  2984. + return;
  2985. + }
  2986. +
  2987. + boolean opaqueChanged = this.isOpaque != isOpaque;
  2988. + boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
  2989. +
  2990. + if (opaqueChanged && !isVistaOS){
  2991. + // non-Vista OS: only replace the surface data if the opacity
  2992. + // status changed (see WComponentPeer.isAccelCapable() for more)
  2993. + replaceSurfaceDataRecursively(target);
  2994. + }
  2995. +
  2996. + this.isOpaque = isOpaque;
  2997. +
  2998. + setOpaqueImpl(isOpaque);
  2999. +
  3000. + if (opaqueChanged) {
  3001. + if (isOpaque) {
  3002. + TranslucentWindowPainter currentPainter = painter;
  3003. + if (currentPainter != null) {
  3004. + currentPainter.flush();
  3005. + painter = null;
  3006. + }
  3007. + } else {
  3008. + painter = TranslucentWindowPainter.createInstance(this);
  3009. + }
  3010. + }
  3011. +
  3012. + if (opaqueChanged && isVistaOS) {
  3013. + // On Vista: setting the window non-opaque makes the window look
  3014. + // rectangular, though still catching the mouse clicks within
  3015. + // its shape only. To restore the correct visual appearance
  3016. + // of the window (i.e. w/ the correct shape) we have to reset
  3017. + // the shape.
  3018. + Shape shape = AWTAccessor.getWindowAccessor().getShape(target);
  3019. + if (shape != null) {
  3020. + AWTAccessor.getWindowAccessor().setShape(target, shape);
  3021. + }
  3022. + }
  3023. +
  3024. + updateWindow(null);
  3025. + }
  3026. +
  3027. + public native void updateWindowImpl(int[] data, int width, int height);
  3028. +
  3029. + public void updateWindow(BufferedImage backBuffer) {
  3030. + if (isOpaque) {
  3031. + return;
  3032. + }
  3033. +
  3034. + TranslucentWindowPainter currentPainter = painter;
  3035. + if (currentPainter != null) {
  3036. + currentPainter.updateWindow(backBuffer);
  3037. + } else if (log.isLoggable(Level.FINER)) {
  3038. + log.log(Level.FINER,
  3039. + "Translucent window painter is null in updateWindow");
  3040. + }
  3041. + }
  3042. +
  3043. + /**
  3044. + * Paints the Applet Warning into the passed Graphics2D. This method is
  3045. + * called by the TranslucentWindowPainter before updating the layered
  3046. + * window.
  3047. + *
  3048. + * @param g Graphics context to paint the warning to
  3049. + * @param w the width of the area
  3050. + * @param h the height of the area
  3051. + * @see TranslucentWindowPainter
  3052. + */
  3053. + public void paintAppletWarning(Graphics2D g, int w, int h) {
  3054. + // REMIND: the applet warning needs to be painted here
  3055. + }
  3056. +
  3057. /*
  3058. * Static inner class, listens for 'activeWindow' KFM property changes and
  3059. * updates the list of active windows per AppContext, so the latest active
  3060. diff -Nru openjdk.orig/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java openjdk/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
  3061. --- openjdk.orig/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java 2011-02-16 00:40:21.000000000 +0000
  3062. +++ openjdk/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java 2011-02-16 01:27:25.012325621 +0000
  3063. @@ -1,5 +1,5 @@
  3064. /*
  3065. - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
  3066. + * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
  3067. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3068. *
  3069. * This code is free software; you can redistribute it and/or modify it
  3070. @@ -72,9 +72,8 @@
  3071. // the OGL pipeline can render directly to the screen and interfere
  3072. // with layered windows, which is why we don't allow accelerated
  3073. // surfaces in this case
  3074. - if (!peer.isAccelCapable())
  3075. - // REMIND: commented until toplevel translucency is implemented
  3076. -// || !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
  3077. + if (!peer.isAccelCapable() ||
  3078. + !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
  3079. {
  3080. return null;
  3081. }
  3082. @@ -93,9 +92,8 @@
  3083. // the OGL pipeline can render directly to the screen and interfere
  3084. // with layered windows, which is why we don't allow accelerated
  3085. // surfaces in this case
  3086. - if (!peer.isAccelCapable())
  3087. - // REMIND: commented until toplevel translucency is implemented
  3088. -// || !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
  3089. + if (!peer.isAccelCapable() ||
  3090. + !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
  3091. {
  3092. return null;
  3093. }
  3094. diff -Nru openjdk.orig/jdk/src/windows/native/sun/awt/utility/rect.h openjdk/jdk/src/windows/native/sun/awt/utility/rect.h
  3095. --- openjdk.orig/jdk/src/windows/native/sun/awt/utility/rect.h 2011-01-20 23:54:44.000000000 +0000
  3096. +++ openjdk/jdk/src/windows/native/sun/awt/utility/rect.h 2011-02-16 01:27:25.012325621 +0000
  3097. @@ -1,5 +1,5 @@
  3098. /*
  3099. - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
  3100. + * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
  3101. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3102. *
  3103. * This code is free software; you can redistribute it and/or modify it
  3104. @@ -43,5 +43,15 @@
  3105. #define RECT_INC_HEIGHT(r) (r).bottom++
  3106. +#if defined(__cplusplus)
  3107. +extern "C" {
  3108. +#endif
  3109. +
  3110. +int BitmapToYXBandedRectangles(int bitsPerPixel, int width, int height,
  3111. + unsigned char * buf, RECT_T * outBuf);
  3112. +
  3113. +#if defined(__cplusplus)
  3114. +}
  3115. +#endif
  3116. #endif // _AWT_RECT_H
  3117. diff -Nru openjdk.orig/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp openjdk/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
  3118. --- openjdk.orig/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp 2011-02-16 00:40:21.000000000 +0000
  3119. +++ openjdk/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp 2011-02-16 01:27:25.012325621 +0000
  3120. @@ -1,5 +1,5 @@
  3121. /*
  3122. - * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
  3123. + * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
  3124. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3125. *
  3126. * This code is free software; you can redistribute it and/or modify it
  3127. @@ -614,17 +614,15 @@
  3128. res = pTmpSurface->LockRect(&lockedRect, NULL, D3DLOCK_NOSYSLOCK);
  3129. if (SUCCEEDED(res)) {
  3130. - // REMIND: commented until translucent window support is integrated
  3131. -// hBitmap =
  3132. -// BitmapUtil::CreateBitmapFromARGBPre(w, h,
  3133. -// lockedRect.Pitch,
  3134. -// (int*)lockedRect.pBits);
  3135. + hBitmap =
  3136. + BitmapUtil::CreateBitmapFromARGBPre(w, h,
  3137. + lockedRect.Pitch,
  3138. + (int*)lockedRect.pBits);
  3139. pTmpSurface->UnlockRect();
  3140. }
  3141. RETURN_STATUS_IF_NULL(hBitmap, JNI_FALSE);
  3142. - // REMIND: commented until translucent window support is integrated
  3143. -// window->UpdateWindow(env, NULL, w, h, hBitmap);
  3144. + window->UpdateWindow(env, NULL, w, h, hBitmap);
  3145. // hBitmap is released in UpdateWindow
  3146. diff -Nru openjdk.orig/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c openjdk/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c
  3147. --- openjdk.orig/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c 2011-02-16 00:40:21.000000000 +0000
  3148. +++ openjdk/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c 2011-02-16 01:27:25.012325621 +0000
  3149. @@ -1,5 +1,5 @@
  3150. /*
  3151. - * Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
  3152. + * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
  3153. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3154. *
  3155. * This code is free software; you can redistribute it and/or modify it
  3156. @@ -625,17 +625,15 @@
  3157. j2d_glPixelStorei(GL_PACK_ALIGNMENT, 4);
  3158. // the pixels read from the surface are already premultiplied
  3159. - // REMIND: commented until translucent window support is integrated
  3160. -// hBitmap = BitmapUtil_CreateBitmapFromARGBPre(w, h, scanStride,
  3161. -// (int*)pDst);
  3162. + hBitmap = BitmapUtil_CreateBitmapFromARGBPre(w, h, scanStride,
  3163. + (int*)pDst);
  3164. free(pDst);
  3165. if (hBitmap == NULL) {
  3166. return JNI_FALSE;
  3167. }
  3168. - // REMIND: commented until translucent window support is integrated
  3169. - // AwtWindow_UpdateWindow(env, peer, w, h, hBitmap);
  3170. + AwtWindow_UpdateWindow(env, peer, w, h, hBitmap);
  3171. // hBitmap is released in UpdateWindow
  3172. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp openjdk/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp
  3173. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp 2011-01-20 23:54:44.000000000 +0000
  3174. +++ openjdk/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp 2011-02-16 01:27:25.012325621 +0000
  3175. @@ -1,5 +1,5 @@
  3176. /*
  3177. - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
  3178. + * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
  3179. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3180. *
  3181. * This code is free software; you can redistribute it and/or modify it
  3182. @@ -28,9 +28,14 @@
  3183. #include <windowsx.h>
  3184. #include <zmouse.h>
  3185. +#include "GraphicsPrimitiveMgr.h"
  3186. +
  3187. #include "awt.h"
  3188. #include "awt_BitmapUtil.h"
  3189. +// Platform-dependent RECT_[EQ | SET | INC_HEIGHT] macros
  3190. +#include "utility/rect.h"
  3191. +
  3192. HBITMAP BitmapUtil::CreateTransparencyMaskFromARGB(int width, int height, int* imageData)
  3193. {
  3194. //Scan lines should be aligned to word boundary
  3195. @@ -148,3 +153,222 @@
  3196. ::GdiFlush();
  3197. return hBitmap;
  3198. }
  3199. +
  3200. +/*
  3201. + * Creates 32-bit premultiplied ARGB bitmap from specified ARGBPre data.
  3202. + * This function may not work on OS prior to Win95.
  3203. + * See MSDN articles for CreateDIBitmap, BITMAPINFOHEADER,
  3204. + * BITMAPV4HEADER, BITMAPV5HEADER for additional info.
  3205. + */
  3206. +HBITMAP BitmapUtil::CreateBitmapFromARGBPre(int width, int height,
  3207. + int srcStride,
  3208. + int* imageData)
  3209. +{
  3210. + BITMAPINFOHEADER bmi;
  3211. + void *bitmapBits = NULL;
  3212. +
  3213. + ZeroMemory(&bmi, sizeof(bmi));
  3214. + bmi.biSize = sizeof(bmi);
  3215. + bmi.biWidth = width;
  3216. + bmi.biHeight = -height;
  3217. + bmi.biPlanes = 1;
  3218. + bmi.biBitCount = 32;
  3219. + bmi.biCompression = BI_RGB;
  3220. +
  3221. + HBITMAP hBitmap =
  3222. + ::CreateDIBSection(NULL, (BITMAPINFO *) & bmi, DIB_RGB_COLORS,
  3223. + &bitmapBits, NULL, 0);
  3224. +
  3225. + if (!bitmapBits) {
  3226. + return NULL;
  3227. + }
  3228. +
  3229. + int dstStride = width * 4;
  3230. +
  3231. + if (srcStride == dstStride) {
  3232. + memcpy(bitmapBits, (void*)imageData, srcStride * height);
  3233. + } else if (height > 0) {
  3234. + void *pSrcPixels = (void*)imageData;
  3235. + void *pDstPixels = bitmapBits;
  3236. + do {
  3237. + memcpy(pDstPixels, pSrcPixels, dstStride);
  3238. + pSrcPixels = PtrAddBytes(pSrcPixels, srcStride);
  3239. + pDstPixels = PtrAddBytes(pDstPixels, dstStride);
  3240. + } while (--height > 0);
  3241. + }
  3242. +
  3243. + return hBitmap;
  3244. +}
  3245. +
  3246. +extern "C" {
  3247. +
  3248. +/**
  3249. + * This method is called from the WGL pipeline when it needs to create a bitmap
  3250. + * needed to update the layered window.
  3251. + */
  3252. +HBITMAP BitmapUtil_CreateBitmapFromARGBPre(int width, int height,
  3253. + int srcStride,
  3254. + int* imageData)
  3255. +{
  3256. + return BitmapUtil::CreateBitmapFromARGBPre(width, height,
  3257. + srcStride, imageData);
  3258. +
  3259. +}
  3260. +
  3261. +} /* extern "C" */
  3262. +
  3263. +
  3264. +/**
  3265. + * Transforms the given bitmap into an HRGN representing the transparency
  3266. + * of the bitmap. The bitmap MUST BE 32bpp. Alpha value == 0 is considered
  3267. + * transparent, alpha > 0 - opaque.
  3268. + */
  3269. +HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap)
  3270. +{
  3271. + HDC hdc = ::CreateCompatibleDC(NULL);
  3272. + ::SelectObject(hdc, hBitmap);
  3273. +
  3274. + BITMAPINFOEX bi;
  3275. + ::ZeroMemory(&bi, sizeof(bi));
  3276. +
  3277. + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  3278. +
  3279. + BOOL r = ::GetDIBits(hdc, hBitmap, 0, 0, NULL,
  3280. + reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
  3281. +
  3282. + if (!r || bi.bmiHeader.biBitCount != 32)
  3283. + {
  3284. + ::DeleteDC(hdc);
  3285. + return NULL;
  3286. + }
  3287. +
  3288. + UINT width = bi.bmiHeader.biWidth;
  3289. + UINT height = abs(bi.bmiHeader.biHeight);
  3290. +
  3291. + BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
  3292. + bi.bmiHeader.biHeight = -height;
  3293. + ::GetDIBits(hdc, hBitmap, 0, height, buf,
  3294. + reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
  3295. +
  3296. + /* reserving memory for the worst case */
  3297. + RGNDATA * pRgnData = (RGNDATA *) safe_Malloc(sizeof(RGNDATAHEADER) +
  3298. + sizeof(RECT) * (width / 2 + 1) * height);
  3299. + RGNDATAHEADER * pRgnHdr = (RGNDATAHEADER *) pRgnData;
  3300. + pRgnHdr->dwSize = sizeof(RGNDATAHEADER);
  3301. + pRgnHdr->iType = RDH_RECTANGLES;
  3302. + pRgnHdr->nRgnSize = 0;
  3303. + pRgnHdr->rcBound.top = 0;
  3304. + pRgnHdr->rcBound.left = 0;
  3305. + pRgnHdr->rcBound.bottom = height;
  3306. + pRgnHdr->rcBound.right = width;
  3307. +
  3308. + pRgnHdr->nCount = BitmapToYXBandedRectangles(32, width, height, buf,
  3309. + (RECT_T *) (((BYTE *) pRgnData) + sizeof(RGNDATAHEADER)));
  3310. +
  3311. + HRGN rgn = ::ExtCreateRegion(NULL,
  3312. + sizeof(RGNDATAHEADER) + sizeof(RECT_T) * pRgnHdr->nCount,
  3313. + pRgnData);
  3314. +
  3315. + free(pRgnData);
  3316. + ::DeleteDC(hdc);
  3317. + free(buf);
  3318. +
  3319. + return rgn;
  3320. +}
  3321. +
  3322. +/**
  3323. + * Makes a copy of the given bitmap. Blends every pixel of the source
  3324. + * with the given blendColor and alpha. If alpha == 0, the function
  3325. + * simply makes a plain copy of the source without any blending.
  3326. + */
  3327. +HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor,
  3328. + BYTE alpha)
  3329. +{
  3330. + HDC hdc = ::CreateCompatibleDC(NULL);
  3331. + HBITMAP oldBitmap = (HBITMAP)::SelectObject(hdc, hSrcBitmap);
  3332. +
  3333. + BITMAPINFOEX bi;
  3334. + ::ZeroMemory(&bi, sizeof(bi));
  3335. +
  3336. + bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
  3337. +
  3338. + BOOL r = ::GetDIBits(hdc, hSrcBitmap, 0, 0, NULL,
  3339. + reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
  3340. +
  3341. + if (!r || bi.bmiHeader.biBitCount != 32)
  3342. + {
  3343. + ::DeleteDC(hdc);
  3344. + return NULL;
  3345. + }
  3346. +
  3347. + UINT width = bi.bmiHeader.biWidth;
  3348. + UINT height = abs(bi.bmiHeader.biHeight);
  3349. +
  3350. + BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
  3351. + bi.bmiHeader.biHeight = -height;
  3352. + ::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
  3353. + reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
  3354. +
  3355. + UINT widthBytes = width * bi.bmiHeader.biBitCount / 8;
  3356. + UINT alignedWidth = (((widthBytes - 1) / 4) + 1) * 4;
  3357. + UINT i, j;
  3358. +
  3359. + for (j = 0; j < height; j++) {
  3360. + BYTE *pSrc = (BYTE *) buf + j * alignedWidth;
  3361. + for (i = 0; i < width; i++, pSrc += 4) {
  3362. + // Note: if the current alpha is zero, the other three color
  3363. + // components may (theoretically) contain some uninitialized
  3364. + // data. The developer does not expect to display them,
  3365. + // hence we handle this situation differently.
  3366. + if (pSrc[3] == 0) {
  3367. + pSrc[0] = GetBValue(blendColor) * alpha / 255;
  3368. + pSrc[1] = GetGValue(blendColor) * alpha / 255;
  3369. + pSrc[2] = GetRValue(blendColor) * alpha / 255;
  3370. + pSrc[3] = alpha;
  3371. + } else {
  3372. + pSrc[0] = (GetBValue(blendColor) * alpha / 255) +
  3373. + (pSrc[0] * (255 - alpha) / 255);
  3374. + pSrc[1] = (GetGValue(blendColor) * alpha / 255) +
  3375. + (pSrc[1] * (255 - alpha) / 255);
  3376. + pSrc[2] = (GetRValue(blendColor) * alpha / 255) +
  3377. + (pSrc[2] * (255 - alpha) / 255);
  3378. + pSrc[3] = (alpha * alpha / 255) +
  3379. + (pSrc[3] * (255 - alpha) / 255);
  3380. + }
  3381. + }
  3382. + }
  3383. +
  3384. + HBITMAP hDstBitmap = ::CreateDIBitmap(hdc,
  3385. + reinterpret_cast<BITMAPINFOHEADER*>(&bi),
  3386. + CBM_INIT,
  3387. + buf,
  3388. + reinterpret_cast<BITMAPINFO*>(&bi),
  3389. + DIB_RGB_COLORS
  3390. + );
  3391. +
  3392. + ::SelectObject(hdc, oldBitmap);
  3393. + ::DeleteDC(hdc);
  3394. + free(buf);
  3395. +
  3396. + return hDstBitmap;
  3397. +}
  3398. +
  3399. +/**
  3400. + * Creates a 32 bit ARGB bitmap. Returns the bitmap handle. The *bitmapBits
  3401. + * contains the pointer to the bitmap data or NULL if an error occured.
  3402. + */
  3403. +HBITMAP BitmapUtil::CreateARGBBitmap(int width, int height, void ** bitmapBitsPtr)
  3404. +{
  3405. + BITMAPINFOHEADER bmi;
  3406. +
  3407. + ::ZeroMemory(&bmi, sizeof(bmi));
  3408. + bmi.biSize = sizeof(BITMAPINFOHEADER);
  3409. + bmi.biWidth = width;
  3410. + bmi.biHeight = -height;
  3411. + bmi.biPlanes = 1;
  3412. + bmi.biBitCount = 32;
  3413. + bmi.biCompression = BI_RGB;
  3414. +
  3415. + return ::CreateDIBSection(NULL, (BITMAPINFO *) & bmi, DIB_RGB_COLORS,
  3416. + bitmapBitsPtr, NULL, 0);
  3417. +}
  3418. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h openjdk/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h
  3419. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h 2011-01-20 23:54:44.000000000 +0000
  3420. +++ openjdk/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h 2011-02-16 01:27:25.012325621 +0000
  3421. @@ -1,5 +1,5 @@
  3422. /*
  3423. - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
  3424. + * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
  3425. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3426. *
  3427. * This code is free software; you can redistribute it and/or modify it
  3428. @@ -45,6 +45,32 @@
  3429. */
  3430. static HBITMAP CreateV4BitmapFromARGB(int width, int height, int* imageData);
  3431. + /**
  3432. + * Creates 32-bit premultiplied ARGB V4 Bitmap (Win95-compatible) from
  3433. + * specified ARGB Pre input data.
  3434. + */
  3435. + static HBITMAP CreateBitmapFromARGBPre(int width, int height,
  3436. + int srcStride,
  3437. + int* imageData);
  3438. +
  3439. + /**
  3440. + * Transforms the given bitmap into an HRGN representing the transparency
  3441. + * of the bitmap.
  3442. + */
  3443. + static HRGN BitmapToRgn(HBITMAP hBitmap);
  3444. +
  3445. + /**
  3446. + * Makes a copy of the given bitmap. Blends every pixel of the source
  3447. + * with the given blendColor and alpha. If alpha == 0, the function
  3448. + * simply makes a plain copy of the source without any blending.
  3449. + */
  3450. + static HBITMAP BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor, BYTE alpha);
  3451. +
  3452. + /**
  3453. + * Creates a 32 bit ARGB bitmap. Returns the bitmap handle.
  3454. + * The pointer to the bitmap data is stored into bitmapBitsPtr.
  3455. + */
  3456. + static HBITMAP CreateARGBBitmap(int width, int height, void ** bitmapBitsPtr);
  3457. };
  3458. #endif
  3459. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_Component.cpp openjdk/jdk/src/windows/native/sun/windows/awt_Component.cpp
  3460. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_Component.cpp 2011-02-16 00:40:21.000000000 +0000
  3461. +++ openjdk/jdk/src/windows/native/sun/windows/awt_Component.cpp 2011-02-16 01:27:25.012325621 +0000
  3462. @@ -1,5 +1,5 @@
  3463. /*
  3464. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  3465. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  3466. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3467. *
  3468. * This code is free software; you can redistribute it and/or modify it
  3469. @@ -221,9 +221,6 @@
  3470. BOOL AwtComponent::sm_rtlReadingOrder =
  3471. PRIMARYLANGID(GetInputLanguage()) == LANG_ARABIC;
  3472. -UINT AwtComponent::sm_95WheelMessage = WM_NULL;
  3473. -UINT AwtComponent::sm_95WheelSupport = WM_NULL;
  3474. -
  3475. HWND AwtComponent::sm_cursorOn;
  3476. BOOL AwtComponent::m_QueryNewPaletteCalled = FALSE;
  3477. @@ -4700,6 +4697,25 @@
  3478. return hdc;
  3479. }
  3480. +void AwtComponent::FillBackground(HDC hMemoryDC, SIZE &size)
  3481. +{
  3482. + RECT eraseR = { 0, 0, size.cx, size.cy };
  3483. + VERIFY(::FillRect(hMemoryDC, &eraseR, GetBackgroundBrush()));
  3484. +}
  3485. +
  3486. +void AwtComponent::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
  3487. +{
  3488. + if (bitmapBits) {
  3489. + DWORD* dest = (DWORD*)bitmapBits;
  3490. + //XXX: might be optimized to use one loop (cy*cx -> 0).
  3491. + for (int i = 0; i < size.cy; i++ ) {
  3492. + for (int j = 0; j < size.cx; j++ ) {
  3493. + ((BYTE*)(dest++))[3] = alpha;
  3494. + }
  3495. + }
  3496. + }
  3497. +}
  3498. +
  3499. jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
  3500. JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  3501. @@ -6276,15 +6292,12 @@
  3502. AwtComponent *c = NULL;
  3503. -
  3504. -
  3505. PDATA pData;
  3506. JNI_CHECK_PEER_GOTO(self, ret);
  3507. +
  3508. c = (AwtComponent *)pData;
  3509. - if (::IsWindow(c->GetHWnd()))
  3510. - {
  3511. + if (::IsWindow(c->GetHWnd())) {
  3512. HRGN hRgn = NULL;
  3513. -
  3514. if (region || x1 || x2 || y1 || y2) {
  3515. // If all the params are zeros, the shape must be simply reset.
  3516. // Otherwise, convert it into a region.
  3517. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_Component.h openjdk/jdk/src/windows/native/sun/windows/awt_Component.h
  3518. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_Component.h 2011-02-16 00:40:21.000000000 +0000
  3519. +++ openjdk/jdk/src/windows/native/sun/windows/awt_Component.h 2011-02-16 01:27:25.016325311 +0000
  3520. @@ -1,5 +1,5 @@
  3521. /*
  3522. - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
  3523. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  3524. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3525. *
  3526. * This code is free software; you can redistribute it and/or modify it
  3527. @@ -422,9 +422,6 @@
  3528. /* Functions for MouseWheel support on Windows95
  3529. * These should only be called if running on 95
  3530. */
  3531. - static void Wheel95Init();
  3532. - INLINE static UINT Wheel95GetMsg() {return sm_95WheelMessage;}
  3533. - static UINT Wheel95GetScrLines();
  3534. /* Determines whether the component is obscured by another window */
  3535. // Called on Toolkit thread
  3536. @@ -714,9 +711,9 @@
  3537. virtual void SetDragCapture(UINT flags);
  3538. virtual void ReleaseDragCapture(UINT flags);
  3539. - // 95 support for mouse wheel
  3540. - static UINT sm_95WheelMessage;
  3541. - static UINT sm_95WheelSupport;
  3542. + //These functions are overridden in AwtWindow to handle non-opaque windows.
  3543. + virtual void FillBackground(HDC hMemoryDC, SIZE &size);
  3544. + virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
  3545. private:
  3546. BOOL m_bSubclassed;
  3547. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_Window.cpp openjdk/jdk/src/windows/native/sun/windows/awt_Window.cpp
  3548. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_Window.cpp 2011-02-16 00:40:21.000000000 +0000
  3549. +++ openjdk/jdk/src/windows/native/sun/windows/awt_Window.cpp 2011-02-16 01:27:25.016325311 +0000
  3550. @@ -1,5 +1,5 @@
  3551. /*
  3552. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  3553. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  3554. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  3555. *
  3556. * This code is free software; you can redistribute it and/or modify it
  3557. @@ -25,6 +25,8 @@
  3558. #include <windowsx.h>
  3559. +#include <jlong.h>
  3560. +
  3561. #include "awt_Component.h"
  3562. #include "awt_Container.h"
  3563. #include "awt_Frame.h"
  3564. @@ -87,7 +89,6 @@
  3565. jint x, y;
  3566. jint w, h;
  3567. };
  3568. -
  3569. // struct for _SetIconImagesData
  3570. struct SetIconImagesDataStruct {
  3571. jobject window;
  3572. @@ -96,7 +97,6 @@
  3573. jintArray smallIconRaster;
  3574. jint smw, smh;
  3575. };
  3576. -
  3577. // struct for _SetMinSize() method
  3578. // and other methods setting sizes
  3579. struct SizeStruct {
  3580. @@ -113,6 +113,24 @@
  3581. jobject window;
  3582. jlong blockerHWnd;
  3583. };
  3584. +// struct for _SetOpacity() method
  3585. +struct OpacityStruct {
  3586. + jobject window;
  3587. + jint iOpacity;
  3588. +};
  3589. +// struct for _SetOpaque() method
  3590. +struct OpaqueStruct {
  3591. + jobject window;
  3592. + jboolean isOpaque;
  3593. +};
  3594. +// struct for _UpdateWindow() method
  3595. +struct UpdateWindowStruct {
  3596. + jobject window;
  3597. + jintArray data;
  3598. + HBITMAP hBitmap;
  3599. + jint width, height;
  3600. +};
  3601. +
  3602. /************************************************************************
  3603. * AwtWindow fields
  3604. */
  3605. @@ -164,6 +182,11 @@
  3606. ::SetWindowsHookEx(WH_CBT, (HOOKPROC)AwtWindow::CBTFilter,
  3607. 0, AwtToolkit::MainThread());
  3608. }
  3609. +
  3610. + m_opaque = TRUE;
  3611. + m_opacity = 0xff;
  3612. +
  3613. + ::InitializeCriticalSection(&contentBitmapCS);
  3614. }
  3615. AwtWindow::~AwtWindow()
  3616. @@ -1870,6 +1893,216 @@
  3617. //Does nothing for windows, is overriden for frames and dialogs
  3618. }
  3619. +void AwtWindow::RedrawWindow()
  3620. +{
  3621. + if (isOpaque()) {
  3622. + ::RedrawWindow(GetHWnd(), NULL, NULL,
  3623. + RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
  3624. + } else {
  3625. + ::EnterCriticalSection(&contentBitmapCS);
  3626. + if (hContentBitmap != NULL) {
  3627. + UpdateWindowImpl(contentWidth, contentHeight, hContentBitmap);
  3628. + }
  3629. + ::LeaveCriticalSection(&contentBitmapCS);
  3630. + }
  3631. +}
  3632. +
  3633. +void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque)
  3634. +{
  3635. + BYTE old_opacity = getOpacity();
  3636. + BOOL old_opaque = isOpaque();
  3637. +
  3638. + if (opacity == old_opacity && opaque == old_opaque) {
  3639. + return;
  3640. + }
  3641. +
  3642. + setOpacity(opacity);
  3643. + setOpaque(opaque);
  3644. +
  3645. + HWND hwnd = GetHWnd();
  3646. +
  3647. + LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
  3648. +
  3649. + if (opaque != old_opaque) {
  3650. + ::EnterCriticalSection(&contentBitmapCS);
  3651. + if (hContentBitmap != NULL) {
  3652. + ::DeleteObject(hContentBitmap);
  3653. + hContentBitmap = NULL;
  3654. + }
  3655. + ::LeaveCriticalSection(&contentBitmapCS);
  3656. + }
  3657. +
  3658. + if (opaque && opacity == 0xff) {
  3659. + // Turn off all the effects
  3660. + ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED);
  3661. + // Ask the window to repaint itself and all the children
  3662. + RedrawWindow();
  3663. + } else {
  3664. + // We're going to enable some effects
  3665. + if (!(ex_style & WS_EX_LAYERED)) {
  3666. + ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED);
  3667. + } else {
  3668. + if ((opaque && opacity < 0xff) ^ (old_opaque && old_opacity < 0xff)) {
  3669. + // _One_ of the modes uses the SetLayeredWindowAttributes.
  3670. + // Need to reset the style in this case.
  3671. + // If both modes are simple (i.e. just changing the opacity level),
  3672. + // no need to reset the style.
  3673. + ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED);
  3674. + ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED);
  3675. + }
  3676. + }
  3677. +
  3678. + if (opaque) {
  3679. + // Simple opacity mode
  3680. + ::SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), opacity, LWA_ALPHA);
  3681. + }
  3682. + }
  3683. +}
  3684. +
  3685. +static HBITMAP CreateBitmapFromRaster(JNIEnv* env, jintArray raster, jint w, jint h)
  3686. +{
  3687. + HBITMAP image = NULL;
  3688. + if (raster != NULL) {
  3689. + int* rasterBuffer = NULL;
  3690. + try {
  3691. + rasterBuffer = (int *)env->GetPrimitiveArrayCritical(raster, 0);
  3692. + JNI_CHECK_NULL_GOTO(rasterBuffer, "raster data", done);
  3693. + image = BitmapUtil::CreateBitmapFromARGBPre(w, h, w*4, rasterBuffer);
  3694. + } catch (...) {
  3695. + if (rasterBuffer != NULL) {
  3696. + env->ReleasePrimitiveArrayCritical(raster, rasterBuffer, 0);
  3697. + }
  3698. + throw;
  3699. + }
  3700. + if (rasterBuffer != NULL) {
  3701. + env->ReleasePrimitiveArrayCritical(raster, rasterBuffer, 0);
  3702. + }
  3703. + }
  3704. +done:
  3705. + return image;
  3706. +}
  3707. +
  3708. +void AwtWindow::UpdateWindowImpl(int width, int height, HBITMAP hBitmap)
  3709. +{
  3710. + if (isOpaque()) {
  3711. + return;
  3712. + }
  3713. +
  3714. + HWND hWnd = GetHWnd();
  3715. + HDC hdcDst = ::GetDC(NULL);
  3716. + HDC hdcSrc = ::CreateCompatibleDC(NULL);
  3717. + HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hdcSrc, hBitmap);
  3718. +
  3719. + //XXX: this code doesn't paint the children (say, the java.awt.Button)!
  3720. + //So, if we ever want to support HWs here, we need to repaint them
  3721. + //in some other way...
  3722. + //::SendMessage(hWnd, WM_PRINT, (WPARAM)hdcSrc, /*PRF_CHECKVISIBLE |*/
  3723. + // PRF_CHILDREN /*| PRF_CLIENT | PRF_NONCLIENT*/);
  3724. +
  3725. + POINT ptSrc;
  3726. + ptSrc.x = ptSrc.y = 0;
  3727. +
  3728. + RECT rect;
  3729. + POINT ptDst;
  3730. + SIZE size;
  3731. +
  3732. + ::GetWindowRect(hWnd, &rect);
  3733. + ptDst.x = rect.left;
  3734. + ptDst.y = rect.top;
  3735. + size.cx = width;
  3736. + size.cy = height;
  3737. +
  3738. + BLENDFUNCTION bf;
  3739. +
  3740. + bf.SourceConstantAlpha = getOpacity();
  3741. + bf.AlphaFormat = AC_SRC_ALPHA;
  3742. + bf.BlendOp = AC_SRC_OVER;
  3743. + bf.BlendFlags = 0;
  3744. +
  3745. + ::UpdateLayeredWindow(hWnd, hdcDst, &ptDst, &size, hdcSrc, &ptSrc,
  3746. + RGB(0, 0, 0), &bf, ULW_ALPHA);
  3747. +
  3748. + ::ReleaseDC(NULL, hdcDst);
  3749. + ::SelectObject(hdcSrc, hOldBitmap);
  3750. + ::DeleteDC(hdcSrc);
  3751. +}
  3752. +
  3753. +void AwtWindow::UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
  3754. + HBITMAP hNewBitmap)
  3755. +{
  3756. + if (isOpaque()) {
  3757. + return;
  3758. + }
  3759. +
  3760. + HBITMAP hBitmap;
  3761. + if (hNewBitmap == NULL) {
  3762. + if (data == NULL) {
  3763. + return;
  3764. + }
  3765. + hBitmap = CreateBitmapFromRaster(env, data, width, height);
  3766. + if (hBitmap == NULL) {
  3767. + return;
  3768. + }
  3769. + } else {
  3770. + hBitmap = hNewBitmap;
  3771. + }
  3772. +
  3773. + ::EnterCriticalSection(&contentBitmapCS);
  3774. + if (hContentBitmap != NULL) {
  3775. + ::DeleteObject(hContentBitmap);
  3776. + }
  3777. + hContentBitmap = hBitmap;
  3778. + contentWidth = width;
  3779. + contentHeight = height;
  3780. + UpdateWindowImpl(width, height, hBitmap);
  3781. + ::LeaveCriticalSection(&contentBitmapCS);
  3782. +}
  3783. +
  3784. +void AwtWindow::FillBackground(HDC hMemoryDC, SIZE &size)
  3785. +{
  3786. + if (isOpaque()) {
  3787. + AwtCanvas::FillBackground(hMemoryDC, size);
  3788. + }
  3789. +}
  3790. +
  3791. +void AwtWindow::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
  3792. +{
  3793. + if (isOpaque()) {
  3794. + AwtCanvas::FillAlpha(bitmapBits, size, alpha);
  3795. + }
  3796. +}
  3797. +
  3798. +/*
  3799. + * Fixed 6353381: it's improved fix for 4792958
  3800. + * which was backed-out to avoid 5059656
  3801. + */
  3802. +BOOL AwtWindow::HasValidRect()
  3803. +{
  3804. + RECT inside;
  3805. + RECT outside;
  3806. +
  3807. + if (::IsIconic(GetHWnd())) {
  3808. + return FALSE;
  3809. + }
  3810. +
  3811. + ::GetClientRect(GetHWnd(), &inside);
  3812. + ::GetWindowRect(GetHWnd(), &outside);
  3813. +
  3814. + BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
  3815. + BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
  3816. + (outside.left == 32000 && outside.top == 32000) || // Win95 && Win98
  3817. + (outside.left == 3000 && outside.top == 3000)); // Win95 && Win98
  3818. +
  3819. + // the bounds correspond to iconic state
  3820. + if (isZeroClientArea && isInvalidLocation)
  3821. + {
  3822. + return FALSE;
  3823. + }
  3824. +
  3825. + return TRUE;
  3826. +}
  3827. +
  3828. +
  3829. void AwtWindow::_SetIconImagesData(void * param)
  3830. {
  3831. JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  3832. @@ -2042,36 +2275,68 @@
  3833. env->DeleteGlobalRef(self);
  3834. }
  3835. -/*
  3836. - * Fixed 6353381: it's improved fix for 4792958
  3837. - * which was backed-out to avoid 5059656
  3838. - */
  3839. -BOOL AwtWindow::HasValidRect()
  3840. +void AwtWindow::_SetOpacity(void* param)
  3841. {
  3842. - RECT inside;
  3843. - RECT outside;
  3844. + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  3845. - if (::IsIconic(GetHWnd())) {
  3846. - return FALSE;
  3847. - }
  3848. + OpacityStruct *os = (OpacityStruct *)param;
  3849. + jobject self = os->window;
  3850. + BYTE iOpacity = (BYTE)os->iOpacity;
  3851. - ::GetClientRect(GetHWnd(), &inside);
  3852. - ::GetWindowRect(GetHWnd(), &outside);
  3853. + PDATA pData;
  3854. + JNI_CHECK_PEER_GOTO(self, ret);
  3855. + AwtWindow *window = (AwtWindow *)pData;
  3856. - BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
  3857. - BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
  3858. - (outside.left == 32000 && outside.top == 32000) || // Win95 && Win98
  3859. - (outside.left == 3000 && outside.top == 3000)); // Win95 && Win98
  3860. + window->SetTranslucency(iOpacity, window->isOpaque());
  3861. - // the bounds correspond to iconic state
  3862. - if (isZeroClientArea && isInvalidLocation)
  3863. - {
  3864. - return FALSE;
  3865. - }
  3866. + ret:
  3867. + env->DeleteGlobalRef(self);
  3868. + delete os;
  3869. +}
  3870. - return TRUE;
  3871. +void AwtWindow::_SetOpaque(void* param)
  3872. +{
  3873. + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  3874. +
  3875. + OpaqueStruct *os = (OpaqueStruct *)param;
  3876. + jobject self = os->window;
  3877. + BOOL isOpaque = (BOOL)os->isOpaque;
  3878. +
  3879. + PDATA pData;
  3880. + JNI_CHECK_PEER_GOTO(self, ret);
  3881. + AwtWindow *window = (AwtWindow *)pData;
  3882. +
  3883. + window->SetTranslucency(window->getOpacity(), isOpaque);
  3884. +
  3885. + ret:
  3886. + env->DeleteGlobalRef(self);
  3887. + delete os;
  3888. }
  3889. +void AwtWindow::_UpdateWindow(void* param)
  3890. +{
  3891. + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
  3892. +
  3893. + UpdateWindowStruct *uws = (UpdateWindowStruct *)param;
  3894. + jobject self = uws->window;
  3895. + jintArray data = uws->data;
  3896. +
  3897. + PDATA pData;
  3898. + JNI_CHECK_PEER_GOTO(self, ret);
  3899. + AwtWindow *window = (AwtWindow *)pData;
  3900. +
  3901. + window->UpdateWindow(env, data, (int)uws->width, (int)uws->height,
  3902. + uws->hBitmap);
  3903. +
  3904. + ret:
  3905. + env->DeleteGlobalRef(self);
  3906. + if (data != NULL) {
  3907. + env->DeleteGlobalRef(data);
  3908. + }
  3909. + delete uws;
  3910. +}
  3911. +
  3912. +
  3913. extern "C" {
  3914. /*
  3915. @@ -2526,5 +2791,94 @@
  3916. CATCH_BAD_ALLOC;
  3917. }
  3918. +
  3919. +/*
  3920. + * Class: sun_awt_windows_WWindowPeer
  3921. + * Method: setOpacity
  3922. + * Signature: (I)V
  3923. + */
  3924. +JNIEXPORT void JNICALL
  3925. +Java_sun_awt_windows_WWindowPeer_setOpacity(JNIEnv *env, jobject self,
  3926. + jint iOpacity)
  3927. +{
  3928. + TRY;
  3929. +
  3930. + OpacityStruct *os = new OpacityStruct;
  3931. + os->window = env->NewGlobalRef(self);
  3932. + os->iOpacity = iOpacity;
  3933. +
  3934. + AwtToolkit::GetInstance().SyncCall(AwtWindow::_SetOpacity, os);
  3935. + // global refs and mds are deleted in _SetMinSize
  3936. +
  3937. + CATCH_BAD_ALLOC;
  3938. +}
  3939. +
  3940. +/*
  3941. + * Class: sun_awt_windows_WWindowPeer
  3942. + * Method: setOpaqueImpl
  3943. + * Signature: (Z)V
  3944. + */
  3945. +JNIEXPORT void JNICALL
  3946. +Java_sun_awt_windows_WWindowPeer_setOpaqueImpl(JNIEnv *env, jobject self,
  3947. + jboolean isOpaque)
  3948. +{
  3949. + TRY;
  3950. +
  3951. + OpaqueStruct *os = new OpaqueStruct;
  3952. + os->window = env->NewGlobalRef(self);
  3953. + os->isOpaque = isOpaque;
  3954. +
  3955. + AwtToolkit::GetInstance().SyncCall(AwtWindow::_SetOpaque, os);
  3956. + // global refs and mds are deleted in _SetMinSize
  3957. +
  3958. + CATCH_BAD_ALLOC;
  3959. +}
  3960. +
  3961. +/*
  3962. + * Class: sun_awt_windows_WWindowPeer
  3963. + * Method: updateWindowImpl
  3964. + * Signature: ([III)V
  3965. + */
  3966. +JNIEXPORT void JNICALL
  3967. +Java_sun_awt_windows_WWindowPeer_updateWindowImpl(JNIEnv *env, jobject self,
  3968. + jintArray data,
  3969. + jint width, jint height)
  3970. +{
  3971. + TRY;
  3972. +
  3973. + UpdateWindowStruct *uws = new UpdateWindowStruct;
  3974. + uws->window = env->NewGlobalRef(self);
  3975. + uws->data = (jintArray)env->NewGlobalRef(data);
  3976. + uws->hBitmap = NULL;
  3977. + uws->width = width;
  3978. + uws->height = height;
  3979. +
  3980. + AwtToolkit::GetInstance().InvokeFunction(AwtWindow::_UpdateWindow, uws);
  3981. + // global refs and mds are deleted in _UpdateWindow
  3982. +
  3983. + CATCH_BAD_ALLOC;
  3984. +}
  3985. +
  3986. +/**
  3987. + * This method is called from the WGL pipeline when it needs to update
  3988. + * the layered window WindowPeer's C++ level object.
  3989. + */
  3990. +void AwtWindow_UpdateWindow(JNIEnv *env, jobject peer,
  3991. + jint width, jint height, HBITMAP hBitmap)
  3992. +{
  3993. + TRY;
  3994. +
  3995. + UpdateWindowStruct *uws = new UpdateWindowStruct;
  3996. + uws->window = env->NewGlobalRef(peer);
  3997. + uws->data = NULL;
  3998. + uws->hBitmap = hBitmap;
  3999. + uws->width = width;
  4000. + uws->height = height;
  4001. +
  4002. + AwtToolkit::GetInstance().InvokeFunction(AwtWindow::_UpdateWindow, uws);
  4003. + // global refs and mds are deleted in _UpdateWindow
  4004. +
  4005. + CATCH_BAD_ALLOC;
  4006. +}
  4007. } /* extern "C" */
  4008. diff -Nru openjdk.orig/jdk/src/windows/native/sun/windows/awt_Window.h openjdk/jdk/src/windows/native/sun/windows/awt_Window.h
  4009. --- openjdk.orig/jdk/src/windows/native/sun/windows/awt_Window.h 2011-02-16 00:40:21.000000000 +0000
  4010. +++ openjdk/jdk/src/windows/native/sun/windows/awt_Window.h 2011-02-16 01:27:25.016325311 +0000
  4011. @@ -1,5 +1,5 @@
  4012. /*
  4013. - * Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
  4014. + * Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
  4015. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4016. *
  4017. * This code is free software; you can redistribute it and/or modify it
  4018. @@ -188,6 +188,9 @@
  4019. void moveToDefaultLocation(); /* moves Window to X,Y specified by Window Manger */
  4020. + void UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
  4021. + HBITMAP hNewBitmap = NULL);
  4022. +
  4023. INLINE virtual BOOL IsTopLevel() { return TRUE; }
  4024. static AwtWindow * GetGrabbedWindow() { return m_grabbedWindow; }
  4025. @@ -210,6 +213,9 @@
  4026. static void _SetModalExcludedNativeProp(void *param);
  4027. static void _ModalDisable(void *param);
  4028. static void _ModalEnable(void *param);
  4029. + static void _SetOpacity(void* param);
  4030. + static void _SetOpaque(void* param);
  4031. + static void _UpdateWindow(void* param);
  4032. inline static BOOL IsResizing() {
  4033. return sm_resizing;
  4034. @@ -234,6 +240,32 @@
  4035. // from its hierarchy when shown. Currently applied to instances of
  4036. // javax/swing/Popup$HeavyWeightWindow class.
  4037. + BYTE m_opacity; // The opacity level. == 0xff by default (when opacity mode is disabled)
  4038. + BOOL m_opaque; // Whether the window uses the perpixel translucency (false), or not (true).
  4039. +
  4040. + inline BYTE getOpacity() {
  4041. + return m_opacity;
  4042. + }
  4043. + inline void setOpacity(BYTE opacity) {
  4044. + m_opacity = opacity;
  4045. + }
  4046. +
  4047. + inline BOOL isOpaque() {
  4048. + return m_opaque;
  4049. + }
  4050. + inline void setOpaque(BOOL opaque) {
  4051. + m_opaque = opaque;
  4052. + }
  4053. +
  4054. + CRITICAL_SECTION contentBitmapCS;
  4055. + HBITMAP hContentBitmap;
  4056. + UINT contentWidth;
  4057. + UINT contentHeight;
  4058. +
  4059. + void RedrawWindow();
  4060. + void SetTranslucency(BYTE opacity, BOOL opaque);
  4061. + void UpdateWindowImpl(int width, int height, HBITMAP hBitmap);
  4062. +
  4063. protected:
  4064. BOOL m_isResizable;
  4065. static AwtWindow* m_grabbedWindow; // Current grabbing window
  4066. @@ -242,6 +274,10 @@
  4067. BOOL m_iconInherited; /* TRUE if icon is inherited from the owner */
  4068. BOOL m_filterFocusAndActivation; /* Used in the WH_CBT hook */
  4069. + //These are used in AwtComponent::CreatePrintedPixels. They are overridden
  4070. + //here to handle non-opaque windows.
  4071. + virtual void FillBackground(HDC hMemoryDC, SIZE &size);
  4072. + virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
  4073. private:
  4074. int m_screenNum;
  4075. diff -Nru openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java openjdk/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java
  4076. --- openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java 1970-01-01 01:00:00.000000000 +0100
  4077. +++ openjdk/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java 2011-02-16 01:27:25.016325311 +0000
  4078. @@ -0,0 +1,103 @@
  4079. +/*
  4080. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  4081. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4082. + *
  4083. + * This code is free software; you can redistribute it and/or modify it
  4084. + * under the terms of the GNU General Public License version 2 only, as
  4085. + * published by the Free Software Foundation.
  4086. + *
  4087. + * This code is distributed in the hope that it will be useful, but WITHOUT
  4088. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  4089. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  4090. + * version 2 for more details (a copy is included in the LICENSE file that
  4091. + * accompanied this code).
  4092. + *
  4093. + * You should have received a copy of the GNU General Public License version
  4094. + * 2 along with this work; if not, write to the Free Software Foundation,
  4095. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  4096. + *
  4097. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  4098. + * or visit www.oracle.com if you need additional information or have any
  4099. + * questions.
  4100. + */
  4101. +
  4102. +/*
  4103. + * @test %I% %E%
  4104. + * @bug 6683728
  4105. + * @summary Tests that a JApplet in a translucent JFrame works properly
  4106. + * @author Kenneth.Russell@sun.com: area=Graphics
  4107. + * @compile -XDignore.symbol.file=true TranslucentJAppletTest.java
  4108. + * @run main/manual/othervm TranslucentJAppletTest
  4109. + */
  4110. +
  4111. +import java.awt.*;
  4112. +import java.awt.image.*;
  4113. +
  4114. +import javax.swing.*;
  4115. +
  4116. +public class TranslucentJAppletTest {
  4117. +
  4118. + private static JFrame frame;
  4119. + private static volatile boolean paintComponentCalled = false;
  4120. +
  4121. + private static void initAndShowGUI() {
  4122. + frame = new JFrame();
  4123. + JApplet applet = new JApplet();
  4124. + JPanel panel = new JPanel() {
  4125. + protected void paintComponent(Graphics g) {
  4126. + paintComponentCalled = true;
  4127. + g.setColor(Color.RED);
  4128. + g.fillOval(0, 0, getWidth(), getHeight());
  4129. + }
  4130. + };
  4131. + panel.setDoubleBuffered(false);
  4132. + panel.setOpaque(false);
  4133. + applet.add(panel);
  4134. + frame.add(applet);
  4135. + frame.setBounds(100, 100, 200, 200);
  4136. + frame.setUndecorated(true);
  4137. + com.sun.awt.AWTUtilities.setWindowOpaque(frame, false);
  4138. + frame.setVisible(true);
  4139. + }
  4140. +
  4141. + public static void main(String[] args)
  4142. + throws Exception
  4143. + {
  4144. + sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
  4145. +
  4146. + Robot r = new Robot();
  4147. + Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
  4148. +
  4149. + SwingUtilities.invokeAndWait(new Runnable() {
  4150. + public void run() {
  4151. + initAndShowGUI();
  4152. + }
  4153. + });
  4154. + tk.realSync();
  4155. +
  4156. + if (!paintComponentCalled) {
  4157. + throw new RuntimeException("Test FAILED: panel's paintComponent() method is not called");
  4158. + }
  4159. +
  4160. + Color newColor1 = r.getPixelColor(100, 100);
  4161. + // unfortunately, robot.getPixelColor() doesn't work for some unknown reason
  4162. + // Color newColor2 = r.getPixelColor(200, 200);
  4163. + BufferedImage bim = r.createScreenCapture(new Rectangle(200, 200, 1, 1));
  4164. + Color newColor2 = new Color(bim.getRGB(0, 0));
  4165. +
  4166. + // Frame must be transparent at (100, 100) in screen coords
  4167. + if (!color1.equals(newColor1)) {
  4168. + System.err.println("color1 = " + color1);
  4169. + System.err.println("newColor1 = " + newColor1);
  4170. + throw new RuntimeException("Test FAILED: frame pixel at (0, 0) is not transparent");
  4171. + }
  4172. +
  4173. + // Frame must be RED at (200, 200) in screen coords
  4174. + if (!newColor2.equals(Color.RED)) {
  4175. + System.err.println("newColor2 = " + newColor2);
  4176. + throw new RuntimeException("Test FAILED: frame pixel at (100, 100) is not red (transparent?)");
  4177. + }
  4178. +
  4179. + System.out.println("Test PASSED");
  4180. + }
  4181. +}
  4182. diff -Nru openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form
  4183. --- openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form 1970-01-01 01:00:00.000000000 +0100
  4184. +++ openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form 2011-02-16 01:27:25.016325311 +0000
  4185. @@ -0,0 +1,230 @@
  4186. +<?xml version="1.0" encoding="UTF-8" ?>
  4187. +
  4188. +<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
  4189. + <NonVisualComponents>
  4190. + <Component class="javax.swing.ButtonGroup" name="createDisposeGrp">
  4191. + </Component>
  4192. + </NonVisualComponents>
  4193. + <Properties>
  4194. + <Property name="defaultCloseOperation" type="int" value="3"/>
  4195. + <Property name="title" type="java.lang.String" value="TranslucentShapedFrameTest"/>
  4196. + </Properties>
  4197. + <SyntheticProperties>
  4198. + <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
  4199. + </SyntheticProperties>
  4200. + <AuxValues>
  4201. + <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
  4202. + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
  4203. + <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
  4204. + <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
  4205. + <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
  4206. + <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
  4207. + </AuxValues>
  4208. +
  4209. + <Layout>
  4210. + <DimensionLayout dim="0">
  4211. + <Group type="103" groupAlignment="0" attributes="0">
  4212. + <Group type="102" attributes="0">
  4213. + <EmptySpace max="-2" attributes="0"/>
  4214. + <Group type="103" groupAlignment="0" attributes="0">
  4215. + <Group type="102" alignment="0" attributes="0">
  4216. + <Component id="transparencySld" pref="375" max="32767" attributes="0"/>
  4217. + <EmptySpace max="-2" attributes="0"/>
  4218. + </Group>
  4219. + <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
  4220. + <Group type="102" alignment="0" attributes="0">
  4221. + <Component id="shapedCb" min="-2" max="-2" attributes="0"/>
  4222. + <EmptySpace max="-2" attributes="0"/>
  4223. + <Component id="nonOpaqueChb" min="-2" max="-2" attributes="0"/>
  4224. + <EmptySpace max="-2" attributes="0"/>
  4225. + <Component id="useSwingCb" min="-2" max="-2" attributes="0"/>
  4226. + <EmptySpace pref="102" max="32767" attributes="0"/>
  4227. + </Group>
  4228. + <Group type="102" alignment="0" attributes="0">
  4229. + <Group type="103" groupAlignment="0" attributes="0">
  4230. + <Group type="102" alignment="0" attributes="0">
  4231. + <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
  4232. + <EmptySpace pref="314" max="-2" attributes="0"/>
  4233. + </Group>
  4234. + <Group type="102" alignment="0" attributes="0">
  4235. + <Component id="passedBtn" min="-2" max="-2" attributes="0"/>
  4236. + <EmptySpace max="-2" attributes="0"/>
  4237. + <Component id="failedBtn" min="-2" max="-2" attributes="0"/>
  4238. + <EmptySpace pref="241" max="-2" attributes="0"/>
  4239. + </Group>
  4240. + <Component id="jScrollPane1" alignment="1" pref="375" max="32767" attributes="0"/>
  4241. + <Group type="102" alignment="0" attributes="0">
  4242. + <Component id="createFrameBtn" min="-2" pref="187" max="-2" attributes="0"/>
  4243. + <EmptySpace max="-2" attributes="0"/>
  4244. + <Component id="disposeFrameBtn" min="-2" pref="182" max="-2" attributes="0"/>
  4245. + </Group>
  4246. + </Group>
  4247. + <EmptySpace max="-2" attributes="0"/>
  4248. + </Group>
  4249. + </Group>
  4250. + </Group>
  4251. + </Group>
  4252. + </DimensionLayout>
  4253. + <DimensionLayout dim="1">
  4254. + <Group type="103" groupAlignment="0" attributes="0">
  4255. + <Group type="102" alignment="0" attributes="0">
  4256. + <EmptySpace max="-2" attributes="0"/>
  4257. + <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
  4258. + <EmptySpace max="-2" attributes="0"/>
  4259. + <Component id="transparencySld" min="-2" max="-2" attributes="0"/>
  4260. + <EmptySpace max="-2" attributes="0"/>
  4261. + <Group type="103" groupAlignment="3" attributes="0">
  4262. + <Component id="shapedCb" alignment="3" min="-2" max="-2" attributes="0"/>
  4263. + <Component id="nonOpaqueChb" alignment="3" min="-2" max="-2" attributes="0"/>
  4264. + <Component id="useSwingCb" alignment="3" min="-2" max="-2" attributes="0"/>
  4265. + </Group>
  4266. + <EmptySpace max="-2" attributes="0"/>
  4267. + <Group type="103" groupAlignment="3" attributes="0">
  4268. + <Component id="disposeFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
  4269. + <Component id="createFrameBtn" alignment="3" min="-2" max="-2" attributes="0"/>
  4270. + </Group>
  4271. + <EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
  4272. + <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
  4273. + <EmptySpace max="-2" attributes="0"/>
  4274. + <Component id="jScrollPane1" min="-2" pref="148" max="-2" attributes="0"/>
  4275. + <EmptySpace max="-2" attributes="0"/>
  4276. + <Group type="103" groupAlignment="3" attributes="0">
  4277. + <Component id="passedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
  4278. + <Component id="failedBtn" alignment="3" min="-2" max="-2" attributes="0"/>
  4279. + </Group>
  4280. + <EmptySpace max="32767" attributes="0"/>
  4281. + </Group>
  4282. + </Group>
  4283. + </DimensionLayout>
  4284. + </Layout>
  4285. + <SubComponents>
  4286. + <Component class="javax.swing.JLabel" name="jLabel1">
  4287. + <Properties>
  4288. + <Property name="text" type="java.lang.String" value="Frame Opacity:"/>
  4289. + </Properties>
  4290. + </Component>
  4291. + <Component class="javax.swing.JSlider" name="transparencySld">
  4292. + <Properties>
  4293. + <Property name="majorTickSpacing" type="int" value="10"/>
  4294. + <Property name="minorTickSpacing" type="int" value="5"/>
  4295. + <Property name="paintLabels" type="boolean" value="true"/>
  4296. + <Property name="paintTicks" type="boolean" value="true"/>
  4297. + <Property name="value" type="int" value="100"/>
  4298. + </Properties>
  4299. + <Events>
  4300. + <EventHandler event="stateChanged" listener="javax.swing.event.ChangeListener" parameters="javax.swing.event.ChangeEvent" handler="transparencySldStateChanged"/>
  4301. + </Events>
  4302. + </Component>
  4303. + <Component class="javax.swing.JCheckBox" name="shapedCb">
  4304. + <Properties>
  4305. + <Property name="text" type="java.lang.String" value="Shaped Frame"/>
  4306. + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  4307. + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
  4308. + <EmptyBorder bottom="0" left="0" right="0" top="0"/>
  4309. + </Border>
  4310. + </Property>
  4311. + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
  4312. + <Insets value="[0, 0, 0, 0]"/>
  4313. + </Property>
  4314. + </Properties>
  4315. + <Events>
  4316. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="shapedCbActionPerformed"/>
  4317. + </Events>
  4318. + </Component>
  4319. + <Component class="javax.swing.JCheckBox" name="nonOpaqueChb">
  4320. + <Properties>
  4321. + <Property name="text" type="java.lang.String" value="Non Opaque Frame"/>
  4322. + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  4323. + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
  4324. + <EmptyBorder bottom="0" left="0" right="0" top="0"/>
  4325. + </Border>
  4326. + </Property>
  4327. + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
  4328. + <Insets value="[0, 0, 0, 0]"/>
  4329. + </Property>
  4330. + </Properties>
  4331. + <Events>
  4332. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nonOpaqueChbActionPerformed"/>
  4333. + </Events>
  4334. + </Component>
  4335. + <Container class="javax.swing.JScrollPane" name="jScrollPane1">
  4336. + <AuxValues>
  4337. + <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
  4338. + </AuxValues>
  4339. +
  4340. + <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
  4341. + <SubComponents>
  4342. + <Component class="javax.swing.JTextArea" name="jTextArea1">
  4343. + <Properties>
  4344. + <Property name="columns" type="int" value="20"/>
  4345. + <Property name="rows" type="int" value="5"/>
  4346. + <Property name="text" type="java.lang.String" value="Create translucent and/or shaped, or&#xa;non-opaque frame. Make sure it behaves&#xa;correctly (no artifacts left on the screen&#xa;when dragging - if dragging is possible).&#xa;Click &quot;Passed&quot; if the test behaves correctly,&#xa;&quot;Falied&quot; otherwise."/>
  4347. + </Properties>
  4348. + </Component>
  4349. + </SubComponents>
  4350. + </Container>
  4351. + <Component class="javax.swing.JLabel" name="jLabel2">
  4352. + <Properties>
  4353. + <Property name="text" type="java.lang.String" value="Instructions:"/>
  4354. + </Properties>
  4355. + </Component>
  4356. + <Component class="javax.swing.JButton" name="passedBtn">
  4357. + <Properties>
  4358. + <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
  4359. + <Color blue="64" green="ff" red="81" type="rgb"/>
  4360. + </Property>
  4361. + <Property name="text" type="java.lang.String" value="Passed"/>
  4362. + </Properties>
  4363. + <Events>
  4364. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="passedBtnActionPerformed"/>
  4365. + </Events>
  4366. + </Component>
  4367. + <Component class="javax.swing.JButton" name="failedBtn">
  4368. + <Properties>
  4369. + <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
  4370. + <Color blue="0" green="0" id="red" palette="1" red="ff" type="palette"/>
  4371. + </Property>
  4372. + <Property name="text" type="java.lang.String" value="Failed"/>
  4373. + </Properties>
  4374. + <Events>
  4375. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="failedBtnActionPerformed"/>
  4376. + </Events>
  4377. + </Component>
  4378. + <Component class="javax.swing.JToggleButton" name="createFrameBtn">
  4379. + <Properties>
  4380. + <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
  4381. + <ComponentRef name="createDisposeGrp"/>
  4382. + </Property>
  4383. + <Property name="text" type="java.lang.String" value="Create Frame"/>
  4384. + </Properties>
  4385. + <Events>
  4386. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createFrameBtnActionPerformed"/>
  4387. + </Events>
  4388. + </Component>
  4389. + <Component class="javax.swing.JToggleButton" name="disposeFrameBtn">
  4390. + <Properties>
  4391. + <Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
  4392. + <ComponentRef name="createDisposeGrp"/>
  4393. + </Property>
  4394. + <Property name="selected" type="boolean" value="true"/>
  4395. + <Property name="text" type="java.lang.String" value="Dispose Frame"/>
  4396. + </Properties>
  4397. + <Events>
  4398. + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="disposeFrameBtnActionPerformed"/>
  4399. + </Events>
  4400. + </Component>
  4401. + <Component class="javax.swing.JCheckBox" name="useSwingCb">
  4402. + <Properties>
  4403. + <Property name="text" type="java.lang.String" value="Use JFrame"/>
  4404. + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  4405. + <Border info="org.netbeans.modules.form.compat2.border.EmptyBorderInfo">
  4406. + <EmptyBorder bottom="0" left="0" right="0" top="0"/>
  4407. + </Border>
  4408. + </Property>
  4409. + <Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
  4410. + <Insets value="[0, 0, 0, 0]"/>
  4411. + </Property>
  4412. + </Properties>
  4413. + </Component>
  4414. + </SubComponents>
  4415. +</Form>
  4416. diff -Nru openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java
  4417. --- openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java 1970-01-01 01:00:00.000000000 +0100
  4418. +++ openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java 2011-02-16 01:27:25.016325311 +0000
  4419. @@ -0,0 +1,359 @@
  4420. +/*
  4421. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  4422. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4423. + *
  4424. + * This code is free software; you can redistribute it and/or modify it
  4425. + * under the terms of the GNU General Public License version 2 only, as
  4426. + * published by the Free Software Foundation. Oracle designates this
  4427. + * particular file as subject to the "Classpath" exception as provided
  4428. + * by Oracle in the LICENSE file that accompanied this code.
  4429. + *
  4430. + * This code is distributed in the hope that it will be useful, but WITHOUT
  4431. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  4432. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  4433. + * version 2 for more details (a copy is included in the LICENSE file that
  4434. + * accompanied this code).
  4435. + *
  4436. + * You should have received a copy of the GNU General Public License version
  4437. + * 2 along with this work; if not, write to the Free Software Foundation,
  4438. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  4439. + *
  4440. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  4441. + * or visit www.oracle.com if you need additional information or have any
  4442. + * questions.
  4443. + */
  4444. +
  4445. +/*
  4446. + * @test %I% %E%
  4447. + * @bug 6655001 6670649 6687141
  4448. + * @summary Tests that hw acceleration doesn't affect translucent/shaped windows
  4449. + * @author Dmitri.Trembovetski@sun.com: area=Graphics
  4450. + * @compile -XDignore.symbol.file=true TranslucentShapedFrameTest.java
  4451. + * @compile -XDignore.symbol.file=true TSFrame.java
  4452. + * @run main/manual/othervm TranslucentShapedFrameTest
  4453. + * @run main/manual/othervm -Dsun.java2d.noddraw=true TranslucentShapedFrameTest
  4454. + * @run main/manual/othervm -Dsun.java2d.opengl=True TranslucentShapedFrameTest
  4455. + */
  4456. +import com.sun.awt.AWTUtilities;
  4457. +import static com.sun.awt.AWTUtilities.Translucency.*;
  4458. +import java.awt.Frame;
  4459. +import java.awt.GraphicsConfiguration;
  4460. +import java.awt.GraphicsDevice;
  4461. +import java.awt.GraphicsEnvironment;
  4462. +import java.awt.Shape;
  4463. +import java.awt.geom.Ellipse2D;
  4464. +import java.util.concurrent.CountDownLatch;
  4465. +import javax.swing.JSlider;
  4466. +import javax.swing.SwingUtilities;
  4467. +import javax.swing.UIManager;
  4468. +import javax.swing.UnsupportedLookAndFeelException;
  4469. +
  4470. +public class TranslucentShapedFrameTest extends javax.swing.JFrame {
  4471. + Frame testFrame;
  4472. + static CountDownLatch done;
  4473. + static volatile boolean failed = false;
  4474. + GraphicsConfiguration gcToUse = null;
  4475. +
  4476. + /**
  4477. + * Creates new form TranslucentShapedFrameTest
  4478. + */
  4479. + public TranslucentShapedFrameTest() {
  4480. + // not necessary, but we just look nicer
  4481. + try {
  4482. + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  4483. + } catch (Exception ex) {}
  4484. +
  4485. + initComponents();
  4486. + checkEffects();
  4487. +
  4488. + SwingUtilities.updateComponentTreeUI(this);
  4489. + }
  4490. +
  4491. + /** This method is called from within the constructor to
  4492. + * initialize the form.
  4493. + * WARNING: Do NOT modify this code. The content of this method is
  4494. + * always regenerated by the Form Editor.
  4495. + */
  4496. + // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
  4497. + private void initComponents() {
  4498. + createDisposeGrp = new javax.swing.ButtonGroup();
  4499. + jLabel1 = new javax.swing.JLabel();
  4500. + transparencySld = new javax.swing.JSlider();
  4501. + shapedCb = new javax.swing.JCheckBox();
  4502. + nonOpaqueChb = new javax.swing.JCheckBox();
  4503. + jScrollPane1 = new javax.swing.JScrollPane();
  4504. + jTextArea1 = new javax.swing.JTextArea();
  4505. + jLabel2 = new javax.swing.JLabel();
  4506. + passedBtn = new javax.swing.JButton();
  4507. + failedBtn = new javax.swing.JButton();
  4508. + createFrameBtn = new javax.swing.JToggleButton();
  4509. + disposeFrameBtn = new javax.swing.JToggleButton();
  4510. + useSwingCb = new javax.swing.JCheckBox();
  4511. +
  4512. + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  4513. + setTitle("TranslucentShapedFrameTest");
  4514. + jLabel1.setText("Frame Opacity:");
  4515. +
  4516. + transparencySld.setMajorTickSpacing(10);
  4517. + transparencySld.setMinorTickSpacing(5);
  4518. + transparencySld.setPaintLabels(true);
  4519. + transparencySld.setPaintTicks(true);
  4520. + transparencySld.setValue(100);
  4521. + transparencySld.addChangeListener(new javax.swing.event.ChangeListener() {
  4522. + public void stateChanged(javax.swing.event.ChangeEvent evt) {
  4523. + transparencySldStateChanged(evt);
  4524. + }
  4525. + });
  4526. +
  4527. + shapedCb.setText("Shaped Frame");
  4528. + shapedCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
  4529. + shapedCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
  4530. + shapedCb.addActionListener(new java.awt.event.ActionListener() {
  4531. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4532. + shapedCbActionPerformed(evt);
  4533. + }
  4534. + });
  4535. +
  4536. + nonOpaqueChb.setText("Non Opaque Frame");
  4537. + nonOpaqueChb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
  4538. + nonOpaqueChb.setMargin(new java.awt.Insets(0, 0, 0, 0));
  4539. + nonOpaqueChb.addActionListener(new java.awt.event.ActionListener() {
  4540. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4541. + nonOpaqueChbActionPerformed(evt);
  4542. + }
  4543. + });
  4544. +
  4545. + jTextArea1.setColumns(20);
  4546. + jTextArea1.setRows(5);
  4547. + jTextArea1.setText("Create translucent and/or shaped, or\nnon-opaque frame. Make sure it behaves\ncorrectly (no artifacts left on the screen\nwhen dragging - if dragging is possible).\nClick \"Passed\" if the test behaves correctly,\n\"Falied\" otherwise.");
  4548. + jScrollPane1.setViewportView(jTextArea1);
  4549. +
  4550. + jLabel2.setText("Instructions:");
  4551. +
  4552. + passedBtn.setBackground(new java.awt.Color(129, 255, 100));
  4553. + passedBtn.setText("Passed");
  4554. + passedBtn.addActionListener(new java.awt.event.ActionListener() {
  4555. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4556. + passedBtnActionPerformed(evt);
  4557. + }
  4558. + });
  4559. +
  4560. + failedBtn.setBackground(java.awt.Color.red);
  4561. + failedBtn.setText("Failed");
  4562. + failedBtn.addActionListener(new java.awt.event.ActionListener() {
  4563. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4564. + failedBtnActionPerformed(evt);
  4565. + }
  4566. + });
  4567. +
  4568. + createDisposeGrp.add(createFrameBtn);
  4569. + createFrameBtn.setText("Create Frame");
  4570. + createFrameBtn.addActionListener(new java.awt.event.ActionListener() {
  4571. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4572. + createFrameBtnActionPerformed(evt);
  4573. + }
  4574. + });
  4575. +
  4576. + createDisposeGrp.add(disposeFrameBtn);
  4577. + disposeFrameBtn.setSelected(true);
  4578. + disposeFrameBtn.setText("Dispose Frame");
  4579. + disposeFrameBtn.addActionListener(new java.awt.event.ActionListener() {
  4580. + public void actionPerformed(java.awt.event.ActionEvent evt) {
  4581. + disposeFrameBtnActionPerformed(evt);
  4582. + }
  4583. + });
  4584. +
  4585. + useSwingCb.setText("Use JFrame");
  4586. + useSwingCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
  4587. + useSwingCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
  4588. +
  4589. + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  4590. + getContentPane().setLayout(layout);
  4591. + layout.setHorizontalGroup(
  4592. + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  4593. + .addGroup(layout.createSequentialGroup()
  4594. + .addContainerGap()
  4595. + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  4596. + .addGroup(layout.createSequentialGroup()
  4597. + .addComponent(transparencySld, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
  4598. + .addContainerGap())
  4599. + .addComponent(jLabel1)
  4600. + .addGroup(layout.createSequentialGroup()
  4601. + .addComponent(shapedCb)
  4602. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4603. + .addComponent(nonOpaqueChb)
  4604. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4605. + .addComponent(useSwingCb)
  4606. + .addContainerGap(102, Short.MAX_VALUE))
  4607. + .addGroup(layout.createSequentialGroup()
  4608. + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  4609. + .addGroup(layout.createSequentialGroup()
  4610. + .addComponent(jLabel2)
  4611. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 314, javax.swing.GroupLayout.PREFERRED_SIZE))
  4612. + .addGroup(layout.createSequentialGroup()
  4613. + .addComponent(passedBtn)
  4614. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4615. + .addComponent(failedBtn)
  4616. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
  4617. + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
  4618. + .addGroup(layout.createSequentialGroup()
  4619. + .addComponent(createFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
  4620. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4621. + .addComponent(disposeFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
  4622. + .addContainerGap())))
  4623. + );
  4624. + layout.setVerticalGroup(
  4625. + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  4626. + .addGroup(layout.createSequentialGroup()
  4627. + .addContainerGap()
  4628. + .addComponent(jLabel1)
  4629. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4630. + .addComponent(transparencySld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  4631. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4632. + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  4633. + .addComponent(shapedCb)
  4634. + .addComponent(nonOpaqueChb)
  4635. + .addComponent(useSwingCb))
  4636. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4637. + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  4638. + .addComponent(disposeFrameBtn)
  4639. + .addComponent(createFrameBtn))
  4640. + .addGap(17, 17, 17)
  4641. + .addComponent(jLabel2)
  4642. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4643. + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
  4644. + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  4645. + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  4646. + .addComponent(passedBtn)
  4647. + .addComponent(failedBtn))
  4648. + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  4649. + );
  4650. + pack();
  4651. + }// </editor-fold>//GEN-END:initComponents
  4652. +
  4653. + private void nonOpaqueChbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nonOpaqueChbActionPerformed
  4654. + if (testFrame != null) {
  4655. + // REMIND: this path in the test doesn't work well (test bug)
  4656. +// AWTUtilities.setWindowOpaque(testFrame, !nonOpaqueChb.isSelected());
  4657. + }
  4658. + }//GEN-LAST:event_nonOpaqueChbActionPerformed
  4659. +
  4660. + private void shapedCbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shapedCbActionPerformed
  4661. + if (testFrame != null) {
  4662. + Shape s = null;
  4663. + if (shapedCb.isSelected()) {
  4664. + s = new Ellipse2D.Double(0, 0,
  4665. + testFrame.getWidth(),
  4666. + testFrame.getHeight());
  4667. + }
  4668. + AWTUtilities.setWindowShape(testFrame, s);
  4669. + }
  4670. + }//GEN-LAST:event_shapedCbActionPerformed
  4671. +
  4672. + private void transparencySldStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_transparencySldStateChanged
  4673. + JSlider source = (JSlider)evt.getSource();
  4674. + int transl = transparencySld.getValue();
  4675. + if (testFrame != null) {
  4676. + AWTUtilities.setWindowOpacity(testFrame, (float)transl/100f);
  4677. + }
  4678. + }//GEN-LAST:event_transparencySldStateChanged
  4679. +
  4680. + private void failedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_failedBtnActionPerformed
  4681. + disposeFrameBtnActionPerformed(evt);
  4682. + dispose();
  4683. + failed = true;
  4684. + done.countDown();
  4685. + }//GEN-LAST:event_failedBtnActionPerformed
  4686. +
  4687. + private void disposeFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disposeFrameBtnActionPerformed
  4688. + TSFrame.stopThreads();
  4689. + if (testFrame != null) {
  4690. + testFrame.dispose();
  4691. + testFrame = null;
  4692. + }
  4693. + }//GEN-LAST:event_disposeFrameBtnActionPerformed
  4694. +
  4695. + private void createFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createFrameBtnActionPerformed
  4696. + disposeFrameBtnActionPerformed(evt);
  4697. + int transl = transparencySld.getValue();
  4698. + testFrame = TSFrame.createGui(gcToUse,
  4699. + useSwingCb.isSelected(), shapedCb.isSelected(),
  4700. + (transl < 100), nonOpaqueChb.isSelected(),
  4701. + (float)transl/100f);
  4702. + }//GEN-LAST:event_createFrameBtnActionPerformed
  4703. +
  4704. + private void passedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passedBtnActionPerformed
  4705. + disposeFrameBtnActionPerformed(evt);
  4706. + dispose();
  4707. + done.countDown();
  4708. + }//GEN-LAST:event_passedBtnActionPerformed
  4709. +
  4710. + /**
  4711. + * @param args the command line arguments
  4712. + */
  4713. + public static void main(String args[]) {
  4714. + done = new CountDownLatch(1);
  4715. + java.awt.EventQueue.invokeLater(new Runnable() {
  4716. + public void run() {
  4717. + new TranslucentShapedFrameTest().setVisible(true);
  4718. + }
  4719. + });
  4720. + try {
  4721. + done.await();
  4722. + } catch (InterruptedException ex) {}
  4723. + if (failed) {
  4724. + throw new RuntimeException("Test FAILED");
  4725. + }
  4726. + System.out.println("Test PASSED");
  4727. + }
  4728. +
  4729. + private void checkEffects() {
  4730. + if (!AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
  4731. + shapedCb.setEnabled(false);
  4732. + }
  4733. +
  4734. + if (!AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
  4735. + transparencySld.setEnabled(false);
  4736. + }
  4737. +
  4738. + GraphicsConfiguration gc = null;
  4739. + if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
  4740. + gc = findGraphicsConfig();
  4741. + if (gc == null) {
  4742. + nonOpaqueChb.setEnabled(false);
  4743. + }
  4744. + }
  4745. +
  4746. + gcToUse = gc;
  4747. + }
  4748. +
  4749. + private GraphicsConfiguration findGraphicsConfig() {
  4750. + GraphicsDevice gd =
  4751. + GraphicsEnvironment.getLocalGraphicsEnvironment().
  4752. + getDefaultScreenDevice();
  4753. + GraphicsConfiguration gcs[] = gd.getConfigurations();
  4754. + for (GraphicsConfiguration gc : gcs) {
  4755. + if (AWTUtilities.isTranslucencyCapable(gc)) {
  4756. + return gc;
  4757. + }
  4758. + }
  4759. + return null;
  4760. + }
  4761. +
  4762. + // Variables declaration - do not modify//GEN-BEGIN:variables
  4763. + private javax.swing.ButtonGroup createDisposeGrp;
  4764. + private javax.swing.JToggleButton createFrameBtn;
  4765. + private javax.swing.JToggleButton disposeFrameBtn;
  4766. + private javax.swing.JButton failedBtn;
  4767. + private javax.swing.JLabel jLabel1;
  4768. + private javax.swing.JLabel jLabel2;
  4769. + private javax.swing.JScrollPane jScrollPane1;
  4770. + private javax.swing.JTextArea jTextArea1;
  4771. + private javax.swing.JCheckBox nonOpaqueChb;
  4772. + private javax.swing.JButton passedBtn;
  4773. + private javax.swing.JCheckBox shapedCb;
  4774. + private javax.swing.JSlider transparencySld;
  4775. + private javax.swing.JCheckBox useSwingCb;
  4776. + // End of variables declaration//GEN-END:variables
  4777. +
  4778. +}
  4779. diff -Nru openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java
  4780. --- openjdk.orig/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java 1970-01-01 01:00:00.000000000 +0100
  4781. +++ openjdk/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java 2011-02-16 01:27:25.016325311 +0000
  4782. @@ -0,0 +1,306 @@
  4783. +/*
  4784. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  4785. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4786. + *
  4787. + * This code is free software; you can redistribute it and/or modify it
  4788. + * under the terms of the GNU General Public License version 2 only, as
  4789. + * published by the Free Software Foundation. Oracle designates this
  4790. + * particular file as subject to the "Classpath" exception as provided
  4791. + * by Oracle in the LICENSE file that accompanied this code.
  4792. + *
  4793. + * This code is distributed in the hope that it will be useful, but WITHOUT
  4794. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  4795. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  4796. + * version 2 for more details (a copy is included in the LICENSE file that
  4797. + * accompanied this code).
  4798. + *
  4799. + * You should have received a copy of the GNU General Public License version
  4800. + * 2 along with this work; if not, write to the Free Software Foundation,
  4801. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  4802. + *
  4803. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  4804. + * or visit www.oracle.com if you need additional information or have any
  4805. + * questions.
  4806. + */
  4807. +
  4808. +import com.sun.awt.AWTUtilities;
  4809. +import static com.sun.awt.AWTUtilities.Translucency.*;
  4810. +import java.awt.BorderLayout;
  4811. +import java.awt.Color;
  4812. +import java.awt.Dimension;
  4813. +import java.awt.Frame;
  4814. +import java.awt.Graphics;
  4815. +import java.awt.GraphicsConfiguration;
  4816. +import java.awt.GraphicsEnvironment;
  4817. +import java.awt.RenderingHints;
  4818. +import java.awt.event.MouseAdapter;
  4819. +import java.awt.event.MouseEvent;
  4820. +import java.awt.event.WindowAdapter;
  4821. +import java.awt.event.WindowEvent;
  4822. +import java.awt.Canvas;
  4823. +import java.awt.Component;
  4824. +import java.awt.GradientPaint;
  4825. +import java.awt.Graphics2D;
  4826. +import java.awt.Paint;
  4827. +import java.util.Random;
  4828. +import java.awt.geom.Ellipse2D;
  4829. +import javax.swing.JApplet;
  4830. +import javax.swing.JButton;
  4831. +import javax.swing.JComponent;
  4832. +import javax.swing.JFrame;
  4833. +import javax.swing.JPanel;
  4834. +import javax.swing.SwingUtilities;
  4835. +
  4836. +public class TSFrame {
  4837. +
  4838. + static volatile boolean done = false;
  4839. +
  4840. + static final boolean useSwing = System.getProperty("useswing") != null;
  4841. + static final boolean useShape = System.getProperty("useshape") != null;
  4842. + static final boolean useTransl = System.getProperty("usetransl") != null;
  4843. + static final boolean useNonOpaque = System.getProperty("usenonop") != null;
  4844. +
  4845. + static final Random rnd = new Random();
  4846. + private static void render(Graphics g, int w, int h, boolean useNonOpaque) {
  4847. + if (useNonOpaque) {
  4848. + Graphics2D g2d = (Graphics2D)g;
  4849. + GradientPaint p =
  4850. + new GradientPaint(0.0f, 0.0f,
  4851. + new Color(rnd.nextInt(0xffffff)),
  4852. + w, h,
  4853. + new Color(rnd.nextInt(0xff),
  4854. + rnd.nextInt(0xff),
  4855. + rnd.nextInt(0xff), 0),
  4856. + true);
  4857. + g2d.setPaint(p);
  4858. + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
  4859. + RenderingHints.VALUE_ANTIALIAS_ON);
  4860. + g2d.fillOval(0, 0, w, h);
  4861. + } else {
  4862. + g.setColor(new Color(rnd.nextInt(0xffffff)));
  4863. + g.fillRect(0, 0, w, h);
  4864. + }
  4865. + }
  4866. +
  4867. + private static class MyCanvas extends Canvas {
  4868. + @Override
  4869. + public void paint(Graphics g) {
  4870. + render(g, getWidth(), getHeight(), false);
  4871. + }
  4872. + @Override
  4873. + public Dimension getPreferredSize() {
  4874. + return new Dimension(200, 100);
  4875. + }
  4876. + }
  4877. + private static class NonOpaqueJFrame extends JFrame {
  4878. + NonOpaqueJFrame(GraphicsConfiguration gc) {
  4879. + super("NonOpaque Swing JFrame", gc);
  4880. + JPanel p = new JPanel() {
  4881. + public void paintComponent(Graphics g) {
  4882. + super.paintComponent(g);
  4883. + render(g, getWidth(), getHeight(), true);
  4884. + g.setColor(Color.red);
  4885. + g.drawString("Non-Opaque Swing JFrame", 10, 15);
  4886. + }
  4887. + };
  4888. + p.setDoubleBuffered(false);
  4889. + p.setOpaque(false);
  4890. + add(p);
  4891. + setUndecorated(true);
  4892. + }
  4893. + }
  4894. + private static class NonOpaqueJAppletFrame extends JFrame {
  4895. + JPanel p;
  4896. + NonOpaqueJAppletFrame(GraphicsConfiguration gc) {
  4897. + super("NonOpaque Swing JAppletFrame", gc);
  4898. + JApplet ja = new JApplet() {
  4899. + public void paint(Graphics g) {
  4900. + super.paint(g);
  4901. + System.err.println("JAppletFrame paint called");
  4902. + }
  4903. + };
  4904. + p = new JPanel() {
  4905. + public void paintComponent(Graphics g) {
  4906. + super.paintComponent(g);
  4907. + render(g, getWidth(), getHeight(), true);
  4908. + g.setColor(Color.red);
  4909. + g.drawString("Non-Opaque Swing JFrame", 10, 15);
  4910. + }
  4911. + };
  4912. + p.setDoubleBuffered(false);
  4913. + p.setOpaque(false);
  4914. + ja.add(p);
  4915. + add(ja);
  4916. + setUndecorated(true);
  4917. + }
  4918. + }
  4919. + private static class NonOpaqueFrame extends Frame {
  4920. + NonOpaqueFrame(GraphicsConfiguration gc) {
  4921. + super("NonOpaque AWT Frame", gc);
  4922. + // uncomment to test with hw child
  4923. +// setLayout(null);
  4924. +// Component c = new Panel() {
  4925. +// public void paint(Graphics g) {
  4926. +// g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.5f));
  4927. +// g.fillRect(0, 0, getWidth(), getHeight());
  4928. +// }
  4929. +// };
  4930. +// c.setSize(100, 100);
  4931. +// c.setBackground(Color.red);
  4932. +// c.setForeground(Color.red);
  4933. +// add(c);
  4934. +// c.setLocation(130, 130);
  4935. + }
  4936. + @Override
  4937. + public void paint(Graphics g) {
  4938. + render(g, getWidth(), getHeight(), true);
  4939. + g.setColor(Color.red);
  4940. + g.drawString("Non-Opaque AWT Frame", 10, 15);
  4941. + }
  4942. + }
  4943. +
  4944. + private static class MyJPanel extends JPanel {
  4945. + @Override
  4946. + public void paintComponent(Graphics g) {
  4947. + render(g, getWidth(), getHeight(), false);
  4948. + }
  4949. + }
  4950. +
  4951. + public static Frame createGui(GraphicsConfiguration gc,
  4952. + final boolean useSwing,
  4953. + final boolean useShape,
  4954. + final boolean useTransl,
  4955. + final boolean useNonOpaque,
  4956. + final float factor)
  4957. + {
  4958. + Frame frame;
  4959. + done = false;
  4960. +
  4961. + if (gc == null) {
  4962. + gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
  4963. + getDefaultScreenDevice().getDefaultConfiguration();
  4964. + }
  4965. +
  4966. + if (useNonOpaque) {
  4967. + if (useSwing) {
  4968. + frame = new NonOpaqueJFrame(gc);
  4969. +// frame = new NonOpaqueJAppletFrame(gc);
  4970. + } else {
  4971. + frame = new NonOpaqueFrame(gc);
  4972. + }
  4973. + animateComponent(frame);
  4974. + } else if (useSwing) {
  4975. + frame = new JFrame("Swing Frame", gc);
  4976. + JComponent p = new JButton("Swing!");
  4977. + p.setPreferredSize(new Dimension(200, 100));
  4978. + frame.add("North", p);
  4979. + p = new MyJPanel();
  4980. + animateComponent(p);
  4981. + frame.add("Center", p);
  4982. + } else {
  4983. + frame = new Frame("AWT Frame", gc) {
  4984. + public void paint(Graphics g) {
  4985. + g.setColor(Color.red);
  4986. + g.fillRect(0, 0, 100, 100);
  4987. + }
  4988. + };
  4989. + frame.setLayout(new BorderLayout());
  4990. + Canvas c = new MyCanvas();
  4991. + frame.add("North", c);
  4992. + animateComponent(c);
  4993. + c = new MyCanvas();
  4994. + frame.add("Center", c);
  4995. + animateComponent(c);
  4996. + c = new MyCanvas();
  4997. + frame.add("South", c);
  4998. + animateComponent(c);
  4999. + }
  5000. + final Frame finalFrame = frame;
  5001. + frame.addWindowListener(new WindowAdapter() {
  5002. + @Override
  5003. + public void windowClosing(WindowEvent e) {
  5004. + finalFrame.dispose();
  5005. + done = true;
  5006. + }
  5007. + });
  5008. + frame.addMouseListener(new MouseAdapter() {
  5009. + @Override
  5010. + public void mouseClicked(MouseEvent e) {
  5011. + finalFrame.dispose();
  5012. + done = true;
  5013. + }
  5014. + });
  5015. + frame.setPreferredSize(new Dimension(800, 600));
  5016. +
  5017. + if (useShape) {
  5018. + frame.setUndecorated(true);
  5019. + }
  5020. +
  5021. + frame.setLocation(450, 10);
  5022. + frame.pack();
  5023. +
  5024. + if (useShape) {
  5025. + if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
  5026. + System.out.println("applying PERPIXEL_TRANSPARENT");
  5027. + AWTUtilities.setWindowShape(frame,
  5028. + new Ellipse2D.Double(0, 0, frame.getWidth(),
  5029. + frame.getHeight()/3));
  5030. + frame.setTitle("PERPIXEL_TRANSPARENT");
  5031. + } else {
  5032. + System.out.println("Passed: PERPIXEL_TRANSPARENT unsupported");
  5033. + }
  5034. + }
  5035. + if (useTransl) {
  5036. + if (AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
  5037. + System.out.println("applying TRANSLUCENT");
  5038. + AWTUtilities.setWindowOpacity(frame, factor);
  5039. + frame.setTitle("TRANSLUCENT");
  5040. + } else {
  5041. + System.out.println("Passed: TRANSLUCENT unsupported");
  5042. + }
  5043. + }
  5044. + if (useNonOpaque) {
  5045. + if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT) &&
  5046. + AWTUtilities.isTranslucencyCapable(gc))
  5047. + {
  5048. + System.out.println("applying PERPIXEL_TRANSLUCENT");
  5049. + AWTUtilities.setWindowOpaque(frame, false);
  5050. + frame.setTitle("PERPIXEL_TRANSLUCENT");
  5051. + } else {
  5052. + System.out.println("Passed: PERPIXEL_TRANSLUCENT unsupported");
  5053. + }
  5054. + }
  5055. + frame.setVisible(true);
  5056. + return frame;
  5057. + }
  5058. +
  5059. + public static void stopThreads() {
  5060. + done = true;
  5061. + }
  5062. +
  5063. + private static void animateComponent(final Component comp) {
  5064. + Thread t = new Thread(new Runnable() {
  5065. + public void run() {
  5066. + do {
  5067. + try {
  5068. + Thread.sleep(50);
  5069. + } catch (InterruptedException ex) {}
  5070. + comp.repaint();
  5071. + } while (!done);
  5072. + }
  5073. + });
  5074. + t.start();
  5075. + }
  5076. +
  5077. + public static void main(String[] args) throws Exception {
  5078. + SwingUtilities.invokeLater(new Runnable() {
  5079. + public void run() {
  5080. + TSFrame.createGui(null, useSwing,
  5081. + useShape,
  5082. + useTransl,
  5083. + useNonOpaque,
  5084. + 0.7f);
  5085. + }
  5086. + });
  5087. + }
  5088. +}
  5089. diff -Nru openjdk.orig/jdk/test/com/sun/awt/Translucency/WindowOpacity.java openjdk/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
  5090. --- openjdk.orig/jdk/test/com/sun/awt/Translucency/WindowOpacity.java 1970-01-01 01:00:00.000000000 +0100
  5091. +++ openjdk/jdk/test/com/sun/awt/Translucency/WindowOpacity.java 2011-02-16 01:27:25.016325311 +0000
  5092. @@ -0,0 +1,461 @@
  5093. +/*
  5094. + * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
  5095. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5096. + *
  5097. + * This code is free software; you can redistribute it and/or modify it
  5098. + * under the terms of the GNU General Public License version 2 only, as
  5099. + * published by the Free Software Foundation.
  5100. + *
  5101. + * This code is distributed in the hope that it will be useful, but WITHOUT
  5102. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  5103. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  5104. + * version 2 for more details (a copy is included in the LICENSE file that
  5105. + * accompanied this code).
  5106. + *
  5107. + * You should have received a copy of the GNU General Public License version
  5108. + * 2 along with this work; if not, write to the Free Software Foundation,
  5109. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  5110. + *
  5111. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  5112. + * or visit www.oracle.com if you need additional information or have any
  5113. + * questions.
  5114. + */
  5115. +
  5116. +/*
  5117. + @test %W% %E%
  5118. + @bug 6594131
  5119. + @summary Tests the AWTUtilities.get/setWindowOpacity() methods
  5120. + @author anthony.petrov@...: area=awt.toplevel
  5121. + @run main WindowOpacity
  5122. +*/
  5123. +
  5124. +import java.awt.*;
  5125. +import java.awt.event.*;
  5126. +
  5127. +import com.sun.awt.AWTUtilities;
  5128. +import sun.awt.SunToolkit;
  5129. +
  5130. +public class WindowOpacity
  5131. +{
  5132. + //*** test-writer defined static variables go here ***
  5133. +
  5134. + private static void realSync() {
  5135. + ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
  5136. + }
  5137. +
  5138. +
  5139. + private static void init()
  5140. + {
  5141. + //*** Create instructions for the user here ***
  5142. + String[] instructions =
  5143. + {
  5144. + "This is an AUTOMATIC test, simply wait until it is done.",
  5145. + "The result (passed or failed) will be shown in the",
  5146. + "message window below."
  5147. + };
  5148. + Sysout.createDialog( );
  5149. + Sysout.printInstructions( instructions );
  5150. +
  5151. + if (!AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT)) {
  5152. + System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level.");
  5153. + pass();
  5154. + }
  5155. +
  5156. + boolean passed;
  5157. +
  5158. + Frame f = new Frame("Opacity test");
  5159. +
  5160. + passed = false;
  5161. + try {
  5162. + AWTUtilities.getWindowOpacity(null);
  5163. + } catch (NullPointerException e) {
  5164. + passed = true;
  5165. + }
  5166. + if (!passed) {
  5167. + fail("getWindowOpacity() allows passing null.");
  5168. + }
  5169. +
  5170. +
  5171. + passed = false;
  5172. + try {
  5173. + AWTUtilities.setWindowOpacity(null, 0.5f);
  5174. + } catch (NullPointerException e) {
  5175. + passed = true;
  5176. + }
  5177. + if (!passed) {
  5178. + fail("setWindowOpacity() allows passing null.");
  5179. + }
  5180. +
  5181. +
  5182. + float curOpacity = AWTUtilities.getWindowOpacity(f);
  5183. + if (curOpacity < 1.0f || curOpacity > 1.0f) {
  5184. + fail("getWindowOpacity() reports the initial opacity level other than 1.0: " + curOpacity);
  5185. + }
  5186. +
  5187. +
  5188. +
  5189. + passed = false;
  5190. + try {
  5191. + AWTUtilities.setWindowOpacity(f, -0.5f);
  5192. + } catch (IllegalArgumentException e) {
  5193. + passed = true;
  5194. + }
  5195. + if (!passed) {
  5196. + fail("setWindowOpacity() allows passing negative opacity level.");
  5197. + }
  5198. +
  5199. +
  5200. +
  5201. + passed = false;
  5202. + try {
  5203. + AWTUtilities.setWindowOpacity(f, 1.5f);
  5204. + } catch (IllegalArgumentException e) {
  5205. + passed = true;
  5206. + }
  5207. + if (!passed) {
  5208. + fail("setWindowOpacity() allows passing opacity level greater than 1.0.");
  5209. + }
  5210. +
  5211. +
  5212. + AWTUtilities.setWindowOpacity(f, 0.5f);
  5213. +
  5214. + curOpacity = AWTUtilities.getWindowOpacity(f);
  5215. + if (curOpacity < 0.5f || curOpacity > 0.5f) {
  5216. + fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity: " + curOpacity);
  5217. + }
  5218. +
  5219. +
  5220. + AWTUtilities.setWindowOpacity(f, 0.75f);
  5221. +
  5222. + curOpacity = AWTUtilities.getWindowOpacity(f);
  5223. + if (curOpacity < 0.75f || curOpacity > 0.75f) {
  5224. + fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity the second time: " + curOpacity);
  5225. + }
  5226. +
  5227. +
  5228. + f.setBounds(100, 100, 300, 200);
  5229. + f.setVisible(true);
  5230. +
  5231. + realSync();
  5232. +
  5233. + curOpacity = AWTUtilities.getWindowOpacity(f);
  5234. + if (curOpacity < 0.75f || curOpacity > 0.75f) {
  5235. + fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity before showing the frame: " + curOpacity);
  5236. + }
  5237. +
  5238. +
  5239. +
  5240. + AWTUtilities.setWindowOpacity(f, 0.5f);
  5241. + realSync();
  5242. +
  5243. + curOpacity = AWTUtilities.getWindowOpacity(f);
  5244. + if (curOpacity < 0.5f || curOpacity > 0.5f) {
  5245. + fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity after showing the frame: " + curOpacity);
  5246. + }
  5247. +
  5248. + WindowOpacity.pass();
  5249. +
  5250. + }//End init()
  5251. +
  5252. +
  5253. +
  5254. + /*****************************************************
  5255. + * Standard Test Machinery Section
  5256. + * DO NOT modify anything in this section -- it's a
  5257. + * standard chunk of code which has all of the
  5258. + * synchronisation necessary for the test harness.
  5259. + * By keeping it the same in all tests, it is easier
  5260. + * to read and understand someone else's test, as
  5261. + * well as insuring that all tests behave correctly
  5262. + * with the test harness.
  5263. + * There is a section following this for test-
  5264. + * classes
  5265. + ******************************************************/
  5266. + private static boolean theTestPassed = false;
  5267. + private static boolean testGeneratedInterrupt = false;
  5268. + private static String failureMessage = "";
  5269. +
  5270. + private static Thread mainThread = null;
  5271. +
  5272. + private static int sleepTime = 300000;
  5273. +
  5274. + // Not sure about what happens if multiple of this test are
  5275. + // instantiated in the same VM. Being static (and using
  5276. + // static vars), it aint gonna work. Not worrying about
  5277. + // it for now.
  5278. + public static void main( String args[] ) throws InterruptedException
  5279. + {
  5280. + mainThread = Thread.currentThread();
  5281. + try
  5282. + {
  5283. + init();
  5284. + }
  5285. + catch( TestPassedException e )
  5286. + {
  5287. + //The test passed, so just return from main and harness will
  5288. + // interepret this return as a pass
  5289. + return;
  5290. + }
  5291. + //At this point, neither test pass nor test fail has been
  5292. + // called -- either would have thrown an exception and ended the
  5293. + // test, so we know we have multiple threads.
  5294. +
  5295. + //Test involves other threads, so sleep and wait for them to
  5296. + // called pass() or fail()
  5297. + try
  5298. + {
  5299. + Thread.sleep( sleepTime );
  5300. + //Timed out, so fail the test
  5301. + throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
  5302. + }
  5303. + catch (InterruptedException e)
  5304. + {
  5305. + //The test harness may have interrupted the test. If so, rethrow the exception
  5306. + // so that the harness gets it and deals with it.
  5307. + if( ! testGeneratedInterrupt ) throw e;
  5308. +
  5309. + //reset flag in case hit this code more than once for some reason (just safety)
  5310. + testGeneratedInterrupt = false;
  5311. +
  5312. + if ( theTestPassed == false )
  5313. + {
  5314. + throw new RuntimeException( failureMessage );
  5315. + }
  5316. + }
  5317. +
  5318. + }//main
  5319. +
  5320. + public static synchronized void setTimeoutTo( int seconds )
  5321. + {
  5322. + sleepTime = seconds * 1000;
  5323. + }
  5324. +
  5325. + public static synchronized void pass()
  5326. + {
  5327. + Sysout.println( "The test passed." );
  5328. + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
  5329. + //first check if this is executing in main thread
  5330. + if ( mainThread == Thread.currentThread() )
  5331. + {
  5332. + //Still in the main thread, so set the flag just for kicks,
  5333. + // and throw a test passed exception which will be caught
  5334. + // and end the test.
  5335. + theTestPassed = true;
  5336. + throw new TestPassedException();
  5337. + }
  5338. + theTestPassed = true;
  5339. + testGeneratedInterrupt = true;
  5340. + mainThread.interrupt();
  5341. + }//pass()
  5342. +
  5343. + public static synchronized void fail()
  5344. + {
  5345. + //test writer didn't specify why test failed, so give generic
  5346. + fail( "it just plain failed! :-)" );
  5347. + }
  5348. +
  5349. + public static synchronized void fail( String whyFailed )
  5350. + {
  5351. + Sysout.println( "The test failed: " + whyFailed );
  5352. + Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
  5353. + //check if this called from main thread
  5354. + if ( mainThread == Thread.currentThread() )
  5355. + {
  5356. + //If main thread, fail now 'cause not sleeping
  5357. + throw new RuntimeException( whyFailed );
  5358. + }
  5359. + theTestPassed = false;
  5360. + testGeneratedInterrupt = true;
  5361. + failureMessage = whyFailed;
  5362. + mainThread.interrupt();
  5363. + }//fail()
  5364. +
  5365. +}// class WindowOpacity
  5366. +
  5367. +//This exception is used to exit from any level of call nesting
  5368. +// when it's determined that the test has passed, and immediately
  5369. +// end the test.
  5370. +class TestPassedException extends RuntimeException
  5371. +{
  5372. +}
  5373. +
  5374. +//*********** End Standard Test Machinery Section **********
  5375. +
  5376. +
  5377. +//************ Begin classes defined for the test ****************
  5378. +
  5379. +// if want to make listeners, here is the recommended place for them, then instantiate
  5380. +// them in init()
  5381. +
  5382. +/* Example of a class which may be written as part of a test
  5383. +class NewClass implements anInterface
  5384. + {
  5385. + static int newVar = 0;
  5386. +
  5387. + public void eventDispatched(AWTEvent e)
  5388. + {
  5389. + //Counting events to see if we get enough
  5390. + eventCount++;
  5391. +
  5392. + if( eventCount == 20 )
  5393. + {
  5394. + //got enough events, so pass
  5395. +
  5396. + WindowOpacity.pass();
  5397. + }
  5398. + else if( tries == 20 )
  5399. + {
  5400. + //tried too many times without getting enough events so fail
  5401. +
  5402. + WindowOpacity.fail();
  5403. + }
  5404. +
  5405. + }// eventDispatched()
  5406. +
  5407. + }// NewClass class
  5408. +
  5409. +*/
  5410. +
  5411. +
  5412. +//************** End classes defined for the test *******************
  5413. +
  5414. +
  5415. +
  5416. +
  5417. +/****************************************************
  5418. + Standard Test Machinery
  5419. + DO NOT modify anything below -- it's a standard
  5420. + chunk of code whose purpose is to make user
  5421. + interaction uniform, and thereby make it simpler
  5422. + to read and understand someone else's test.
  5423. + ****************************************************/
  5424. +
  5425. +/**
  5426. + This is part of the standard test machinery.
  5427. + It creates a dialog (with the instructions), and is the interface
  5428. + for sending text messages to the user.
  5429. + To print the instructions, send an array of strings to Sysout.createDialog
  5430. + WithInstructions method. Put one line of instructions per array entry.
  5431. + To display a message for the tester to see, simply call Sysout.println
  5432. + with the string to be displayed.
  5433. + This mimics System.out.println but works within the test harness as well
  5434. + as standalone.
  5435. + */
  5436. +
  5437. +class Sysout
  5438. +{
  5439. + private static TestDialog dialog;
  5440. +
  5441. + public static void createDialogWithInstructions( String[] instructions )
  5442. + {
  5443. + dialog = new TestDialog( new Frame(), "Instructions" );
  5444. + dialog.printInstructions( instructions );
  5445. + dialog.setVisible(true);
  5446. + println( "Any messages for the tester will display here." );
  5447. + }
  5448. +
  5449. + public static void createDialog( )
  5450. + {
  5451. + dialog = new TestDialog( new Frame(), "Instructions" );
  5452. + String[] defInstr = { "Instructions will appear here. ", "" } ;
  5453. + dialog.printInstructions( defInstr );
  5454. + dialog.setVisible(true);
  5455. + println( "Any messages for the tester will display here." );
  5456. + }
  5457. +
  5458. +
  5459. + public static void printInstructions( String[] instructions )
  5460. + {
  5461. + dialog.printInstructions( instructions );
  5462. + }
  5463. +
  5464. +
  5465. + public static void println( String messageIn )
  5466. + {
  5467. + dialog.displayMessage( messageIn );
  5468. + System.out.println(messageIn);
  5469. + }
  5470. +
  5471. +}// Sysout class
  5472. +
  5473. +/**
  5474. + This is part of the standard test machinery. It provides a place for the
  5475. + test instructions to be displayed, and a place for interactive messages
  5476. + to the user to be displayed.
  5477. + To have the test instructions displayed, see Sysout.
  5478. + To have a message to the user be displayed, see Sysout.
  5479. + Do not call anything in this dialog directly.
  5480. + */
  5481. +class TestDialog extends Dialog
  5482. +{
  5483. +
  5484. + TextArea instructionsText;
  5485. + TextArea messageText;
  5486. + int maxStringLength = 80;
  5487. +
  5488. + //DO NOT call this directly, go through Sysout
  5489. + public TestDialog( Frame frame, String name )
  5490. + {
  5491. + super( frame, name );
  5492. + int scrollBoth = TextArea.SCROLLBARS_BOTH;
  5493. + instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
  5494. + add( "North", instructionsText );
  5495. +
  5496. + messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
  5497. + add("Center", messageText);
  5498. +
  5499. + pack();
  5500. +
  5501. + setVisible(true);
  5502. + }// TestDialog()
  5503. +
  5504. + //DO NOT call this directly, go through Sysout
  5505. + public void printInstructions( String[] instructions )
  5506. + {
  5507. + //Clear out any current instructions
  5508. + instructionsText.setText( "" );
  5509. +
  5510. + //Go down array of instruction strings
  5511. +
  5512. + String printStr, remainingStr;
  5513. + for( int i=0; i < instructions.length; i++ )
  5514. + {
  5515. + //chop up each into pieces maxSringLength long
  5516. + remainingStr = instructions[ i ];
  5517. + while( remainingStr.length() > 0 )
  5518. + {
  5519. + //if longer than max then chop off first max chars to print
  5520. + if( remainingStr.length() >= maxStringLength )
  5521. + {
  5522. + //Try to chop on a word boundary
  5523. + int posOfSpace = remainingStr.
  5524. + lastIndexOf( ' ', maxStringLength - 1 );
  5525. +
  5526. + if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
  5527. +
  5528. + printStr = remainingStr.substring( 0, posOfSpace + 1 );
  5529. + remainingStr = remainingStr.substring( posOfSpace + 1 );
  5530. + }
  5531. + //else just print
  5532. + else
  5533. + {
  5534. + printStr = remainingStr;
  5535. + remainingStr = "";
  5536. + }
  5537. +
  5538. + instructionsText.append( printStr + "\n" );
  5539. +
  5540. + }// while
  5541. +
  5542. + }// for
  5543. +
  5544. + }//printInstructions()
  5545. +
  5546. + //DO NOT call this directly, go through Sysout
  5547. + public void displayMessage( String messageIn )
  5548. + {
  5549. + messageText.append( messageIn + "\n" );
  5550. + System.out.println(messageIn);
  5551. + }
  5552. +
  5553. +}// TestDialog class
  5554. diff -Nru openjdk.orig/jdk/test/sun/java2d/pipe/RegionOps.java openjdk/jdk/test/sun/java2d/pipe/RegionOps.java
  5555. --- openjdk.orig/jdk/test/sun/java2d/pipe/RegionOps.java 1970-01-01 01:00:00.000000000 +0100
  5556. +++ openjdk/jdk/test/sun/java2d/pipe/RegionOps.java 2011-02-16 01:27:25.016325311 +0000
  5557. @@ -0,0 +1,533 @@
  5558. +/*
  5559. + * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
  5560. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  5561. + *
  5562. + * This code is free software; you can redistribute it and/or modify it
  5563. + * under the terms of the GNU General Public License version 2 only, as
  5564. + * published by the Free Software Foundation.
  5565. + *
  5566. + * This code is distributed in the hope that it will be useful, but WITHOUT
  5567. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  5568. + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  5569. + * version 2 for more details (a copy is included in the LICENSE file that
  5570. + * accompanied this code).
  5571. + *
  5572. + * You should have received a copy of the GNU General Public License version
  5573. + * 2 along with this work; if not, write to the Free Software Foundation,
  5574. + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  5575. + *
  5576. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  5577. + * or visit www.oracle.com if you need additional information or have any
  5578. + * questions.
  5579. + */
  5580. +
  5581. +/*
  5582. + * @test %W% %E%
  5583. + * @bug 6504874
  5584. + * @summary This test verifies the operation (and performance) of the
  5585. + * various CAG operations on the internal Region class.
  5586. + * @run main RegionOps
  5587. + */
  5588. +
  5589. +import java.awt.Rectangle;
  5590. +import java.awt.geom.Area;
  5591. +import java.awt.geom.AffineTransform;
  5592. +import java.awt.image.BufferedImage;
  5593. +import java.util.Random;
  5594. +import sun.java2d.pipe.Region;
  5595. +
  5596. +public class RegionOps {
  5597. + public static final int DEFAULT_NUMREGIONS = 50;
  5598. + public static final int DEFAULT_MINSUBRECTS = 1;
  5599. + public static final int DEFAULT_MAXSUBRECTS = 10;
  5600. +
  5601. + public static final int MINCOORD = -20;
  5602. + public static final int MAXCOORD = 20;
  5603. +
  5604. + public static boolean useArea;
  5605. +
  5606. + static int numops;
  5607. + static int numErrors;
  5608. + static Random rand = new Random();
  5609. + static boolean skipCheck;
  5610. + static boolean countErrors;
  5611. +
  5612. + static {
  5613. + // Instantiating BufferedImage initializes sun.java2d
  5614. + BufferedImage bimg =
  5615. + new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
  5616. + }
  5617. +
  5618. + public static void usage(String error) {
  5619. + if (error != null) {
  5620. + System.err.println("Error: "+error);
  5621. + }
  5622. + System.err.println("Usage: java RegionOps "+
  5623. + "[-regions N] [-rects M] "+
  5624. + "[-[min|max]rects M] [-area]");
  5625. + System.err.println(" "+
  5626. + "[-add|union] [-sub|diff] "+
  5627. + "[-int[ersect]] [-xor]");
  5628. + System.err.println(" "+
  5629. + "[-seed S] [-nocheck] [-count[errors]] [-help]");
  5630. + System.exit((error != null) ? 1 : 0);
  5631. + }
  5632. +
  5633. + public static void error(RectListImpl a, RectListImpl b, String problem) {
  5634. + System.err.println("Operating on: "+a);
  5635. + if (b != null) {
  5636. + System.err.println("and: "+b);
  5637. + }
  5638. + if (countErrors) {
  5639. + System.err.println(problem);
  5640. + numErrors++;
  5641. + } else {
  5642. + throw new RuntimeException(problem);
  5643. + }
  5644. + }
  5645. +
  5646. + public static void main(String argv[]) {
  5647. + int numregions = DEFAULT_NUMREGIONS;
  5648. + int minsubrects = DEFAULT_MINSUBRECTS;
  5649. + int maxsubrects = DEFAULT_MAXSUBRECTS;
  5650. + boolean doUnion = false;
  5651. + boolean doIntersect = false;
  5652. + boolean doSubtract = false;
  5653. + boolean doXor = false;
  5654. +
  5655. + for (int i = 0; i < argv.length; i++) {
  5656. + String arg = argv[i];
  5657. + if (arg.equalsIgnoreCase("-regions")) {
  5658. + if (i+1 >= argv.length) {
  5659. + usage("missing arg for -regions");
  5660. + }
  5661. + numregions = Integer.parseInt(argv[++i]);
  5662. + } else if (arg.equalsIgnoreCase("-rects")) {
  5663. + if (i+1 >= argv.length) {
  5664. + usage("missing arg for -rects");
  5665. + }
  5666. + minsubrects = maxsubrects = Integer.parseInt(argv[++i]);
  5667. + } else if (arg.equalsIgnoreCase("-minrects")) {
  5668. + if (i+1 >= argv.length) {
  5669. + usage("missing arg for -minrects");
  5670. + }
  5671. + minsubrects = Integer.parseInt(argv[++i]);
  5672. + } else if (arg.equalsIgnoreCase("-maxrects")) {
  5673. + if (i+1 >= argv.length) {
  5674. + usage("missing arg for -maxrects");
  5675. + }
  5676. + maxsubrects = Integer.parseInt(argv[++i]);
  5677. + } else if (arg.equalsIgnoreCase("-area")) {
  5678. + useArea = true;
  5679. + } else if (arg.equalsIgnoreCase("-add") ||
  5680. + arg.equalsIgnoreCase("-union"))
  5681. + {
  5682. + doUnion = true;
  5683. + } else if (arg.equalsIgnoreCase("-sub") ||
  5684. + arg.equalsIgnoreCase("-diff"))
  5685. + {
  5686. + doSubtract = true;
  5687. + } else if (arg.equalsIgnoreCase("-int") ||
  5688. + arg.equalsIgnoreCase("-intersect"))
  5689. + {
  5690. + doIntersect = true;
  5691. + } else if (arg.equalsIgnoreCase("-xor")) {
  5692. + doXor = true;
  5693. + } else if (arg.equalsIgnoreCase("-seed")) {
  5694. + if (i+1 >= argv.length) {
  5695. + usage("missing arg for -seed");
  5696. + }
  5697. + rand.setSeed(Long.decode(argv[++i]).longValue());
  5698. + } else if (arg.equalsIgnoreCase("-nocheck")) {
  5699. + skipCheck = true;
  5700. + } else if (arg.equalsIgnoreCase("-count") ||
  5701. + arg.equalsIgnoreCase("-counterrors"))
  5702. + {
  5703. + countErrors = true;
  5704. + } else if (arg.equalsIgnoreCase("-help")) {
  5705. + usage(null);
  5706. + } else {
  5707. + usage("Unknown argument: "+arg);
  5708. + }
  5709. + }
  5710. +
  5711. + if (maxsubrects < minsubrects) {
  5712. + usage("maximum number of subrectangles less than minimum");
  5713. + }
  5714. +
  5715. + if (minsubrects <= 0) {
  5716. + usage("minimum number of subrectangles must be positive");
  5717. + }
  5718. +
  5719. + if (!doUnion && !doSubtract && !doIntersect && !doXor) {
  5720. + doUnion = doSubtract = doIntersect = doXor = true;
  5721. + }
  5722. +
  5723. + long start = System.currentTimeMillis();
  5724. + RectListImpl rlist[] = new RectListImpl[numregions];
  5725. + int totalrects = 0;
  5726. + for (int i = 0; i < rlist.length; i++) {
  5727. + RectListImpl rli = RectListImpl.getInstance();
  5728. + int numsubrects =
  5729. + minsubrects + rand.nextInt(maxsubrects - minsubrects + 1);
  5730. + for (int j = 0; j < numsubrects; j++) {
  5731. + addRectTo(rli);
  5732. + totalrects++;
  5733. + }
  5734. + rlist[i] = rli;
  5735. + }
  5736. + long end = System.currentTimeMillis();
  5737. + System.out.println((end-start)+"ms to create "+
  5738. + rlist.length+" regions containing "+
  5739. + totalrects+" subrectangles");
  5740. +
  5741. + start = System.currentTimeMillis();
  5742. + for (int i = 0; i < rlist.length; i++) {
  5743. + RectListImpl a = rlist[i];
  5744. + testTranslate(a);
  5745. + for (int j = i; j < rlist.length; j++) {
  5746. + RectListImpl b = rlist[j];
  5747. + if (doUnion) testUnion(a, b);
  5748. + if (doSubtract) testDifference(a, b);
  5749. + if (doIntersect) testIntersection(a, b);
  5750. + if (doXor) testExclusiveOr(a, b);
  5751. + }
  5752. + }
  5753. + end = System.currentTimeMillis();
  5754. + System.out.println(numops+" ops took "+(end-start)+"ms");
  5755. +
  5756. + if (numErrors > 0) {
  5757. + throw new RuntimeException(numErrors+" errors encountered");
  5758. + }
  5759. + }
  5760. +
  5761. + public static void addRectTo(RectListImpl rli) {
  5762. + int lox = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
  5763. + int hix = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
  5764. + int loy = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
  5765. + int hiy = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
  5766. + rli.addRect(lox, loy, hix, hiy);
  5767. + }
  5768. +
  5769. + public static void checkEqual(RectListImpl a, RectListImpl b,
  5770. + String optype)
  5771. + {
  5772. + if (a.hashCode() != b.hashCode()) {
  5773. + error(a, b, "hashcode failed for "+optype);
  5774. + }
  5775. + if (!a.equals(b)) {
  5776. + error(a, b, "equals failed for "+optype);
  5777. + }
  5778. + }
  5779. +
  5780. + public static void testTranslate(RectListImpl a) {
  5781. + RectListImpl maxTrans =
  5782. + a.getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE)
  5783. + .getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE)
  5784. + .getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE);
  5785. + if (!maxTrans.checkTransEmpty()) {
  5786. + error(maxTrans, null, "overflow translated RectList not empty");
  5787. + }
  5788. + RectListImpl minTrans =
  5789. + a.getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE)
  5790. + .getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE)
  5791. + .getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE);
  5792. + if (!minTrans.checkTransEmpty()) {
  5793. + error(minTrans, null, "overflow translated RectList not empty");
  5794. + }
  5795. + testTranslate(a, Integer.MAX_VALUE, Integer.MAX_VALUE, false,
  5796. + MINCOORD, 0, MINCOORD, 0);
  5797. + testTranslate(a, Integer.MAX_VALUE, Integer.MIN_VALUE, false,
  5798. + MINCOORD, 0, 0, MAXCOORD);
  5799. + testTranslate(a, Integer.MIN_VALUE, Integer.MAX_VALUE, false,
  5800. + 0, MAXCOORD, MINCOORD, 0);
  5801. + testTranslate(a, Integer.MIN_VALUE, Integer.MIN_VALUE, false,
  5802. + 0, MAXCOORD, 0, MAXCOORD);
  5803. + for (int dy = -100; dy <= 100; dy += 50) {
  5804. + for (int dx = -100; dx <= 100; dx += 50) {
  5805. + testTranslate(a, dx, dy, true,
  5806. + MINCOORD, MAXCOORD,
  5807. + MINCOORD, MAXCOORD);
  5808. + }
  5809. + }
  5810. + }
  5811. +
  5812. + public static void testTranslate(RectListImpl a, int dx, int dy,
  5813. + boolean isNonDestructive,
  5814. + int xmin, int xmax,
  5815. + int ymin, int ymax)
  5816. + {
  5817. + RectListImpl theTrans = a.getTranslation(dx, dy); numops++;
  5818. + if (skipCheck) return;
  5819. + RectListImpl unTrans = theTrans.getTranslation(-dx, -dy);
  5820. + if (isNonDestructive) checkEqual(a, unTrans, "Translate");
  5821. + for (int x = xmin; x < xmax; x++) {
  5822. + for (int y = ymin; y < ymax; y++) {
  5823. + boolean inside = a.contains(x, y);
  5824. + if (theTrans.contains(x+dx, y+dy) != inside) {
  5825. + error(a, null, "translation failed for "+
  5826. + dx+", "+dy+" at "+x+", "+y);
  5827. + }
  5828. + }
  5829. + }
  5830. + }
  5831. +
  5832. + public static void testUnion(RectListImpl a, RectListImpl b) {
  5833. + RectListImpl aUb = a.getUnion(b); numops++;
  5834. + RectListImpl bUa = b.getUnion(a); numops++;
  5835. + if (skipCheck) return;
  5836. + checkEqual(aUb, bUa, "Union");
  5837. + testUnion(a, b, aUb);
  5838. + testUnion(a, b, bUa);
  5839. + }
  5840. +
  5841. + public static void testUnion(RectListImpl a, RectListImpl b,
  5842. + RectListImpl theUnion)
  5843. + {
  5844. + for (int x = MINCOORD; x < MAXCOORD; x++) {
  5845. + for (int y = MINCOORD; y < MAXCOORD; y++) {
  5846. + boolean inside = (a.contains(x, y) || b.contains(x, y));
  5847. + if (theUnion.contains(x, y) != inside) {
  5848. + error(a, b, "union failed at "+x+", "+y);
  5849. + }
  5850. + }
  5851. + }
  5852. + }
  5853. +
  5854. + public static void testDifference(RectListImpl a, RectListImpl b) {
  5855. + RectListImpl aDb = a.getDifference(b); numops++;
  5856. + RectListImpl bDa = b.getDifference(a); numops++;
  5857. + if (skipCheck) return;
  5858. + // Note that difference is not commutative so we cannot check equals
  5859. + // checkEqual(a, b, "Difference");
  5860. + testDifference(a, b, aDb);
  5861. + testDifference(b, a, bDa);
  5862. + }
  5863. +
  5864. + public static void testDifference(RectListImpl a, RectListImpl b,
  5865. + RectListImpl theDifference)
  5866. + {
  5867. + for (int x = MINCOORD; x < MAXCOORD; x++) {
  5868. + for (int y = MINCOORD; y < MAXCOORD; y++) {
  5869. + boolean inside = (a.contains(x, y) && !b.contains(x, y));
  5870. + if (theDifference.contains(x, y) != inside) {
  5871. + error(a, b, "difference failed at "+x+", "+y);
  5872. + }
  5873. + }
  5874. + }
  5875. + }
  5876. +
  5877. + public static void testIntersection(RectListImpl a, RectListImpl b) {
  5878. + RectListImpl aIb = a.getIntersection(b); numops++;
  5879. + RectListImpl bIa = b.getIntersection(a); numops++;
  5880. + if (skipCheck) return;
  5881. + checkEqual(aIb, bIa, "Intersection");
  5882. + testIntersection(a, b, aIb);
  5883. + testIntersection(a, b, bIa);
  5884. + }
  5885. +
  5886. + public static void testIntersection(RectListImpl a, RectListImpl b,
  5887. + RectListImpl theIntersection)
  5888. + {
  5889. + for (int x = MINCOORD; x < MAXCOORD; x++) {
  5890. + for (int y = MINCOORD; y < MAXCOORD; y++) {
  5891. + boolean inside = (a.contains(x, y) && b.contains(x, y));
  5892. + if (theIntersection.contains(x, y) != inside) {
  5893. + error(a, b, "intersection failed at "+x+", "+y);
  5894. + }
  5895. + }
  5896. + }
  5897. + }
  5898. +
  5899. + public static void testExclusiveOr(RectListImpl a, RectListImpl b) {
  5900. + RectListImpl aXb = a.getExclusiveOr(b); numops++;
  5901. + RectListImpl bXa = b.getExclusiveOr(a); numops++;
  5902. + if (skipCheck) return;
  5903. + checkEqual(aXb, bXa, "ExclusiveOr");
  5904. + testExclusiveOr(a, b, aXb);
  5905. + testExclusiveOr(a, b, bXa);
  5906. + }
  5907. +
  5908. + public static void testExclusiveOr(RectListImpl a, RectListImpl b,
  5909. + RectListImpl theExclusiveOr)
  5910. + {
  5911. + for (int x = MINCOORD; x < MAXCOORD; x++) {
  5912. + for (int y = MINCOORD; y < MAXCOORD; y++) {
  5913. + boolean inside = (a.contains(x, y) != b.contains(x, y));
  5914. + if (theExclusiveOr.contains(x, y) != inside) {
  5915. + error(a, b, "xor failed at "+x+", "+y);
  5916. + }
  5917. + }
  5918. + }
  5919. + }
  5920. +
  5921. + public abstract static class RectListImpl {
  5922. + public static RectListImpl getInstance() {
  5923. + if (useArea) {
  5924. + return new AreaImpl();
  5925. + } else {
  5926. + return new RegionImpl();
  5927. + }
  5928. + }
  5929. +
  5930. + public abstract void addRect(int lox, int loy, int hix, int hiy);
  5931. +
  5932. + public abstract RectListImpl getTranslation(int dx, int dy);
  5933. +
  5934. + public abstract RectListImpl getIntersection(RectListImpl rli);
  5935. + public abstract RectListImpl getExclusiveOr(RectListImpl rli);
  5936. + public abstract RectListImpl getDifference(RectListImpl rli);
  5937. + public abstract RectListImpl getUnion(RectListImpl rli);
  5938. +
  5939. + // Used for making sure that 3xMAX translates yields an empty region
  5940. + public abstract boolean checkTransEmpty();
  5941. +
  5942. + public abstract boolean contains(int x, int y);
  5943. +
  5944. + public abstract int hashCode();
  5945. + public abstract boolean equals(RectListImpl other);
  5946. + }
  5947. +
  5948. + public static class AreaImpl extends RectListImpl {
  5949. + Area theArea;
  5950. +
  5951. + public AreaImpl() {
  5952. + }
  5953. +
  5954. + public AreaImpl(Area a) {
  5955. + theArea = a;
  5956. + }
  5957. +
  5958. + public void addRect(int lox, int loy, int hix, int hiy) {
  5959. + Area a2 = new Area(new Rectangle(lox, loy, hix-lox, hiy-loy));
  5960. + if (theArea == null) {
  5961. + theArea = a2;
  5962. + } else {
  5963. + theArea.add(a2);
  5964. + }
  5965. + }
  5966. +
  5967. + public RectListImpl getTranslation(int dx, int dy) {
  5968. + AffineTransform at = AffineTransform.getTranslateInstance(dx, dy);
  5969. + return new AreaImpl(theArea.createTransformedArea(at));
  5970. + }
  5971. +
  5972. + public RectListImpl getIntersection(RectListImpl rli) {
  5973. + Area a2 = new Area(theArea);
  5974. + a2.intersect(((AreaImpl) rli).theArea);
  5975. + return new AreaImpl(a2);
  5976. + }
  5977. +
  5978. + public RectListImpl getExclusiveOr(RectListImpl rli) {
  5979. + Area a2 = new Area(theArea);
  5980. + a2.exclusiveOr(((AreaImpl) rli).theArea);
  5981. + return new AreaImpl(a2);
  5982. + }
  5983. +
  5984. + public RectListImpl getDifference(RectListImpl rli) {
  5985. + Area a2 = new Area(theArea);
  5986. + a2.subtract(((AreaImpl) rli).theArea);
  5987. + return new AreaImpl(a2);
  5988. + }
  5989. +
  5990. + public RectListImpl getUnion(RectListImpl rli) {
  5991. + Area a2 = new Area(theArea);
  5992. + a2.add(((AreaImpl) rli).theArea);
  5993. + return new AreaImpl(a2);
  5994. + }
  5995. +
  5996. + // Used for making sure that 3xMAX translates yields an empty region
  5997. + public boolean checkTransEmpty() {
  5998. + // Area objects will actually survive 3 MAX translates so just
  5999. + // pretend that it had the intended effect...
  6000. + return true;
  6001. + }
  6002. +
  6003. + public boolean contains(int x, int y) {
  6004. + return theArea.contains(x, y);
  6005. + }
  6006. +
  6007. + public int hashCode() {
  6008. + // Area does not override hashCode...
  6009. + return 0;
  6010. + }
  6011. +
  6012. + public boolean equals(RectListImpl other) {
  6013. + return theArea.equals(((AreaImpl) other).theArea);
  6014. + }
  6015. +
  6016. + public String toString() {
  6017. + return theArea.toString();
  6018. + }
  6019. + }
  6020. +
  6021. + public static class RegionImpl extends RectListImpl {
  6022. + Region theRegion;
  6023. +
  6024. + public RegionImpl() {
  6025. + }
  6026. +
  6027. + public RegionImpl(Region r) {
  6028. + theRegion = r;
  6029. + }
  6030. +
  6031. + public void addRect(int lox, int loy, int hix, int hiy) {
  6032. + Region r2 = Region.getInstanceXYXY(lox, loy, hix, hiy);
  6033. + if (theRegion == null) {
  6034. + theRegion = r2;
  6035. + } else {
  6036. + theRegion = theRegion.getUnion(r2);
  6037. + }
  6038. + }
  6039. +
  6040. + public RectListImpl getTranslation(int dx, int dy) {
  6041. + return new RegionImpl(theRegion.getTranslatedRegion(dx, dy));
  6042. + }
  6043. +
  6044. + public RectListImpl getIntersection(RectListImpl rli) {
  6045. + Region r2 = ((RegionImpl) rli).theRegion;
  6046. + r2 = theRegion.getIntersection(r2);
  6047. + return new RegionImpl(r2);
  6048. + }
  6049. +
  6050. + public RectListImpl getExclusiveOr(RectListImpl rli) {
  6051. + Region r2 = ((RegionImpl) rli).theRegion;
  6052. + r2 = theRegion.getExclusiveOr(r2);
  6053. + return new RegionImpl(r2);
  6054. + }
  6055. +
  6056. + public RectListImpl getDifference(RectListImpl rli) {
  6057. + Region r2 = ((RegionImpl) rli).theRegion;
  6058. + r2 = theRegion.getDifference(r2);
  6059. + return new RegionImpl(r2);
  6060. + }
  6061. +
  6062. + public RectListImpl getUnion(RectListImpl rli) {
  6063. + Region r2 = ((RegionImpl) rli).theRegion;
  6064. + r2 = theRegion.getUnion(r2);
  6065. + return new RegionImpl(r2);
  6066. + }
  6067. +
  6068. + // Used for making sure that 3xMAX translates yields an empty region
  6069. + public boolean checkTransEmpty() {
  6070. + // Region objects should be empty after 3 MAX translates...
  6071. + return theRegion.isEmpty();
  6072. + }
  6073. +
  6074. + public boolean contains(int x, int y) {
  6075. + return theRegion.contains(x, y);
  6076. + }
  6077. +
  6078. + public int hashCode() {
  6079. + return theRegion.hashCode();
  6080. + }
  6081. +
  6082. + public boolean equals(RectListImpl other) {
  6083. + return theRegion.equals(((RegionImpl) other).theRegion);
  6084. + }
  6085. +
  6086. + public String toString() {
  6087. + return theRegion.toString();
  6088. + }
  6089. + }
  6090. +}