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