Ejemplo n.º 1
0
  public void onDrawFrame(GL10 unused) {
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);

    Matrix.setIdentityM(mMMatrix, 0);

    boolean stillAnimating = mCrossfadeAnimator.tick();
    stillAnimating |= mBlurAnimator.tick();

    if (mBlurRelatedToArtDetailMode) {
      mCurrentGLPictureSet.recomputeTransformMatrices();
      mNextGLPictureSet.recomputeTransformMatrices();
    }

    float dimAmount = mCurrentGLPictureSet.mDimAmount;
    mCurrentGLPictureSet.drawFrame(1);
    if (mCrossfadeAnimator.isRunning()) {
      dimAmount =
          MathUtil.interpolate(
              dimAmount, mNextGLPictureSet.mDimAmount, mCrossfadeAnimator.currentValue());
      mNextGLPictureSet.drawFrame(mCrossfadeAnimator.currentValue());
    }

    mColorOverlay.setColor(
        Color.argb((int) (dimAmount * mBlurAnimator.currentValue() / mBlurKeyframes), 0, 0, 0));
    mColorOverlay.draw(mMMatrix); // don't need any perspective or anything for color overlay

    if (stillAnimating) {
      mCallbacks.requestRender();
    }
  }
Ejemplo n.º 2
0
 private void onViewportChanged() {
   mCurrentGLPictureSet.recomputeTransformMatrices();
   mNextGLPictureSet.recomputeTransformMatrices();
   if (mSurfaceCreated) {
     mCallbacks.requestRender();
   }
 }
Ejemplo n.º 3
0
 public void onSurfaceChanged(GL10 unused, int width, int height) {
   GLES20.glViewport(0, 0, width, height);
   hintViewportSize(width, height);
   if (!mDemoMode && !mPreview) {
     // Reset art detail viewports
     ArtDetailViewport.getInstance().setViewport(0, 0, 0, 0, 0, false);
     ArtDetailViewport.getInstance().setViewport(1, 0, 0, 0, 0, false);
   }
   mCurrentGLPictureSet.recomputeTransformMatrices();
   mNextGLPictureSet.recomputeTransformMatrices();
   recomputeMaxPrescaledBlurPixels();
 }