@SuppressWarnings("SameParameterValue") // Using same method params as in restrictStateBounds
    @Nullable
    State restrictStateBoundsCopy(State state, State prevState, float pivotX, float pivotY,
            boolean allowOverscroll, boolean allowOverzoom, boolean restrictRotation) {
        tmpState.set(state);
        boolean changed = restrictStateBounds(tmpState, prevState, pivotX, pivotY,
                allowOverscroll, allowOverzoom, restrictRotation);
        return changed ? tmpState.copy() : null;
    }
@ SuppressWarnings ( "SameParameterValue" ) @ Nullable State restrictStateBoundsCopy ( State state , State prevState , float pivotX , float pivotY , boolean allowOverscroll , boolean allowOverzoom , boolean restrictRotation ) { tmpState . set ( state ) ; boolean changed = restrictStateBounds ( tmpState , prevState , pivotX , pivotY , allowOverscroll , allowOverzoom , restrictRotation ) ; return changed ? tmpState . copy ( ) : null ; }
Restricts state's translation and zoom bounds.

@param state State to be restricted
@param prevState Previous state to calculate overscroll and overzoom (optional)
@param pivotX Pivot's X coordinate
@param pivotY Pivot's Y coordinate
@param allowOverscroll Whether overscroll is allowed
@param allowOverzoom Whether overzoom is allowed
@param restrictRotation Whether rotation should be restricted to a nearest N*90 angle
@return End state to animate changes or null if no changes are required.