question: public void limitTransAndScale ( Matrix matrix , RectF content ) { matrix . getValues ( matrixBuffer ) ; float curTransX = matrixBuffer [ Matrix . MTRANS_X ] ; float curScaleX = matrixBuffer [ Matrix . MSCALE_X ] ; float curTransY = matrixBuffer [ Matrix . MTRANS_Y ] ; float curScaleY = matrixBuffer [ Matrix . MSCALE_Y ] ; mScaleX = Math . min ( Math . max ( mMinScaleX , curScaleX ) , mMaxScaleX ) ; mScaleY = Math . min ( Math . max ( mMinScaleY , curScaleY ) , mMaxScaleY ) ; float width = 0f ; float height = 0f ; if ( content != null ) { width = content . width ( ) ; height = content . height ( ) ; } float maxTransX = - width * ( mScaleX - 1f ) ; mTransX = Math . min ( Math . max ( curTransX , maxTransX - mTransOffsetX ) , mTransOffsetX ) ; float maxTransY = height * ( mScaleY - 1f ) ; mTransY = Math . max ( Math . min ( curTransY , maxTransY + mTransOffsetY ) , - mTransOffsetY ) ; matrixBuffer [ Matrix . MTRANS_X ] = mTransX ; matrixBuffer [ Matrix . MSCALE_X ] = mScaleX ; matrixBuffer [ Matrix . MTRANS_Y ] = mTransY ; matrixBuffer [ Matrix . MSCALE_Y ] = mScaleY ; matrix . setValues ( matrixBuffer ) ; }
target:  limits the maximum scale and X translation of the given matrix