diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-06-05 19:36:35 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2005-06-05 19:36:35 +0000 |
commit | 9399c41550e32c6bd8ea2d299a09f7151f9dc7dd (patch) | |
tree | a9391598545827aa8cf4e6cda3846509b6e373e0 /native/jni | |
parent | 9504f4c9901366e510c2d1824a8bf6cfea4e2cc5 (diff) | |
download | classpath-9399c41550e32c6bd8ea2d299a09f7151f9dc7dd.tar.gz |
2005-06-05 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge from HEAD-->generics-branch for 2005/05/26 - 2005/06/05.
Changelog:
2005-06-04 Tom Tromey <tromey@redhat.com>
* javax/swing/plaf/basic/BasicListUI.java (focusListener): Use
correct type.
(listDataListener, listSelectionListener, mouseInputListener,
propertyChangeListener): Likewise.
* javax/swing/plaf/basic/BasicMenuUI.java (ChangeHandler): Now
public and deprecated.
* javax/swing/plaf/basic/BasicTabbedPaneUI.java
(TabbedPaneLayout): Now public.
* javax/swing/plaf/basic/BasicOptionPaneUI.java
(ButtonActionListener): Now public.
(PropertyChangeHandler): Likewise.
(ButtonAreaLayout): Likewise.
* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
(TitlePaneLayout): Now public.
(PropertyChangeHandler): Likewise.
* javax/swing/plaf/basic/BasicCheckBoxUI.java
(getPropertyPrefix): New method.
* javax/swing/plaf/basic/BasicProgressBarUI.java (ChangeHandler):
Now public.
* javax/swing/plaf/basic/BasicSliderUI.java (ComponentHandler):
Now public.
* javax/swing/plaf/basic/BasicSplitPaneUI.java
(BasicVerticalLayoutManager): Now public.
(FocusHandler): Likewise.
(BasicHorizontalLayoutManager): Likewise.
* javax/swing/plaf/basic/BasicFileChooserUI.java
(AcceptAllFileFilter): New public constructor.
(BasicFileView): Likewise.
* javax/swing/plaf/basic/BasicInternalFrameUI.java
(BorderListener.RESIZE_NONE): Now final.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/DefinitionKindHelper.java,
org/omg/CORBA/FieldNameHelper.java,
org/omg/CORBA/IdentifierHelper.java,
org/omg/CORBA/ParameterMode.java,
org/omg/CORBA/ParameterModeHelper.java,
org/omg/CORBA/ParameterModeHolder.java,
org/omg/CORBA/RepositoryIdHelper.java,
org/omg/CORBA/SetOverrideTypeHelper.java,
org/omg/CORBA/VersionSpecHelper.java,
gnu/CORBA/SetOverrideTypeHolder.java,
gnu/CORBA/DefinitionKindHolder.java: New files.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/stub/java/rmi/_Remote_Stub.java,
org/omg/stub/java/rmi/package.html: New package.
2005-06-04 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/Messaging/SyncScopeHelper.java
org/omg/Messaging/SYNC_WITH_TRANSPORT.java
org/omg/Messaging/package.html: New package.
2005-06-04 Michael Koch <konqueror@gmx.de>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c
(Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf):
Fixed method declaration format.
(Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled):
Likewise.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* AUTHORS (Roman Kennke): New author.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/portable/BoxedValueHelper.java,
org/omg/CORBA_2_3/portable/OutputStream.java,
org/omg/CORBA_2_3/portable/Delegate.java,
org/omg/CORBA_2_3/portable/ObjectImpl.java,
org/omg/CORBA_2_3/portable/package.html: New files.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/NamingContextPackage/AlreadyBound.java,
org/omg/CosNaming/NamingContextPackage/CannotProceed.java,
org/omg/CosNaming/NamingContextPackage/InvalidName.java,
org/omg/CosNaming/NamingContextPackage/NotEmpty.java,
org/omg/CosNaming/NamingContextPackage/NotFound.java,
org/omg/CosNaming/NamingContextPackage/NotFoundReason.java:
Added SerialVersionUID.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/GIOP/uncObjectInputStream.java,
gnu/CORBA/GIOP/uncObjectInputStream/uncObjectOutputStream.java:
Deleting files.
* gnu/CORBA/CDR/uncObjectInputStream.java,
gnu/CORBA/CDR/uncObjectInputStream/uncObjectOutputStream.java:
Adding files.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java,
gnu/CORBA/IOR_Delegate.java,
gnu/CORBA/Simple_delegate.java,
gnu/CORBA/universalHolder.java,
gnu/CORBA/CDR/aligningInputStream.java,
gnu/CORBA/CDR/aligningOutputStream.java,
gnu/CORBA/CDR/cdrInput.java,
gnu/CORBA/CDR/cdrOutput.java,
gnu/CORBA/CDR/encapsulatedOutput.java,
gnu/CORBA/GIOP/ErrorMessage.java,
gnu/CORBA/GIOP/MessageHeader.java,
gnu/CORBA/GIOP/cxCodeSet.java,
gnu/CORBA/GIOP/v1_2/RequestHeader.java,
org/omg/CosNaming/BindingIteratorHelper.java,
org/omg/CosNaming/BindingListHelper.java,
org/omg/CosNaming/BindingTypeHelper.java,
org/omg/CosNaming/NameComponentHelper.java,
org/omg/CosNaming/NameHelper.java,
org/omg/CosNaming/NamingContextExtHelper.java,
org/omg/CosNaming/NamingContextHelper.java:
Initialise instances of org.omg.SystemException, thrown
after catching the other exception, with InitCause.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicListUI.java
(damageLayout): Check for list beeing null before revalidating
it.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/text/PlainDocument.java
(removeUpdate): Fixed indices in text buffer access.
* javax/swing/text/PlainView.java
(drawLine): Simplified element access.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/JTextArea.java
(constructor): Set preferredSize to a sane default.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/GIOP/uncObjectInputStream.java,
gnu/CORBA/GIOP/uncObjectInputStream/uncObjectOutputStream.java: New streams.
* org/omg/CORBA/ValueBaseHelper.java: Removing inner classes,
using uncObjectInputStream, uncObjectOutputStream instead.
* org/omg/CORBA_2_3/portable (read_value): Delegate call to
ValueBaseHelper.
2005-06-03 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/SendingContext/Runtime.java,
org/omg/CORBA/SendingContext/RunTimeOperations.java:
Fixing the package statement.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilites.java
(replaceUIActionMap): Fixed loop again. Now correctly, I hope.
* javax/swing/ActionMap.java
(setParent): Make sure we don't build a loop.
* javax/swing/plaf/basic/BasicTextUI.java
(createActionMap): Create ActionMapUIResource instead of
plain ActionMap.
2005-06-03 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics.java:
Removed declarations for the previously removed native methods.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilites.java
(replaceUIActionMap): Fixed condition in while loop that caused
infinite looping.
2005-06-03 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicTableUI.java
(uninstallDefault): Don't set properties to null, this corrupts
component state.
2005-06-02 Andrew John Hughes <gnu_andrew@member.fsf.org>
* lib/Makefile.am:
Fix permissions problem with creation of META-INF tree.
2005-06-02 Sven de Marothy <sven@physto.se>
* java/awt/Component.java
(setBackgroundColor): Return if the color equals the existing bgcolor.
2005-06-02 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
(drawImage): Remove reference to GtkOffScreenImage.
* gnu/java/awt/peer/gtk/GtkImageConsumer.java:
Add additional comments.
2005-06-02 Sven de Marothy <sven@physto.se>
* gnu/java/awt/peer/gtk/GdkGraphics.java:
(GdkGraphics): New constructor.
(drawImage): Reimplemented.
* gnu/java/awt/peer/gtk/GtkComponentPeer.java:
(checkImage,createImage): Reimplemented.
(prepareImage): Just call the GdkToolkit method.
* gnu/java/awt/peer/gtk/GtkFramePeer.java:
(setIconImage): Reimplemented.
* gnu/java/awt/peer/gtk/GtkImage.java: Reimplemented.
* gnu/java/awt/peer/gtk/GtkToolkit.java:
(checkImage): Change handling of GtkImage.
(createImage): Reimplemented for GtkImage.
(getColorModel): Return the actual native color model.
(prepareImage): Reimplemented.
* include/Makefile.am,
* native/jni/gtk-peer/Makefile.am: Removed old files, added new ones.
* include/gnu_java_awt_peer_gtk_GdkGraphics.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c:
(initFromImage): New method.
(copyPixmap, flip_pixbuf, copyAndScalePixmap): Removed.
* include/gnu_java_awt_peer_gtk_GtkFramePeer.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c:
(nativeSetIconImage): New method.
(nativeSetIconImageFromData,nativeSetIconImageFromDecoder): Removed.
* gnu/java/awt/peer/gtk/GtkImageConsumer.java,
* include/gnu_java_awt_peer_gtk_GtkImage.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c:
New files.
* gnu/java/awt/peer/gtk/GtkImagePainter.java,
* gnu/java/awt/peer/gtk/GtkOffScreenImage.java,
* include/gnu_java_awt_peer_gtk_GtkImagePainter.h,
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c:
Removed files.
2005-06-01 Tom Tromey <tromey@redhat.com>
* java/io/ObjectInputStream.java (currentLoader): Fixed typo.
2005-06-01 Tom Tromey <tromey@redhat.com>
* org/omg/CosNaming/IstringHelper.java: Changed non-ascii
characters.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/SendingContext/package.html,
org/omg/SendingContext/RunTimeOperations.java,
org/omg/SendingContext/Runtime.java: New package.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/text/DefaultStyledDocument.java
(setLogicalStyle): Implemented this method.
2005-06-01 Sven de Marothy <sven@physto.se>
* java/util/GregorianCalendar.java
(setTimeInMillis): Recompute time fields.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/BindingType.java,
org/omg/CosNaming/NameComponent.java,
org/omg/CosNaming/_BindingIteratorStub.java,
org/omg/CosNaming/_NamingContextStub.java,
org/omg/CosNaming/_NamingContextExtStub.java,
org/omg/CosNaming/_BindingIteratorImplBase.java,
org/omg/CosNaming/_NamingContextImplBase.java: Added SerialVersionUID.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/IstringHelper.java: New class.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/CDR/cdrInput.java (read_wstring): Correcting
check for native encoding.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/basic/BasicFileChooserUI.java
(installComponents): Changed layout of main panel from GridBagLayout
to BorderLayout (as is the case in Suns JDK). This fixes
bug#13244.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java (serveStep),
gnu/CORBA/gnuRequest.java (submit),
gnu/CORBA/CDR/cdrInput.java (read_encapsulation): Correcting
data read loop.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORG.java (getFreePort): Remember
the port number in the local variable.
2005-06-01 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/
communication/ourUserExceptionHelper.java (extract): New method.
* examples/gnu/classpath/examples/CORBA/SimpleCommunication/
communication/RequestTest.java:Use helper extract method.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/JPopupMenu.java
(insert): Do not check for index == -1 at this point, this is done
in java.awt.Container. Catching -1 indices here disturbes the
Container.addImpl which leads to bug #13247 for example.
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/text/PlainDocument.java
(removeUpdate): Fixed indices in call to rootElement.replace().
2005-06-01 Roman Kennke <roman@kennke.org>
* javax/swing/JComponent.java
(processKeyEvent): Call super.processKeyEvent() so that KeyEvents
are delivered to registered KeyListeners.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA_2_3/ORB.java,
org/omg/CORBA_2_3/portable/InputStream.java,
org/omg/CORBA/portable/ValueFactory.java: New classes.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg.CORBA/DynValue.java (declaration): Inherit from DynAny,
org.omg.CORBA.Object. (set_members): Declare it may throw InvalidSeq.
2005-06-01 Sven de Marothy <sven@physto.se>
* java/util/TimeZone (getDefaultTimeZone): Reimplemented.
(parseTime, getDateParams): New private methods.
2005-06-01 David Gilbert <david.gilbert@object-refinery.com>
* gnu/java/awt/GradientPaintContext.java: New file.
* java/awt/GradientPaint.java: Implemented.
* java/awt/image/IndexColorModel.java: Reimplemented.
2005-05-31 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/CDR/BigEndianInputStream.java,
gnu/CORBA/CDR/BigEndianOutputStream.java,
gnu/CORBA/CDR/LittleEndianInputStream.java,
gnu/CORBA/CDR/LittleEndianOutputStream.java: New streams.
gnu/CORBA/CDR/abstractDataInputStream.java,
gnu/CORBA/CDR/abstractDataOutputStream.java: New interfaces.
* gnu/CORBA/IOR.java: Implemented parsing of the Little
Endian encoded IOR references.
* gnu/CORBA/Functional_ORB.java,
gnu/CORBA/binaryReply.java,
gnu/CORBA/gnuRequest.java,
gnu/CORBA/CDR/cdrInput.java,
gnu/CORBA/CDR/cdrOutput.java,
gnu/CORBA/CDR/encapsulatedOutput.java,
gnu/CORBA/GIOP/MessageHeader.java: Implemented support
for Big and Little Endian.
* org/omg/CORBA/package.html: Documentation update.
2005-05-31 Jeroen Frijters <jeroen@frijters.net>
* java/net/ServerSocket.java
(bound): Removed.
(local): New field.
(bind): Cache local socket address.
(getInetAddress, getLocalPort, getLocalSocketAddress, isBound):
Use cached local socket address.
(close): bound field was removed.
2005-05-31 Jeroen Frijters <jeroen@frijters.net>
* gnu/java/nio/channels/FileChannelImpl.java
(FileChannelImpl()): Removed.
(FileChannelImpl(File,int)): Made private.
(create): New method.
* java/io/FileInputStream.java,
java/io/FileOutputStream.java,
java/io/RandomAccessFile.java:
Updated construction of FileChannelImpl instance.
2005-05-31 Sven de Marothy <sven@physto.se>
* java/awt/image/BufferedImage.java:
(ImageProducer): Use Vector instead of HashMap.
* java/awt/image/DirectColorModel.java:
(getAlpha): Default to 255 (opaque).
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JTree.java
(getNextMatch): Implemented new method.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/plaf/metal/MetalSplitPaneUI.java:
(createUI): Do not share one instance of MetalSplitPaneUI
between multiple JSplitPanes.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JComponent.java:
Made JComponent.AccessibleJComponent implement
AccessibleExtendedComponent.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JButton.java
(constructor): Set initial actionCommand equal to the buttons label.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JList.java
(getNextMatch): Implemented new method.
(getCellBounds): Implemented new method.
2005-05-30 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/Functional_ORB.java (serve, portServer, serveStep):
Implemented support for the subsequent invocations reusing the same
socket.
* gnu/CORBA/GIOP/MessageHeader.java (read): throw
NO_IMPLEMENT, not MARSHAL for Little Endian request.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JLayeredPane.java
(putLayer): Implemented new method.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/JFileChooser.java:
Fixed values of some constant fields.
2005-05-30 Roman Kennke <roman@kennke.org>
* javax/swing/SwingUtilities.java:
(getWindowAncestor): This method has to be static instead of
non-static.
2005-05-29 Michael Koch <konqueror@gmx.de>
* java/util/LinkedHashMap.java (access): Set 'root.pred'.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CosNaming/_BindingIteratorImplBase.java ,
org/omg/CosNaming/_NamingContextExtImplBase.java,
org/omg/CosNaming/_NamingContextImplBase.java: Inherit from
DynamicImplementation.
* gnu/CORBA/ServiceRequestAdapter.java: New class.
* gnu/CORBA/gnuNVList.java (add, add_item):
Replacing null by constructed instance.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/Functional_ORB.java (serve, useProperties, init):
Implementing the property-configurable time-outs.
2005-05-29 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* gnu/CORBA/gnuRequest.java (p_invoke): Wrap the received UserException into
UnknownUserException.
* gnu/CORBA/streamReadyHolder.java: New wrapper for UserException.
* org/omg/CORBA/UnknownUserException.java: New exception.
2005-05-27 Roman Kennke <roman@kennke.org>
* javax/swing/AbstractButton.java:
Bumped up serialVersionUID(s) to JDK1.4 compatibility.
* javax/swing/ImageIcon.java: Likewise.
* javax/swing/JFileChooser.java: Likewise.
* javax/swing/JInternalFrame.java: Likewise.
* javax/swing/JMenu.java: Likewise.
* javax/swing/JRadioButton.java: Likewise.
* javax/swing/JScrollPane.java: Likewise.
* javax/swing/JSpinner.java: Likewise.
* javax/swing/JTabbedPane.java: Likewise.
* javax/swing/ImageIcons.java: Likewise.
* javax/swing/JToggleButton.java: Likewise.
* javax/swing/JToolTip.java: Likewise.
* javax/swing/JViewPort.java: Likewise.
* javax/swing/LayoutFocusTraversalPolicy.java: Likewise.
* javax/swing/SpinnerDateModel.java: Likewise.
* javax/swing/TransferHandler.java: Likewise.
2005-05-27 Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/peer/gtk/GtkContainerPeer.java (setFont): Handle
lightweight peers specially.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/ORB.java (create_recursive_sequence_tc): New method.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/DynValue.java: New interface.
2005-05-27 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* omg/org/CORBA/package.html: Documentation update.
2005-05-26 Audrius Meskauskas <AudriusA@Bioinformatics.org>
* org/omg/CORBA/ORB.java (create_basic_dyn_any):
Declare it may throw an InconsistentTypeCode.
(create_dyn_any): Remove wrong exception declaration.
(create_operation_list, create_abstract_interface_tc,
create_native_tc, get_service_information): Implementing these methods.
* org/omg/CORBA/ServerRequest.java (result, except, params, op_name):
Marking deprecated.
Diffstat (limited to 'native/jni')
-rw-r--r-- | native/jni/gtk-peer/Makefile.am | 2 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c | 156 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c | 66 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c | 592 | ||||
-rw-r--r-- | native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c | 168 |
5 files changed, 633 insertions, 351 deletions
diff --git a/native/jni/gtk-peer/Makefile.am b/native/jni/gtk-peer/Makefile.am index bd7826caa..8c3965b1b 100644 --- a/native/jni/gtk-peer/Makefile.am +++ b/native/jni/gtk-peer/Makefile.am @@ -29,7 +29,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \ gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \ gnu_java_awt_peer_gtk_GtkFramePeer.c \ gnu_java_awt_peer_gtk_GtkGenericPeer.c \ - gnu_java_awt_peer_gtk_GtkImagePainter.c \ + gnu_java_awt_peer_gtk_GtkImage.c \ gnu_java_awt_peer_gtk_GtkLabelPeer.c \ gnu_java_awt_peer_gtk_GtkListPeer.c \ gnu_java_awt_peer_gtk_GtkMenuBarPeer.c \ diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c index 99b151126..f80343f22 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c @@ -97,6 +97,32 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__II NSA_SET_PTR (env, obj, g); } +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GdkGraphics_initFromImage + (JNIEnv *env, jobject obj, jobject source) +{ + struct graphics *g; + GdkPixmap *pixmap = + gnu_java_awt_peer_gtk_GtkImage_getPixmap(env, source); + g_assert(pixmap != NULL); + gdk_pixmap_ref (pixmap); + + g = (struct graphics *) malloc (sizeof (struct graphics)); + g->x_offset = g->y_offset = 0; + + gdk_threads_enter (); + + g->drawable = (GdkDrawable *)pixmap; + + g->cm = gdk_drawable_get_colormap (g->drawable); + gdk_colormap_ref (g->cm); + g->gc = gdk_gc_new (g->drawable); + + gdk_threads_leave (); + + NSA_SET_PTR (env, obj, g); +} + /* copy the native state of the peer (GtkWidget *) to the native state of the graphics object */ JNIEXPORT void JNICALL @@ -301,136 +327,6 @@ Java_gnu_java_awt_peer_gtk_GdkGraphics_copyArea } JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics_copyPixmap - (JNIEnv *env, jobject obj, jobject offscreen, - jint x, jint y, jint width, jint height) -{ - struct graphics *g1, *g2; - - g1 = (struct graphics *) NSA_GET_PTR (env, obj); - g2 = (struct graphics *) NSA_GET_PTR (env, offscreen); - - gdk_threads_enter (); - gdk_window_copy_area ((GdkWindow *)g1->drawable, - g1->gc, - x + g1->x_offset, y + g1->y_offset, - (GdkWindow *)g2->drawable, - 0 + g2->x_offset, 0 + g2->y_offset, - width, height); - gdk_flush (); - gdk_threads_leave (); -} - -static void flip_pixbuf (GdkPixbuf *pixbuf, - jboolean flip_x, - jboolean flip_y, - jint width, - jint height) -{ - gint src_rs; - guchar *src_pix; - - src_rs = gdk_pixbuf_get_rowstride (pixbuf); - src_pix = gdk_pixbuf_get_pixels (pixbuf); - - if (flip_x) - { - gint i, channels; - guchar buf[4]; - - channels = gdk_pixbuf_get_has_alpha (pixbuf) ? 4 : 3; - - for (i = 0; i < height; i++) - { - guchar *left = src_pix + i * src_rs; - guchar *right = left + channels * (width - 1); - while (left < right) - { - g_memmove (buf, left, channels); - g_memmove (left, right, channels); - g_memmove (right, buf, channels); - left += channels; - right -= channels; - } - } - } - - if (flip_y) - { - guchar *top = src_pix; - guchar *bottom = top + (height - 1) * src_rs; - gpointer buf = g_malloc (src_rs); - - while (top < bottom) - { - g_memmove (buf, top, src_rs); - g_memmove (top, bottom, src_rs); - g_memmove (bottom, buf, src_rs); - top += src_rs; - bottom -= src_rs; - } - - g_free (buf); - } -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GdkGraphics_copyAndScalePixmap - (JNIEnv *env, jobject obj, jobject offscreen, jboolean flip_x, jboolean flip_y, - jint src_x, jint src_y, jint src_width, jint src_height, - jint dest_x, jint dest_y, jint dest_width, jint dest_height) -{ - struct graphics *g1, *g2; - GdkPixbuf *buf_src, *buf_dest; - - g1 = (struct graphics *) NSA_GET_PTR (env, obj); - g2 = (struct graphics *) NSA_GET_PTR (env, offscreen); - - gdk_threads_enter (); - - buf_src = gdk_pixbuf_get_from_drawable (NULL, - g2->drawable, - g2->cm, - src_x, - src_y, - 0, - 0, - src_width, - src_height); - - buf_dest = gdk_pixbuf_scale_simple (buf_src, - dest_width, - dest_height, - GDK_INTERP_BILINEAR); - - if (flip_x || flip_y) - { - flip_pixbuf (buf_dest, flip_x, flip_y, dest_width, dest_height); - } - - gdk_pixbuf_render_to_drawable (buf_dest, - g1->drawable, - g1->gc, - 0, - 0, - dest_x, - dest_y, - dest_width, - dest_height, - GDK_RGB_DITHER_NORMAL, - 0, - 0); - - g_object_unref (G_OBJECT (buf_src)); - g_object_unref (G_OBJECT (buf_dest)); - - gdk_threads_leave (); -} - - - - -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect (JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height) { diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c index 52da40cae..6671a0526 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c @@ -38,6 +38,10 @@ #include "gtkpeer.h" #include "gnu_java_awt_peer_gtk_GtkFramePeer.h" +/* lives in GtkImage.c */ +GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj); +jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj); + JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer (JNIEnv *env, jobject obj) @@ -156,68 +160,26 @@ Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible } JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder - (JNIEnv *env, jobject obj, jobject decoder) +Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage + (JNIEnv *env, jobject obj, jobject gtkimage) { void *ptr; - GdkPixbufLoader *loader = NULL; - GdkPixbuf *pixbuf = NULL; - - ptr = NSA_GET_PTR (env, obj); - - loader = NSA_GET_PB_PTR (env, decoder); - g_assert (loader != NULL); + GdkPixbuf *pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, gtkimage); - gdk_threads_enter (); - - pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); g_assert (pixbuf != NULL); - gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf); - - gdk_threads_leave (); -} - -static void -free_pixbuf_data (guchar *pixels, gpointer data __attribute__((unused))) -{ - free(pixels); -} - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromData - (JNIEnv *env, jobject obj, jintArray pixelArray, jint width, jint height) -{ - void *ptr; - GdkPixbuf *pixbuf; - jint *pixels; - int pixels_length, i; - guchar *data; - ptr = NSA_GET_PTR (env, obj); - pixels = (*env)->GetIntArrayElements (env, pixelArray, 0); - pixels_length = (*env)->GetArrayLength (env, pixelArray); - - data = malloc (sizeof (guchar) * pixels_length); - for (i = 0; i < pixels_length; i++) - data[i] = (guchar) pixels[i]; - gdk_threads_enter (); - pixbuf = gdk_pixbuf_new_from_data (data, - GDK_COLORSPACE_RGB, - TRUE, - 8, - width, - height, - width*4, - free_pixbuf_data, - NULL); - gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf); - gdk_threads_leave (); + /* if the GtkImage is offscreen, this is a temporary pixbuf which should + be thrown out. */ + if(gnu_java_awt_peer_gtk_GtkImage_isOffScreen(env, gtkimage) == JNI_TRUE) + gdk_pixbuf_unref (pixbuf); - (*env)->ReleaseIntArrayElements(env, pixelArray, pixels, 0); + gdk_threads_leave (); } + + diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c new file mode 100644 index 000000000..df76adb49 --- /dev/null +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImage.c @@ -0,0 +1,592 @@ +/* gtkimage.c + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +#include "gtkpeer.h" +#include "gnu_java_awt_peer_gtk_GtkImage.h" +#include <gdk-pixbuf/gdk-pixbuf.h> + +/* The constant fields in java.awt.Image */ +#define SCALE_DEFAULT 1 +#define SCALE_FAST 2 +#define SCALE_SMOOTH 4 +#define SCALE_REPLICATE 8 +#define SCALE_AREA_AVERAGING 16 + +/* functions used by other gtk peer native routines */ +GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj); +GdkPixmap *gnu_java_awt_peer_gtk_GtkImage_getPixmap(JNIEnv *env, jobject obj); +jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj); + +/* local stuff */ +static GdkInterpType mapHints(jint hints); +static jboolean offScreen (JNIEnv * env, jobject obj); +static void *getData (JNIEnv * env, jobject obj); +static void createRawData (JNIEnv * env, jobject obj, void *ptr); +static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height); + +/** + * Loads a pixmap from a file. + */ +JNIEXPORT jboolean JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_loadPixbuf + (JNIEnv *env, jobject obj, jstring name) +{ + const char *filename; + int width, height; + GdkPixbuf *pixbuf; + + /* Don't use the JCL convert function because it throws an exception + on failure */ + filename = (*env)->GetStringUTFChars (env, name, 0); + + if (filename == NULL) + return JNI_FALSE; + + gdk_threads_enter (); + + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); + if (pixbuf == NULL) + { + gdk_threads_leave (); + (*env)->ReleaseStringUTFChars (env, name, filename); + return JNI_FALSE; + } + + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + gdk_threads_leave (); + + createRawData (env, obj, pixbuf); + setWidthHeight(env, obj, width, height); + (*env)->ReleaseStringUTFChars (env, name, filename); + return JNI_TRUE; +} + +/** + * Returns a copy of the pixel data as a java array. + */ +JNIEXPORT jintArray JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_getPixels(JNIEnv *env, jobject obj) +{ + GdkPixbuf *pixbuf; + int width, height, rowstride; + guchar *pixeldata; + jintArray result_array; + jint *result_array_iter, *dst; + int i; + + gdk_threads_enter (); + + pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, obj); + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + rowstride = gdk_pixbuf_get_rowstride (pixbuf); + + result_array = (*env)->NewIntArray (env, (width * height)); + dst = result_array_iter = + (*env)->GetIntArrayElements (env, result_array, NULL); + + pixeldata = gdk_pixbuf_get_pixels (pixbuf); + for(i = 0 ; i < height; i++) + { + memcpy(dst, (void *)pixeldata, width * 4); + dst += width; + pixeldata += rowstride; + } + + if (offScreen (env, obj) == JNI_TRUE) + gdk_pixbuf_unref (pixbuf); + + gdk_threads_leave (); + + (*env)->ReleaseIntArrayElements (env, result_array, result_array_iter, 0); + return result_array; +} + +/** + * Returns a copy of the pixel data as a java array. + * (GdkPixbuf only) + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_setPixels(JNIEnv *env, jobject obj, + jintArray pixels) +{ + GdkPixbuf *pixbuf = (GdkPixbuf *)getData (env, obj); + int width, height, rowstride; + guchar *pixeldata; + jint *src_array_iter, *src; + int i; + + gdk_threads_enter (); + + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + rowstride = gdk_pixbuf_get_rowstride (pixbuf); + + src = src_array_iter = + (*env)->GetIntArrayElements (env, pixels, NULL); + + pixeldata = gdk_pixbuf_get_pixels (pixbuf); + for(i = 0 ; i < height; i++) + { + memcpy((void *)pixeldata, (void *)src, width * 4); + src += width; + pixeldata += rowstride; + } + + gdk_threads_leave (); + + (*env)->ReleaseIntArrayElements (env, pixels, src_array_iter, 0); +} + +/** + * Allocates a Gtk Pixbuf or Pixmap. + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_createPixmap(JNIEnv *env, jobject obj) +{ + int width, height; + jclass cls; + jfieldID field; + + cls = (*env)->GetObjectClass (env, obj); + field = (*env)->GetFieldID (env, cls, "width", "I"); + g_assert (field != 0); + width = (*env)->GetIntField (env, obj, field); + + field = (*env)->GetFieldID (env, cls, "height", "I"); + g_assert (field != 0); + height = (*env)->GetIntField (env, obj, field); + + gdk_threads_enter (); + if (offScreen (env, obj) == JNI_FALSE) + createRawData (env, obj, gdk_pixbuf_new (GDK_COLORSPACE_RGB, + TRUE, + 8, + width, + height)); + else + createRawData (env, obj, gdk_pixmap_new (NULL, width, height, + gdk_rgb_get_visual ()->depth)); + + gdk_threads_leave (); +} + +/** + * Frees the Gtk Pixmap. + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_freePixmap(JNIEnv *env, jobject obj) +{ + gdk_threads_enter (); + if (offScreen (env, obj) == JNI_FALSE) + gdk_pixbuf_unref ((GdkPixbuf *)getData (env, obj)); + else + gdk_pixmap_unref ((GdkPixmap *)getData (env, obj)); + + gdk_threads_leave (); +} + +/** + * Sets this pixmap to a scaled version of the source pixmap. + * width and height of the destination GtkImage must be set. + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_createScaledPixmap(JNIEnv *env, + jobject destination, + jobject source, + jint hints) +{ + GdkPixbuf* dst; + int width, height; + jclass cls; + jfieldID field; + + GdkPixbuf *pixbuf; + + cls = (*env)->GetObjectClass (env, destination); + field = (*env)->GetFieldID (env, cls, "width", "I"); + g_assert (field != 0); + width = (*env)->GetIntField (env, destination, field); + + field = (*env)->GetFieldID (env, cls, "height", "I"); + g_assert (field != 0); + height = (*env)->GetIntField (env, destination, field); + + gdk_threads_enter (); + + pixbuf = gnu_java_awt_peer_gtk_GtkImage_getPixbuf(env, source); + + dst = gdk_pixbuf_scale_simple(pixbuf, + width, height, + mapHints(hints)); + + if (offScreen (env, source) == JNI_TRUE) + gdk_pixbuf_unref (pixbuf); + + gdk_threads_leave (); + + createRawData (env, destination, (void *)dst); +} + +/** + * Draws the pixbuf at x, y, scaled to width and height and + * optionally composited with a given background color. + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaled + (JNIEnv *env, jobject obj, jobject gc_obj, + jint bg_red, jint bg_green, jint bg_blue, + jint x, jint y, jint width, jint height, jboolean composite) +{ + GdkPixbuf* dst; + struct graphics *g; + guint32 bgColor; + + bgColor = ((bg_red & 0xFF) << 16) | + ((bg_green & 0xFF) << 8) | (bg_blue & 0xFF); + + gdk_threads_enter (); + + g = (struct graphics *) NSA_GET_PTR (env, gc_obj); + + if (!g || !GDK_IS_DRAWABLE (g->drawable)) + { + gdk_threads_leave (); + return; + } + + if (offScreen (env, obj) == JNI_FALSE) + { + GdkPixbuf* pixbuf = (GdkPixbuf *)getData (env, obj); + + /* Scale and composite the image */ + if (composite == JNI_TRUE) + dst = gdk_pixbuf_composite_color_simple (pixbuf, + width, + height, + GDK_INTERP_BILINEAR, + 255, + width, + bgColor, + bgColor); + else + dst = gdk_pixbuf_scale_simple(pixbuf, + width, height, + GDK_INTERP_BILINEAR); + + gdk_draw_pixbuf (g->drawable, + g->gc, + dst, + 0, 0, + x + g->x_offset, y + g->y_offset, + width, height, + GDK_RGB_DITHER_NORMAL, 0, 0); + gdk_pixbuf_unref (dst); + + } else { + /* Get a pixmap */ + GdkPixmap* pixmap = (GdkPixmap *)getData (env, obj); + gdk_draw_drawable (g->drawable, + g->gc, + pixmap, + 0, 0, /* src x,y */ + x + g->x_offset, y + g->y_offset, + width, height); + } + + gdk_threads_leave (); +} + +/** + * Draws the pixbuf at x, y, scaled to width and height and + * optionally composited and/or flipped with a given background color. + */ +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkImage_drawPixelsScaledFlipped +(JNIEnv *env, jobject obj, jobject gc_obj, + jint bg_red, jint bg_green, jint bg_blue, + jboolean flipx, jboolean flipy, + jint srcx, jint srcy, jint srcwidth, jint srcheight, + jint dstx, jint dsty, jint dstwidth, jint dstheight, + jboolean composite) +{ + GdkPixbuf *pixbuf; + GdkPixbuf *tmp, *dst; + struct graphics *g; + guint32 bgColor; + + bgColor = ((bg_red & 0xFF) << 16) | + ((bg_green & 0xFF) << 8) | (bg_blue & 0xFF); + + gdk_threads_enter (); + + g = (struct graphics *) NSA_GET_PTR (env, gc_obj); + + if (!g || !GDK_IS_DRAWABLE (g->drawable)) + { + gdk_threads_leave (); + return; + } + + if (offScreen (env, obj) == JNI_FALSE) + { + pixbuf = (GdkPixbuf *)getData (env, obj); + + /* Get the source area */ + tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, + TRUE, + 8, + srcwidth, + srcheight); + + gdk_pixbuf_copy_area (pixbuf, + srcx, srcy, + srcwidth, srcheight, + tmp, + 0, 0); /* dst x , dst y */ + } else { + /* Get a pixbuf from the pixmap */ + GdkDrawable *pixmap = (GdkDrawable *)getData(env, obj); + tmp = gdk_pixbuf_get_from_drawable (NULL, + pixmap, + gdk_drawable_get_colormap( pixmap ), + srcx, srcy, + 0, 0, /* dst x , dst y */ + srcwidth, srcheight); + } + + /* FIXME: This #if should be discarded once I feel comfortable about + GTK 2.6 dependence */ +#if GTK_MINOR_VERSION > 4 + /* Flip it if necessary. */ + if (flipx == JNI_TRUE) + { + GdkPixbuf *tmp2 = gdk_pixbuf_flip (tmp, TRUE); + gdk_pixbuf_unref (tmp); + tmp = tmp2; + } + if (flipy == JNI_TRUE) + { + GdkPixbuf *tmp2 = gdk_pixbuf_flip (tmp, FALSE); + gdk_pixbuf_unref (tmp); + tmp = tmp2; + } +#endif + + /* Scale and composite the image */ + if (composite == JNI_TRUE) + dst = gdk_pixbuf_composite_color_simple (tmp, + dstwidth, + dstheight, + GDK_INTERP_BILINEAR, + 255, + dstwidth, + bgColor, + bgColor); + else + dst = gdk_pixbuf_scale_simple(tmp, + dstwidth, dstheight, + GDK_INTERP_BILINEAR); + gdk_pixbuf_unref (tmp); + + gdk_draw_pixbuf (g->drawable, + g->gc, + dst, + 0, 0, + dstx + g->x_offset, dsty + g->y_offset, + dstwidth, dstheight, + GDK_RGB_DITHER_NORMAL, 0, 0); + + gdk_pixbuf_unref (dst); + gdk_threads_leave (); +} + +/** + * Used by GtkFramePeer + */ +GdkPixbuf *gnu_java_awt_peer_gtk_GtkImage_getPixbuf(JNIEnv *env, jobject obj) +{ + int width, height; + GdkPixbuf *pixbuf; + GdkPixmap* pixmap; + jclass cls; + jfieldID field; + + if (offScreen (env, obj) == JNI_FALSE) + return (GdkPixbuf *)getData (env, obj); + + cls = (*env)->GetObjectClass (env, obj); + field = (*env)->GetFieldID (env, cls, "width", "I"); + g_assert (field != 0); + width = (*env)->GetIntField (env, obj, field); + + field = (*env)->GetFieldID (env, cls, "height", "I"); + g_assert (field != 0); + height = (*env)->GetIntField (env, obj, field); + + /* Get a pixmap */ + pixmap = (GdkPixmap *)getData (env, obj); + pixbuf = gdk_pixbuf_get_from_drawable (NULL, + pixmap, + gdk_drawable_get_colormap( pixmap ), + 0, 0, /* src x , src y */ + 0, 0, /* dst x , dst y */ + width, height); + return pixbuf; +} + +/** + * Used by GdkGraphics + */ +GdkPixmap *gnu_java_awt_peer_gtk_GtkImage_getPixmap(JNIEnv *env, jobject obj) +{ + if (offScreen (env, obj) == JNI_FALSE) + return NULL; + return (GdkPixmap *)getData (env, obj); +} + +jboolean gnu_java_awt_peer_gtk_GtkImage_isOffScreen(JNIEnv *env, jobject obj) +{ + return offScreen(env, obj); +} + +/** + * Maps java.awt.Image scaling hints to the native GDK ones. + */ +static GdkInterpType mapHints(jint hints) +{ + switch ( hints ) + { + /* For FAST, we use the nearest-neighbor. Fastest and lowest quality. */ + case SCALE_FAST: + case SCALE_REPLICATE: + return GDK_INTERP_NEAREST; + + /* Hyperbolic for smooth. Slowest too. */ + case SCALE_SMOOTH: + return GDK_INTERP_HYPER; + + /* the inbetweenish method */ + case SCALE_AREA_AVERAGING: + return GDK_INTERP_TILES; + + /* default to bilinear */ + } + return GDK_INTERP_BILINEAR; +} + +/* Sets the width and height fields of a GtkImage object. */ +static void setWidthHeight (JNIEnv * env, jobject obj, int width, int height) +{ + jclass cls; + jfieldID field; + + cls = (*env)->GetObjectClass (env, obj); + g_assert (cls != 0); + field = (*env)->GetFieldID (env, cls, "width", "I"); + g_assert (field != 0); + (*env)->SetIntField (env, obj, field, (jint)width); + + field = (*env)->GetFieldID (env, cls, "height", "I"); + g_assert (field != 0); + (*env)->SetIntField (env, obj, field, (jint)height); +} + +/* Returns the value of the offScreen field. */ +static jboolean offScreen (JNIEnv *env, jobject obj) +{ + jclass cls; + jfieldID field; + + cls = (*env)->GetObjectClass (env, obj); + field = (*env)->GetFieldID (env, cls, "offScreen", "Z"); + g_assert (field != 0); + return (*env)->GetBooleanField (env, obj, field); +} + +/* Store and get the pixbuf pointer */ +static void +createRawData (JNIEnv * env, jobject obj, void *ptr) +{ + jclass cls; + jmethodID method; + jobject data; + jfieldID data_fid; + + cls = (*env)->GetObjectClass (env, obj); + data_fid = (*env)->GetFieldID (env, cls, "pixmap", + "Lgnu/classpath/RawData;"); + g_assert (data_fid != 0); + +#if SIZEOF_VOID_P == 8 + cls = (*env)->FindClass (env, "gnu/classpath/RawData64"); + method = (*env)->GetMethodID (env, cls, "<init>", "(J)V"); + data = (*env)->NewObject (env, cls, method, (jlong) ptr); +#else + cls = (*env)->FindClass (env, "gnu/classpath/RawData32"); + method = (*env)->GetMethodID (env, cls, "<init>", "(I)V"); + data = (*env)->NewObject (env, cls, method, (jint) ptr); +#endif + + (*env)->SetObjectField (env, obj, data_fid, data); +} + +static void * +getData (JNIEnv * env, jobject obj) +{ + jclass cls; + jfieldID field; + jfieldID data_fid; + jobject data; + + cls = (*env)->GetObjectClass (env, obj); + data_fid = (*env)->GetFieldID (env, cls, "pixmap", + "Lgnu/classpath/RawData;"); + g_assert (data_fid != 0); + data = (*env)->GetObjectField (env, obj, data_fid); + +#if SIZEOF_VOID_P == 8 + cls = (*env)->FindClass (env, "gnu/classpath/RawData64"); + field = (*env)->GetFieldID (env, cls, "data", "J"); + return (void *) (*env)->GetLongField (env, data, field); +#else + cls = (*env)->FindClass (env, "gnu/classpath/RawData32"); + field = (*env)->GetFieldID (env, cls, "data", "I"); + return (void *) (*env)->GetIntField (env, data, field); +#endif +} diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c deleted file mode 100644 index 4686fed59..000000000 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkImagePainter.c +++ /dev/null @@ -1,168 +0,0 @@ -/* gtkimagepainter.c - Copyright (C) 1999, 2004 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - -#include "gtkpeer.h" -#include "gnu_java_awt_peer_gtk_GtkImagePainter.h" -#include <libart_lgpl/art_misc.h> -#include <libart_lgpl/art_rgb_affine.h> - - -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkImagePainter_drawPixels - (JNIEnv *env, jobject obj __attribute__((unused)), jobject gc_obj, - jint bg_red, jint bg_green, jint bg_blue, jint x, jint y, jint width, - jint height, jintArray jpixels, jint offset, jint scansize, - jdoubleArray jaffine) -{ - struct graphics *g; - jint *pixels, *elems; - guchar *packed; - int i; - jsize num_pixels; - guchar *j_rgba, *c_rgb; - - g = (struct graphics *) NSA_GET_PTR (env, gc_obj); - - if (!jpixels) - return; - - elems = (*env)->GetIntArrayElements (env, jpixels, NULL); - num_pixels = (*env)->GetArrayLength (env, jpixels); - - /* get a copy of the pixel data so we can modify it */ - pixels = malloc (sizeof (jint) * num_pixels); - memcpy (pixels, elems, sizeof (jint) * num_pixels); - - (*env)->ReleaseIntArrayElements (env, jpixels, elems, 0); - -#ifndef WORDS_BIGENDIAN - /* convert pixels from 0xBBGGRRAA to 0xAARRGGBB */ - for (i = 0; i < num_pixels; i++) - pixels[i] = SWAPU32 ((unsigned)pixels[i]); -#endif - - packed = (guchar *) malloc (sizeof (guchar) * 3 * num_pixels); - j_rgba = (guchar *) pixels; - c_rgb = packed; - - /* copy over pixels in DirectColorModel format to 24 bit RGB image data, - and process the alpha channel */ - for (i = 0; i < num_pixels; i++) - { - jint ialpha = *j_rgba++; - - switch (ialpha) - { - case 0: /* full transparency */ - *c_rgb++ = bg_red; - *c_rgb++ = bg_green; - *c_rgb++ = bg_blue; - j_rgba += 3; - break; - case 255: /* opaque */ - *c_rgb++ = *j_rgba++; - *c_rgb++ = *j_rgba++; - *c_rgb++ = *j_rgba++; - break; - default: /* compositing required */ - { - jfloat alpha = ialpha / 255.0; - jfloat comp_alpha = 1.0 - alpha; - - *c_rgb++ = *j_rgba++ * alpha + bg_red * comp_alpha; - *c_rgb++ = *j_rgba++ * alpha + bg_green * comp_alpha; - *c_rgb++ = *j_rgba++ * alpha + bg_blue * comp_alpha; - } - break; - } - } - - if (jaffine) - { - jdouble *affine; - ArtAlphaGamma *alphagamma = NULL; - art_u8 *dst; - int new_width, new_height; - - affine = (*env)->GetDoubleArrayElements (env, jaffine, NULL); - - new_width = abs (width * affine[0]); - new_height = abs (height * affine[3]); - - dst = (art_u8 *) malloc (sizeof (art_u8) * 3 * (new_width * new_height)); - - art_rgb_affine (dst, - 0, 0, - new_width, new_height, - new_width * 3, - (art_u8 *) packed + offset * 3, - width, height, - scansize * 3, - affine, - ART_FILTER_NEAREST, - alphagamma); - - (*env)->ReleaseDoubleArrayElements (env, jaffine, affine, JNI_ABORT); - - free (packed); - packed = (guchar *) dst; - - width = scansize = new_width; - height = new_height; - offset = 0; - } - - gdk_threads_enter (); - - if (!g || !GDK_IS_DRAWABLE (g->drawable)) - { - gdk_threads_leave (); - return; - } - - gdk_draw_rgb_image (g->drawable, - g->gc, - x + g->x_offset, - y + g->y_offset, - width, height, GDK_RGB_DITHER_NORMAL, - packed + offset * 3, scansize * 3); - - gdk_threads_leave (); - - free (pixels); - free (packed); -} |