Beispiel #1
0
        protected DrawResult Draw(IDrawOperation operation)
        {
            while (TryConsume() != null)
            {
                //throw new InvalidOperationException();
            }

            currentElementIndex = -1;
            currentOperationIndex++;

            DrawResult result = DrawResult.Different;

            bool add = true;

            if (currentOperationIndex >= 0 && currentOperationIndex < operations.Count)
            {
                result = operation.Compare(operations[currentOperationIndex]);

                if (result == DrawResult.Different)
                {
                    // Clear the operations after the current index
                    ClearAfterCurrent();
                }
                else
                {
                    // Copy the elements from the cached operation.
                    operation.CopyFrom(operations[currentOperationIndex]);
                    operations[currentOperationIndex] = operation;
                    add = false;
                }
            }

            if (add)
            {
                operations.Add(operation);
            }

            currentDrawState = result;
            return(result);
        }