/// <summary> /// Merge this state with another one. /// </summary> /// <param name="state"> /// A <see cref="IGraphicsState"/> having the same <see cref="GraphicsState.StateIdentifier"/> of this state. /// </param> /// <remarks> /// <para> /// After a call to this routine, this IGraphicsState store the union of the previous information /// and of the information of <paramref name="state"/>. /// </para> /// <para> /// The semantic of the merge result is dependent on the actual implementation of this IGraphicsState. Normally /// the merge method will copy <paramref name="state"/> into this IGraphicsState, but other state could do /// different operations. /// </para> /// </remarks> public override void Merge(IGraphicsState state) { if (state == null) { throw new ArgumentNullException("state"); } if (state.StateIdentifier != StateId) { throw new ArgumentException("state id mismatch", "state"); } ViewportState previousState = (ViewportState)state; ViewportSize = previousState.ViewportSize; }
/// <summary> /// Indicates whether the current object is equal to another object of the same type. /// </summary> /// <param name="other"> /// A <see cref="GraphicsState"/> to compare to this GraphicsState. /// </param> /// <returns> /// It returns true if the current object is equal to <paramref name="other"/>. /// </returns> /// <remarks> /// <para> /// This method test only whether <paramref name="other"/> type equals to this type. /// </para> /// </remarks> /// <exception cref="ArgumentNullException"> /// This exception is thrown if the parameter <paramref name="other"/> is null. /// </exception> public override bool Equals(IGraphicsState other) { if (base.Equals(other) == false) { return(false); } Debug.Assert(other is ViewportState); ViewportState otherState = (ViewportState)other; if (ViewportSize != otherState.ViewportSize) { return(false); } return(true); }