Esempio n. 1
0
        public unsafe bool Redraw()
        {
            if (AnyControlNeedsRedraw())
            {
                // HACK : This happens when we have a dialog open, like the NSF dialog.
                if (controls[0].App.Project == null)
                {
                    return(true);
                }

                gfx.BeginDrawFrame();

                foreach (var control in controls)
                {
                    gfx.BeginDrawControl(new System.Drawing.Rectangle(control.Left, control.Top, control.Width, control.Height), height);
                    control.Render(gfx);
                    control.ClearDirtyFlag();
                }

                gfx.EndDrawFrame();

                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private void RenderControl(GLControl ctrl)
        {
            var fullscreenViewport = ctrl.WantsFullScreenViewport;

            if (fullscreenViewport)
            {
                gfx.BeginDrawControl(new System.Drawing.Rectangle(0, 0, width, height), height);
            }
            else
            {
                gfx.BeginDrawControl(new System.Drawing.Rectangle(ctrl.Left, ctrl.Top, ctrl.Width, ctrl.Height), height);
            }

            gfx.SetLineBias(2);

            if (fullscreenViewport)
            {
                gfx.Transform.PushTranslation(ctrl.Left, ctrl.Top);
            }

            var t0 = DateTime.Now;

            ctrl.Render(gfx);
            var t1 = DateTime.Now;

            if (ShowRenderingTimes)
            {
                var cmd = gfx.CreateCommandList();
                cmd.DrawText($"{(t1 - t0).TotalMilliseconds}", res.FontVeryLargeBold, 10, 10, gfx.GetSolidBrush(System.Drawing.Color.SpringGreen));
                gfx.DrawCommandList(cmd);
            }

            if (fullscreenViewport)
            {
                gfx.Transform.PopTransform();
            }

            gfx.EndDrawControl();

            ctrl.ClearDirtyFlag();
        }