Example #1
0
        /// <summary>
        /// Tests the <see cref="RenderingExtensions.DrawClippedLine" /> method.
        /// </summary>
        /// <param name="n">The number of points.</param>
        /// <param name="m">The number of repetitions.</param>
        /// <param name="useOutputBuffer"><c>true</c> to use an output buffer.</param>
        /// <returns>The elapsed time in milliseconds.</returns>
        public static double TestDrawClippedLine(int n, int m, bool useOutputBuffer)
        {
            var points = new ScreenPoint[n];

            for (int i = 0; i < n; i++)
            {
                points[i] = new ScreenPoint((double)i / n, Math.Sin(40d * i / n));
            }

            var clippingRectangle = new OxyRect(0.3, -0.5, 0.5, 1);
            var rc           = new EmptyRenderContext();
            var outputBuffer = useOutputBuffer ? new List <ScreenPoint>(n) : null;
            var stopwatch    = Stopwatch.StartNew();

            for (int i = 0; i < m; i++)
            {
                rc.DrawClippedLine(
                    clippingRectangle,
                    points,
                    1,
                    OxyColors.Black,
                    1,
                    null,
                    LineJoin.Miter,
                    false,
                    outputBuffer);
            }

            stopwatch.Stop();
            Console.WriteLine((double)stopwatch.ElapsedMilliseconds);
            return(stopwatch.ElapsedMilliseconds);
        }
Example #2
0
        public static double TestModelRender(PlotModel model, int m = 100)
        {
            var rc = new EmptyRenderContext();
            var stopwatch = Stopwatch.StartNew();
            for (int i = 0; i < m; i++)
            {
                ((IPlotModel)model).Render(rc, 800, 600);
            }

            stopwatch.Stop();
            Console.WriteLine("Render: {0}", (double)stopwatch.ElapsedMilliseconds);
            return stopwatch.ElapsedMilliseconds;
        }
Example #3
0
        public static double TestModelRender(PlotModel model, int m = 100)
        {
            var rc        = new EmptyRenderContext();
            var stopwatch = Stopwatch.StartNew();

            for (int i = 0; i < m; i++)
            {
                ((IPlotModel)model).Render(rc, 800, 600);
            }

            stopwatch.Stop();
            Console.WriteLine("Render: {0}", (double)stopwatch.ElapsedMilliseconds);
            return(stopwatch.ElapsedMilliseconds);
        }
Example #4
0
        /// <summary>
        /// Tests the <see cref="RenderingExtensions.DrawClippedLine" /> method.
        /// </summary>
        /// <param name="n">The number of points.</param>
        /// <param name="m">The number of repetitions.</param>
        /// <param name="useOutputBuffer"><c>true</c> to use an output buffer.</param>
        /// <returns>The elapsed time in milliseconds.</returns>
        public static double TestDrawClippedLine(int n, int m, bool useOutputBuffer)
        {
            var points = new ScreenPoint[n];
            for (int i = 0; i < n; i++)
            {
                points[i] = new ScreenPoint((double)i / n, Math.Sin(40d * i / n));
            }

            var clippingRectangle = new OxyRect(0.3, -0.5, 0.5, 1);
            var rc = new EmptyRenderContext();
            var outputBuffer = useOutputBuffer ? new List<ScreenPoint>(n) : null;
            var stopwatch = Stopwatch.StartNew();
            for (int i = 0; i < m; i++)
            {
                rc.DrawClippedLine(
                    clippingRectangle,
                    points,
                    1,
                    OxyColors.Black,
                    1,
                    null,
                    OxyPenLineJoin.Miter,
                    false,
                    outputBuffer);
            }

            stopwatch.Stop();
            Console.WriteLine((double)stopwatch.ElapsedMilliseconds);
            return stopwatch.ElapsedMilliseconds;
        }