/** Default implementation to handle repaint events from the windowing system */ protected final void defaultWindowRepaintOp() { final GLDrawable _drawable = drawable; if (null != _drawable && _drawable.isRealized()) { if (!_drawable.getNativeSurface().isSurfaceLockedByOtherThread() && !helper.isAnimatorAnimatingOnOtherThread()) { display(); } } }
@Override public final void setRealized(boolean realized) { final RecursiveLock _lock = getLock(); _lock.lock(); try { final GLDrawable _drawable = drawable; if (null == _drawable || realized && (0 >= _drawable.getWidth() || 0 >= _drawable.getHeight())) { return; } _drawable.setRealized(realized); if (realized && _drawable.isRealized()) { sendReshape = true; // ensure a reshape is being send .. } } finally { _lock.unlock(); } }
/** * @param drawable a valid and already realized {@link GLDrawable} * @param context a valid {@link GLContext}, may not be made current (created) yet. * @param upstreamWidget optional UI element holding this instance, see {@link * #getUpstreamWidget()}. * @param ownDevice pass <code>true</code> if {@link AbstractGraphicsDevice#close()} shall be * issued, otherwise pass <code>false</code>. Closing the device is required in case the * drawable is created w/ it's own new instance, e.g. offscreen drawables, and no further * lifecycle handling is applied. * @param lock optional custom {@link RecursiveLock}. */ public GLAutoDrawableDelegate( GLDrawable drawable, GLContext context, Object upstreamWidget, boolean ownDevice, RecursiveLock lock) { super((GLDrawableImpl) drawable, (GLContextImpl) context, ownDevice); if (null == drawable) { throw new IllegalArgumentException("null drawable"); } if (null == context) { throw new IllegalArgumentException("null context"); } if (!drawable.isRealized()) { throw new IllegalArgumentException("drawable not realized"); } this.upstreamWidget = upstreamWidget; this.lock = (null != lock) ? lock : LockFactory.createRecursiveLock(); }
@Override public final boolean isRealized() { final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.isRealized() : false; }