Print this page
Added gradle and cmake project


  38 import java.awt.image.BufferedImage;
  39 import java.awt.image.ColorModel;
  40 import java.awt.image.DataBuffer;
  41 import java.awt.image.DirectColorModel;
  42 import java.awt.image.VolatileImage;
  43 import java.awt.image.WritableRaster;
  44 
  45 import sun.awt.CGraphicsConfig;
  46 import sun.awt.CGraphicsDevice;
  47 import sun.awt.image.OffScreenImage;
  48 import sun.awt.image.SunVolatileImage;
  49 import sun.java2d.Disposer;
  50 import sun.java2d.DisposerRecord;
  51 import sun.java2d.Surface;
  52 import sun.java2d.SurfaceData;
  53 import sun.java2d.opengl.OGLContext.OGLContextCaps;
  54 import sun.java2d.pipe.hw.AccelSurface;
  55 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
  56 import sun.java2d.pipe.hw.ContextCapabilities;
  57 import sun.lwawt.LWComponentPeer;

  58 import sun.lwawt.macosx.CPlatformView;
  59 
  60 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
  61 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
  62 import static sun.java2d.opengl.OGLSurfaceData.FBOBJECT;
  63 import static sun.java2d.opengl.OGLSurfaceData.TEXTURE;
  64 
  65 public final class CGLGraphicsConfig extends CGraphicsConfig
  66     implements OGLGraphicsConfig
  67 {
  68     //private static final int kOpenGLSwapInterval =
  69     // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
  70     private static final int kOpenGLSwapInterval = 0; // TODO
  71     private static boolean cglAvailable;
  72     private static ImageCapabilities imageCaps = new CGLImageCaps();
  73 
  74     private int pixfmt;
  75     private BufferCapabilities bufferCaps;
  76     private long pConfigInfo;
  77     private ContextCapabilities oglCaps;


 252         rq.lock();
 253         try {
 254             OGLContext.invalidateCurrentContext();
 255         } finally {
 256             rq.unlock();
 257         }
 258     }
 259 
 260     @Override
 261     public String toString() {
 262         String display = getDevice().getIDstring();
 263         return ("CGLGraphicsConfig[" + display + ", pixfmt=" + pixfmt + "]");
 264     }
 265 
 266     @Override
 267     public SurfaceData createSurfaceData(CPlatformView pView) {
 268         return CGLSurfaceData.createData(pView);
 269     }
 270 
 271     @Override
 272     public SurfaceData createSurfaceData(CGLLayer layer) {
 273         return CGLSurfaceData.createData(layer);
 274     }
 275 
 276     @Override
 277     public Image createAcceleratedImage(Component target,
 278                                         int width, int height)
 279     {
 280         ColorModel model = getColorModel(Transparency.OPAQUE);
 281         WritableRaster wr = model.createCompatibleWritableRaster(width, height);
 282         return new OffScreenImage(target, model, wr,
 283                                   model.isAlphaPremultiplied());
 284     }
 285 
 286     @Override
 287     public void assertOperationSupported(final int numBuffers,
 288                                          final BufferCapabilities caps)
 289             throws AWTException {
 290         // Assume this method is never called with numBuffers != 2, as 0 is
 291         // unsupported, and 1 corresponds to a SingleBufferStrategy which
 292         // doesn't depend on the peer. Screen is considered as a separate
 293         // "buffer".




  38 import java.awt.image.BufferedImage;
  39 import java.awt.image.ColorModel;
  40 import java.awt.image.DataBuffer;
  41 import java.awt.image.DirectColorModel;
  42 import java.awt.image.VolatileImage;
  43 import java.awt.image.WritableRaster;
  44 
  45 import sun.awt.CGraphicsConfig;
  46 import sun.awt.CGraphicsDevice;
  47 import sun.awt.image.OffScreenImage;
  48 import sun.awt.image.SunVolatileImage;
  49 import sun.java2d.Disposer;
  50 import sun.java2d.DisposerRecord;
  51 import sun.java2d.Surface;
  52 import sun.java2d.SurfaceData;
  53 import sun.java2d.opengl.OGLContext.OGLContextCaps;
  54 import sun.java2d.pipe.hw.AccelSurface;
  55 import sun.java2d.pipe.hw.AccelTypedVolatileImage;
  56 import sun.java2d.pipe.hw.ContextCapabilities;
  57 import sun.lwawt.LWComponentPeer;
  58 import sun.lwawt.macosx.CFRetainedResource;
  59 import sun.lwawt.macosx.CPlatformView;
  60 
  61 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_DOUBLEBUFFERED;
  62 import static sun.java2d.opengl.OGLContext.OGLContextCaps.CAPS_EXT_FBOBJECT;
  63 import static sun.java2d.opengl.OGLSurfaceData.FBOBJECT;
  64 import static sun.java2d.opengl.OGLSurfaceData.TEXTURE;
  65 
  66 public final class CGLGraphicsConfig extends CGraphicsConfig
  67     implements OGLGraphicsConfig
  68 {
  69     //private static final int kOpenGLSwapInterval =
  70     // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval;
  71     private static final int kOpenGLSwapInterval = 0; // TODO
  72     private static boolean cglAvailable;
  73     private static ImageCapabilities imageCaps = new CGLImageCaps();
  74 
  75     private int pixfmt;
  76     private BufferCapabilities bufferCaps;
  77     private long pConfigInfo;
  78     private ContextCapabilities oglCaps;


 253         rq.lock();
 254         try {
 255             OGLContext.invalidateCurrentContext();
 256         } finally {
 257             rq.unlock();
 258         }
 259     }
 260 
 261     @Override
 262     public String toString() {
 263         String display = getDevice().getIDstring();
 264         return ("CGLGraphicsConfig[" + display + ", pixfmt=" + pixfmt + "]");
 265     }
 266 
 267     @Override
 268     public SurfaceData createSurfaceData(CPlatformView pView) {
 269         return CGLSurfaceData.createData(pView);
 270     }
 271 
 272     @Override
 273     public SurfaceData createSurfaceData(CFRetainedResource layer) {
 274         return CGLSurfaceData.createData((CGLLayer) layer);
 275     }
 276 
 277     @Override
 278     public Image createAcceleratedImage(Component target,
 279                                         int width, int height)
 280     {
 281         ColorModel model = getColorModel(Transparency.OPAQUE);
 282         WritableRaster wr = model.createCompatibleWritableRaster(width, height);
 283         return new OffScreenImage(target, model, wr,
 284                                   model.isAlphaPremultiplied());
 285     }
 286 
 287     @Override
 288     public void assertOperationSupported(final int numBuffers,
 289                                          final BufferCapabilities caps)
 290             throws AWTException {
 291         // Assume this method is never called with numBuffers != 2, as 0 is
 292         // unsupported, and 1 corresponds to a SingleBufferStrategy which
 293         // doesn't depend on the peer. Screen is considered as a separate
 294         // "buffer".