Ejemplo n.º 1
0
    @Override
    boolean initialize(Surface surface) throws Surface.OutOfResourcesException {
      if (isRequested() && !isEnabled()) {
        initializeEgl();
        mGl = createEglSurface(surface);
        mDestroyed = false;

        if (mGl != null) {
          int err = sEgl.eglGetError();
          if (err != EGL_SUCCESS) {
            destroy(true);
            setRequested(false);
          } else {
            if (mCanvas == null) {
              mCanvas = createCanvas();
            }
            if (mCanvas != null) {
              setEnabled(true);
            } else {
              Log.w(LOG_TAG, "Hardware accelerated Canvas could not be created");
            }
          }

          return mCanvas != null;
        }
      }
      return false;
    }
Ejemplo n.º 2
0
 private void fallback(boolean fallback) {
   destroy(true);
   if (fallback) {
     // we'll try again if it was context lost
     setRequested(false);
     Log.w(
         LOG_TAG,
         "Mountain View, we've had a problem here. " + "Switching back to software rendering.");
   }
 }