public void setImageRotateBitmapResetBase(final RotateBitmap bitmap, final boolean resetSupp) {
    final int viewWidth = getWidth();

    if (viewWidth <= 0) {
      mOnLayoutRunnable =
          new Runnable() {
            public void run() {
              setImageRotateBitmapResetBase(bitmap, resetSupp);
            }
          };
      return;
    }

    if (bitmap.getBitmap() != null) {
      getProperBaseMatrix(bitmap, mBaseMatrix);
      setImageBitmap(bitmap.getBitmap(), bitmap.getRotation());
    } else {
      mBaseMatrix.reset();
      setImageBitmap(null);
    }

    if (resetSupp) {
      mSuppMatrix.reset();
    }
    setImageMatrix(getImageViewMatrix());
    mMaxZoom = maxZoom();
  }
 @Override
 protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
   super.onLayout(changed, left, top, right, bottom);
   mThisWidth = right - left;
   mThisHeight = bottom - top;
   Runnable r = mOnLayoutRunnable;
   if (r != null) {
     mOnLayoutRunnable = null;
     r.run();
   }
   if (mBitmapDisplayed.getBitmap() != null) {
     getProperBaseMatrix(mBitmapDisplayed, mBaseMatrix);
     setImageMatrix(getImageViewMatrix());
   }
 }