Print this page
Added gradle and cmake project


  37 import java.awt.image.ImageProducer;
  38 import java.awt.image.VolatileImage;
  39 
  40 import java.awt.peer.ComponentPeer;
  41 import java.awt.peer.ContainerPeer;
  42 
  43 import java.awt.peer.KeyboardFocusManagerPeer;
  44 import java.util.concurrent.atomic.AtomicBoolean;
  45 import java.lang.reflect.Field;
  46 import java.security.AccessController;
  47 import java.security.PrivilegedAction;
  48 
  49 import sun.awt.*;
  50 
  51 import sun.awt.event.IgnorePaintEvent;
  52 
  53 import sun.awt.image.SunVolatileImage;
  54 import sun.awt.image.ToolkitImage;
  55 
  56 import sun.java2d.SunGraphics2D;


  57 import sun.java2d.opengl.OGLRenderQueue;
  58 import sun.java2d.pipe.Region;
  59 

  60 import sun.util.logging.PlatformLogger;
  61 
  62 import javax.swing.JComponent;
  63 import javax.swing.SwingUtilities;
  64 import javax.swing.RepaintManager;
  65 
  66 import com.sun.java.swing.SwingUtilities3;
  67 
  68 public abstract class LWComponentPeer<T extends Component, D extends JComponent>
  69     implements ComponentPeer, DropTargetPeer
  70 {
  71     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer");
  72 
  73     /**
  74      * State lock is to be used for modifications to this peer's fields (e.g.
  75      * bounds, background, font, etc.) It should be the last lock in the lock
  76      * chain
  77      */
  78     private final Object stateLock = new Object();
  79 


1401         return false;
1402     }
1403 
1404     /**
1405      * Paints the peer. Delegate the actual painting to Swing components.
1406      */
1407     protected final void paintPeer(final Graphics g) {
1408         final D delegate = getDelegate();
1409         if (delegate != null) {
1410             if (!SwingUtilities.isEventDispatchThread()) {
1411                 throw new InternalError("Painting must be done on EDT");
1412             }
1413             synchronized (getDelegateLock()) {
1414                 // JComponent.print() is guaranteed to not affect the double buffer
1415                 getDelegate().print(g);
1416             }
1417         }
1418     }
1419 
1420     protected static final void flushOnscreenGraphics(){
1421         final OGLRenderQueue rq = OGLRenderQueue.getInstance();

1422         rq.lock();
1423         try {
1424             rq.flushNow();
1425         } finally {
1426             rq.unlock();
1427         }
1428     }
1429 
1430     /**
1431      * Used by ContainerPeer to skip all the paint events during layout.
1432      *
1433      * @param isLayouting layouting state.
1434      */
1435     protected final void setLayouting(final boolean isLayouting) {
1436         this.isLayouting = isLayouting;
1437     }
1438 
1439     /**
1440      * Returns layouting state. Used by ComponentPeer to skip all the paint
1441      * events during layout.


  37 import java.awt.image.ImageProducer;
  38 import java.awt.image.VolatileImage;
  39 
  40 import java.awt.peer.ComponentPeer;
  41 import java.awt.peer.ContainerPeer;
  42 
  43 import java.awt.peer.KeyboardFocusManagerPeer;
  44 import java.util.concurrent.atomic.AtomicBoolean;
  45 import java.lang.reflect.Field;
  46 import java.security.AccessController;
  47 import java.security.PrivilegedAction;
  48 
  49 import sun.awt.*;
  50 
  51 import sun.awt.event.IgnorePaintEvent;
  52 
  53 import sun.awt.image.SunVolatileImage;
  54 import sun.awt.image.ToolkitImage;
  55 
  56 import sun.java2d.SunGraphics2D;
  57 import sun.java2d.macos.MacOSFlags;
  58 import sun.java2d.metal.MTLRenderQueue;
  59 import sun.java2d.opengl.OGLRenderQueue;
  60 import sun.java2d.pipe.Region;
  61 
  62 import sun.java2d.pipe.RenderQueue;
  63 import sun.util.logging.PlatformLogger;
  64 
  65 import javax.swing.JComponent;
  66 import javax.swing.SwingUtilities;
  67 import javax.swing.RepaintManager;
  68 
  69 import com.sun.java.swing.SwingUtilities3;
  70 
  71 public abstract class LWComponentPeer<T extends Component, D extends JComponent>
  72     implements ComponentPeer, DropTargetPeer
  73 {
  74     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer");
  75 
  76     /**
  77      * State lock is to be used for modifications to this peer's fields (e.g.
  78      * bounds, background, font, etc.) It should be the last lock in the lock
  79      * chain
  80      */
  81     private final Object stateLock = new Object();
  82 


1404         return false;
1405     }
1406 
1407     /**
1408      * Paints the peer. Delegate the actual painting to Swing components.
1409      */
1410     protected final void paintPeer(final Graphics g) {
1411         final D delegate = getDelegate();
1412         if (delegate != null) {
1413             if (!SwingUtilities.isEventDispatchThread()) {
1414                 throw new InternalError("Painting must be done on EDT");
1415             }
1416             synchronized (getDelegateLock()) {
1417                 // JComponent.print() is guaranteed to not affect the double buffer
1418                 getDelegate().print(g);
1419             }
1420         }
1421     }
1422 
1423     protected static final void flushOnscreenGraphics(){
1424         RenderQueue rq = MacOSFlags.isMetalEnabled() ?
1425                 MTLRenderQueue.getInstance() : OGLRenderQueue.getInstance();
1426         rq.lock();
1427         try {
1428             rq.flushNow();
1429         } finally {
1430             rq.unlock();
1431         }
1432     }
1433 
1434     /**
1435      * Used by ContainerPeer to skip all the paint events during layout.
1436      *
1437      * @param isLayouting layouting state.
1438      */
1439     protected final void setLayouting(final boolean isLayouting) {
1440         this.isLayouting = isLayouting;
1441     }
1442 
1443     /**
1444      * Returns layouting state. Used by ComponentPeer to skip all the paint
1445      * events during layout.