コード例 #1
0
        public int NextSlowFrame(int startIndex)
        {
            if (SlowFrames.Count == 0 || startIndex >= Frames.Count - 1)
            {
                return(-1);
            }
            if (startIndex >= SlowFrames.Last().FrameIndex)
            {
                return(-1);
            }
            Debug.Assert(startIndex <= Frames.Count);
            var index = SlowFrames.BinarySearch(startIndex, f => f.FrameIndex);

            if (index < 0)
            {
                index = (-index) - 1;
            }

            return(SlowFrames[index + 1].FrameIndex);
        }
コード例 #2
0
        public int PrevSlowFrame(int startIndex)
        {
            if (startIndex == 0 || SlowFrames.Count == 0 || startIndex >= Frames.Count - 1)
            {
                return(-1);
            }
            if (startIndex <= SlowFrames[0].FrameIndex)
            {
                return(-1);
            }
            Debug.Assert(startIndex <= Frames.Count);
            var index = SlowFrames.BinarySearch(startIndex - 1, f => f.FrameIndex);

            if (index < 0)
            {
                index = -index;
            }
            if (SlowFrames[index].FrameIndex == startIndex)
            {
                index--;
            }
            return(index >= 0 ? SlowFrames[index].FrameIndex : -1);
        }