51 public CGLLayer(LWWindowPeer peer) { 52 super(0, true); 53 54 setPtr(nativeCreateLayer()); 55 this.peer = peer; 56 } 57 58 public long getPointer() { 59 return ptr; 60 } 61 62 public Rectangle getBounds() { 63 return peer.getBounds(); 64 } 65 66 public GraphicsConfiguration getGraphicsConfiguration() { 67 return peer.getGraphicsConfiguration(); 68 } 69 70 public boolean isOpaque() { 71 return peer.isOpaque(); 72 } 73 74 public int getTransparency() { 75 return (peer.isOpaque() ? Transparency.OPAQUE : Transparency.TRANSLUCENT); 76 } 77 78 public Object getDestination() { 79 return peer; 80 } 81 82 public SurfaceData replaceSurfaceData() { 83 if (peer.getBounds().isEmpty()) { 84 surfaceData = NullSurfaceData.theInstance; 85 return surfaceData; 86 } 87 88 // the layer redirects all painting to the buffer's graphics 89 // and blits the buffer to the layer surface (in drawInCGLContext callback) 90 CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration(); 91 surfaceData = gc.createSurfaceData(this); 92 93 // the layer holds a reference to the buffer, which in 94 // turn has a reference back to this layer 95 if (surfaceData instanceof CGLSurfaceData) { | 51 public CGLLayer(LWWindowPeer peer) { 52 super(0, true); 53 54 setPtr(nativeCreateLayer()); 55 this.peer = peer; 56 } 57 58 public long getPointer() { 59 return ptr; 60 } 61 62 public Rectangle getBounds() { 63 return peer.getBounds(); 64 } 65 66 public GraphicsConfiguration getGraphicsConfiguration() { 67 return peer.getGraphicsConfiguration(); 68 } 69 70 public boolean isOpaque() { 71 return !peer.isTranslucent(); 72 } 73 74 public int getTransparency() { 75 return peer.isTranslucent() ? Transparency.TRANSLUCENT : 76 Transparency.OPAQUE; 77 } 78 79 public Object getDestination() { 80 return peer; 81 } 82 83 public SurfaceData replaceSurfaceData() { 84 if (peer.getBounds().isEmpty()) { 85 surfaceData = NullSurfaceData.theInstance; 86 return surfaceData; 87 } 88 89 // the layer redirects all painting to the buffer's graphics 90 // and blits the buffer to the layer surface (in drawInCGLContext callback) 91 CGraphicsConfig gc = (CGraphicsConfig)peer.getGraphicsConfiguration(); 92 surfaceData = gc.createSurfaceData(this); 93 94 // the layer holds a reference to the buffer, which in 95 // turn has a reference back to this layer 96 if (surfaceData instanceof CGLSurfaceData) { |