JOGL v2.6.0-rc-20250706
JOGL, High-Performance Graphics Binding for Java™ (public API).
DelegatedUpstreamSurfaceHookWithSurfaceSize.java
Go to the documentation of this file.
1package com.jogamp.nativewindow;
2
3import com.jogamp.nativewindow.NativeSurface;
4import com.jogamp.nativewindow.ProxySurface;
5import com.jogamp.nativewindow.UpstreamSurfaceHook;
6
8 final UpstreamSurfaceHook upstream;
9 final NativeSurface surface;
10
11 /**
12 * @param upstream optional upstream UpstreamSurfaceHook used for {@link #create(ProxySurface)} and {@link #destroy(ProxySurface)}.
13 * @param surface mandatory {@link NativeSurface} used for {@link #getSurfaceWidth(ProxySurface)} and {@link #getSurfaceHeight(ProxySurface)}, not used for {@link #getUpstreamSurface()}.
14 */
16 this.upstream = upstream;
17 this.surface = surface;
18 if(null == surface) {
19 throw new IllegalArgumentException("given surface is null");
20 }
21 }
22
23 /**
24 * {@inheritDoc}
25 * <p>
26 * Returns <code>null</code>.
27 * </p>
28 */
29 @Override
31 return null;
32 }
33
34 @Override
35 public final void create(final ProxySurface s) {
36 if(null != upstream) {
37 upstream.create(s);
38 }
39 }
40
41 @Override
42 public final void destroy(final ProxySurface s) {
43 if(null != upstream) {
44 upstream.destroy(s);
45 }
46 }
47
48 @Override
49 public final int getSurfaceWidth(final ProxySurface s) {
50 return surface.getSurfaceWidth();
51 }
52
53 @Override
54 public final int getSurfaceHeight(final ProxySurface s) {
55 return surface.getSurfaceHeight();
56 }
57
58 @Override
59 public String toString() {
60 final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getSurfaceWidth() + "x" + surface.getSurfaceHeight() ) : "nil";
61 return getClass().getSimpleName()+"["+upstream+", "+us_s+"]";
62 }
63
64}
65
final int getSurfaceHeight(final ProxySurface s)
Returns the height of the upstream surface in pixels, used if ProxySurface#UPSTREAM_PROVIDES_SIZE is ...
final int getSurfaceWidth(final ProxySurface s)
Returns the width of the upstream surface in pixels, used if ProxySurface#UPSTREAM_PROVIDES_SIZE is s...
DelegatedUpstreamSurfaceHookWithSurfaceSize(final UpstreamSurfaceHook upstream, final NativeSurface surface)
final void create(final ProxySurface s)
called within ProxySurface#createNotify() within lock, before using surface.
final NativeSurface getUpstreamSurface()
Returns the optional upstream NativeSurface if used by implementation, otherwise null....
final void destroy(final ProxySurface s)
called within ProxySurface#destroyNotify() within lock, before clearing fields.
Provides low-level information required for hardware-accelerated rendering using a surface in a platf...
int getSurfaceWidth()
Returns the width of the client area excluding insets (window decorations) in pixel units.
long getSurfaceHandle()
Returns the handle to the surface for this NativeSurface.
int getSurfaceHeight()
Returns the height of the client area excluding insets (window decorations) in pixel units.
Provides a mutable NativeSurface, i.e.
Interface allowing upstream caller to pass lifecycle actions and size info to a ProxySurface instance...
void create(ProxySurface s)
called within ProxySurface#createNotify() within lock, before using surface.
void destroy(ProxySurface s)
called within ProxySurface#destroyNotify() within lock, before clearing fields.