< prev index next >

src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java

Print this page




  57         // TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
  58         scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
  59         this.width = width * scale;
  60         this.height = height * scale;
  61     }
  62 
  63     protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc,
  64                              ColorModel cm, int type,int width, int height)
  65     {
  66         this(gc, cm, type, width, height);
  67         this.pView = pView;
  68         this.graphicsConfig = gc;
  69 
  70         long pConfigInfo = gc.getNativeConfigInfo();
  71         long pPeerData = 0L;
  72         boolean isOpaque = true;
  73         if (pView != null) {
  74             pPeerData = pView.getAWTView();
  75             isOpaque = pView.isOpaque();
  76         }

  77         initOps(pConfigInfo, pPeerData, 0, 0, 0, isOpaque);
  78     }
  79 
  80     protected CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
  81                              ColorModel cm, int type,int width, int height)
  82     {
  83         this(gc, cm, type, width, height);
  84         this.graphicsConfig = gc;
  85 
  86         long pConfigInfo = gc.getNativeConfigInfo();
  87         long layerPtr = 0L;
  88         boolean isOpaque = true;
  89         if (layer != null) {
  90             layerPtr = layer.getPointer();
  91             isOpaque = layer.isOpaque();
  92         }

  93         initOps(pConfigInfo, 0, layerPtr, 0, 0, isOpaque);
  94     }
  95 
  96     @Override //SurfaceData
  97     public GraphicsConfiguration getDeviceConfiguration() {
  98         return graphicsConfig;
  99     }
 100 
 101     /**
 102      * Creates a SurfaceData object representing the primary (front) buffer of
 103      * an on-screen Window.
 104      */
 105     public static CGLWindowSurfaceData createData(CPlatformView pView) {
 106         CGLGraphicsConfig gc = getGC(pView);
 107         return new CGLWindowSurfaceData(pView, gc);
 108     }
 109 
 110     /**
 111      * Creates a SurfaceData object representing the intermediate buffer
 112      * between the Java2D flusher thread and the AppKit thread.


 388             long ctx);
 389 
 390     public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) {
 391         SurfaceData sd = ((SunGraphics2D) g).surfaceData;
 392         if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) {
 393             CGLSurfaceData cglsd = (CGLSurfaceData) sd;
 394             return makeCGLContextCurrentOnSurface(cglsd, ctx);
 395         } else {
 396             return false;
 397         }
 398     }
 399 
 400     // additional cleanup
 401     private static native void destroyCGLContext(long ctx);
 402 
 403     public static void destroyOGLContext(long ctx) {
 404         if (ctx != 0L) {
 405             destroyCGLContext(ctx);
 406         }
 407     }





 408 }


  57         // TEXTURE shouldn't be scaled, it is used for managed BufferedImages.
  58         scale = type == TEXTURE ? 1 : gc.getDevice().getScaleFactor();
  59         this.width = width * scale;
  60         this.height = height * scale;
  61     }
  62 
  63     protected CGLSurfaceData(CPlatformView pView, CGLGraphicsConfig gc,
  64                              ColorModel cm, int type,int width, int height)
  65     {
  66         this(gc, cm, type, width, height);
  67         this.pView = pView;
  68         this.graphicsConfig = gc;
  69 
  70         long pConfigInfo = gc.getNativeConfigInfo();
  71         long pPeerData = 0L;
  72         boolean isOpaque = true;
  73         if (pView != null) {
  74             pPeerData = pView.getAWTView();
  75             isOpaque = pView.isOpaque();
  76         }
  77         CGLGraphicsConfig.refPConfigInfo(pConfigInfo);
  78         initOps(pConfigInfo, pPeerData, 0, 0, 0, isOpaque);
  79     }
  80 
  81     protected CGLSurfaceData(CGLLayer layer, CGLGraphicsConfig gc,
  82                              ColorModel cm, int type,int width, int height)
  83     {
  84         this(gc, cm, type, width, height);
  85         this.graphicsConfig = gc;
  86 
  87         long pConfigInfo = gc.getNativeConfigInfo();
  88         long layerPtr = 0L;
  89         boolean isOpaque = true;
  90         if (layer != null) {
  91             layerPtr = layer.getPointer();
  92             isOpaque = layer.isOpaque();
  93         }
  94         CGLGraphicsConfig.refPConfigInfo(pConfigInfo);
  95         initOps(pConfigInfo, 0, layerPtr, 0, 0, isOpaque);
  96     }
  97 
  98     @Override //SurfaceData
  99     public GraphicsConfiguration getDeviceConfiguration() {
 100         return graphicsConfig;
 101     }
 102 
 103     /**
 104      * Creates a SurfaceData object representing the primary (front) buffer of
 105      * an on-screen Window.
 106      */
 107     public static CGLWindowSurfaceData createData(CPlatformView pView) {
 108         CGLGraphicsConfig gc = getGC(pView);
 109         return new CGLWindowSurfaceData(pView, gc);
 110     }
 111 
 112     /**
 113      * Creates a SurfaceData object representing the intermediate buffer
 114      * between the Java2D flusher thread and the AppKit thread.


 390             long ctx);
 391 
 392     public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) {
 393         SurfaceData sd = ((SunGraphics2D) g).surfaceData;
 394         if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) {
 395             CGLSurfaceData cglsd = (CGLSurfaceData) sd;
 396             return makeCGLContextCurrentOnSurface(cglsd, ctx);
 397         } else {
 398             return false;
 399         }
 400     }
 401 
 402     // additional cleanup
 403     private static native void destroyCGLContext(long ctx);
 404 
 405     public static void destroyOGLContext(long ctx) {
 406         if (ctx != 0L) {
 407             destroyCGLContext(ctx);
 408         }
 409     }
 410 
 411     static void dispose(long pData, long pConfigInfo) {
 412         OGLSurfaceData.dispose(pData, pConfigInfo);
 413         CGLGraphicsConfig.deRefPConfigInfo(pConfigInfo);
 414     }
 415 }
< prev index next >