On Wed, 5 May 2021 07:34:12 GMT, Jayathirth D V <j...@openjdk.org> wrote:
>> src/java.desktop/macosx/classes/sun/java2d/opengl/CGLLayer.java line 60: >> >>> 58: return ptr; >>> 59: } >>> 60: >> >> dispose and getBounds(probably some others) seems to have the same >> implementation in both classes? > > In dispose() we call validate which internally calls corresponding > RenderQueue's of OpenGL/Metal, thats why it is not moved to CFLayer. > For other getters since initialization of peer was happening in individual > subclasses(which in turn calls OpenGL/Metal native initialization) i had kept > getters also in subclasses, but we can move getters to CFLayer. I have > updated the PR. You can add a new abstract method to the parent class: getRenderQueue(), and override it in subclasses to call MTLRenderQueue/OGL.getInstance(); In this way, you can push to the parent more methods by calling just this new getRenderQueue(). I think the only methods which cannot be pushe dto the parent is replaceSurfaceData() due to insets usage. ------------- PR: https://git.openjdk.java.net/jdk/pull/3851