예제 #1
0
  @Override
  public final void create(ProxySurface surface) {
    final String dbgPrefix;
    if (DEBUG) {
      dbgPrefix =
          getThreadName()
              + ": EGLUpstreamSurfaceHook.create( up "
              + upstreamSurface.getClass().getSimpleName()
              + " -> this "
              + surface.getClass().getSimpleName()
              + " ): ";
      System.err.println(dbgPrefix + this);
    } else {
      dbgPrefix = null;
    }

    if (upstreamSurface instanceof ProxySurface) {
      // propagate createNotify(..) so upstreamSurface will be created
      ((ProxySurface) upstreamSurface).createNotify();
    }

    // lock upstreamSurface, so it can be used in case EGLDisplay is derived from it!
    if (NativeSurface.LOCK_SURFACE_NOT_READY >= upstreamSurface.lockSurface()) {
      throw new GLException("Could not lock: " + upstreamSurface);
    }
    try {
      evalUpstreamSurface(dbgPrefix, surface);
    } finally {
      upstreamSurface.unlockSurface();
    }
  }