[OpenJDK 2D-Dev] hg: macosx-port/macosx-port/jdk: Some cleanup in CAOpenGLLayer prototype (including extracting layer code into CGLLayer.h|m and removing stale code)
swingler at apple.com
Fri Oct 12 01:09:16 UTC 2012
If you were a regular Cocoa app that had standard NSButtons, NSTextFields, and NSScrollViews, I'd say yes - you are doing it wrong...but since you tightly control your own view hierarchy, I don't think this is a problem. The CAOpenGLLayer breaks a lot of the standard rules anyway, and standard NSViews don't render into it anyway.
Perhaps overriding your own -[NSView makeBackingLayer] a better approach - but unless you suspect this is actually a source of bugs or leaks, I'd say don't worry about it.
On Oct 11, 2012, at 4:44 AM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
> Hi Mike, Phil, Dmitry, Scott.
> I have a question about our CALayer implementation. According to the code below we use layer-backed NSView.
> [self setWantsLayer: YES];
> [self.layer addSublayer: (CALayer *)cglLayer];
> But in the documentation for NSView.setWantsLayer: "When using layer-backed views you should never interact directly with the layer"
> So we use layer-backed NSView and add our CAOpenGLLayer to the backed layer as sublayer.
> Because of that we use NSView.drawRect and CAOpenGLLayer.drawInCGLContext simultaneously, I guess this is incorrect.
> Is this configuration supported by Apple?
> Should we change our implementation to layer-hosting view or probably we can use layer-backed view with appropriate NSView.makeBackingLayer()?
> 01.09.2011 13:11, dmitry.cherepanov at oracle.com wrote:
>> Changeset: c6eecbe2396f
>> Author: dcherepanov
>> Date: 2011-09-01 13:08 +0400
>> URL: http://hg.openjdk.java.net/macosx-port/macosx-port/jdk/rev/c6eecbe2396f
>> Some cleanup in CAOpenGLLayer prototype (including extracting layer code into CGLLayer.h|m and removing stale code)
>> ! make/sun/lwawt/FILES_c_macosx.gmk
>> ! make/sun/lwawt/FILES_c_macosx.gmk.all
>> ! src/macosx/classes/sun/java2d/opengl/CGLGraphicsConfig.java
>> - src/macosx/classes/sun/java2d/opengl/CGLRenderQueue.java
>> ! src/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java
>> ! src/macosx/classes/sun/lwawt/macosx/CPlatformView.java
>> ! src/macosx/native/sun/awt/AWTView.h
>> ! src/macosx/native/sun/awt/AWTView.m
>> ! src/macosx/native/sun/awt/ThreadUtilities.m
>> ! src/macosx/native/sun/java2d/opengl/CGLGraphicsConfig.m
>> + src/macosx/native/sun/java2d/opengl/CGLLayer.h
>> + src/macosx/native/sun/java2d/opengl/CGLLayer.m
>> ! src/macosx/native/sun/java2d/opengl/CGLSurfaceData.m
>> ! src/share/classes/sun/java2d/opengl/OGLRenderQueue.java
>> ! src/share/classes/sun/java2d/pipe/BufferedContext.java
>> ! src/share/native/sun/java2d/opengl/OGLSurfaceData.h
>> - test/experimental/layers/ButtonTest.java
> Best regards, Sergey.
More information about the 2d-dev