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 static sun.java2d.opengl.OGLSurfaceData.*; 58 import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; 59 import sun.java2d.pipe.hw.AccelDeviceEventListener; 60 import sun.java2d.pipe.hw.AccelDeviceEventNotifier; 61 62 import sun.lwawt.LWComponentPeer; 63 import sun.lwawt.macosx.CPlatformView; 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; 78 private OGLContext context; 79 private final Object disposerReferent = new Object(); 80 private final int maxTextureSize; 388 transparency, type); 389 Surface sd = vi.getDestSurface(); 390 if (!(sd instanceof AccelSurface) || 391 ((AccelSurface)sd).getType() != type) 392 { 393 vi.flush(); 394 vi = null; 395 } 396 397 return vi; 398 } 399 400 /** 401 * {@inheritDoc} 402 * 403 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities 404 */ 405 @Override 406 public ContextCapabilities getContextCapabilities() { 407 return oglCaps; 408 } 409 410 @Override 411 public void addDeviceEventListener(AccelDeviceEventListener l) { 412 int displayID = getDevice().getCGDisplayID(); 413 AccelDeviceEventNotifier.addListener(l, displayID); 414 } 415 416 @Override 417 public void removeDeviceEventListener(AccelDeviceEventListener l) { 418 AccelDeviceEventNotifier.removeListener(l); 419 } 420 421 @Override 422 public int getMaxTextureWidth() { 423 return Math.max(maxTextureSize / getDevice().getScaleFactor(), 424 getBounds().width); 425 } 426 427 @Override 428 public int getMaxTextureHeight() { 429 return Math.max(maxTextureSize / getDevice().getScaleFactor(), 430 getBounds().height); 431 } 432 } | 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 static sun.java2d.opengl.OGLSurfaceData.*; 58 import static sun.java2d.opengl.OGLContext.OGLContextCaps.*; 59 60 import sun.lwawt.LWComponentPeer; 61 import sun.lwawt.macosx.CPlatformView; 62 63 public final class CGLGraphicsConfig extends CGraphicsConfig 64 implements OGLGraphicsConfig 65 { 66 //private static final int kOpenGLSwapInterval = 67 // RuntimeOptions.getCurrentOptions().OpenGLSwapInterval; 68 private static final int kOpenGLSwapInterval = 0; // TODO 69 private static boolean cglAvailable; 70 private static ImageCapabilities imageCaps = new CGLImageCaps(); 71 72 private int pixfmt; 73 private BufferCapabilities bufferCaps; 74 private long pConfigInfo; 75 private ContextCapabilities oglCaps; 76 private OGLContext context; 77 private final Object disposerReferent = new Object(); 78 private final int maxTextureSize; 386 transparency, type); 387 Surface sd = vi.getDestSurface(); 388 if (!(sd instanceof AccelSurface) || 389 ((AccelSurface)sd).getType() != type) 390 { 391 vi.flush(); 392 vi = null; 393 } 394 395 return vi; 396 } 397 398 /** 399 * {@inheritDoc} 400 * 401 * @see sun.java2d.pipe.hw.AccelGraphicsConfig#getContextCapabilities 402 */ 403 @Override 404 public ContextCapabilities getContextCapabilities() { 405 return oglCaps; 406 } 407 408 @Override 409 public int getMaxTextureWidth() { 410 return Math.max(maxTextureSize / getDevice().getScaleFactor(), 411 getBounds().width); 412 } 413 414 @Override 415 public int getMaxTextureHeight() { 416 return Math.max(maxTextureSize / getDevice().getScaleFactor(), 417 getBounds().height); 418 } 419 } |