From 26cb42fbd4e0d96237bd3bc0fcf7ebd83b6e0dcc Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Wed, 14 Jun 2017 02:12:30 +0200 Subject: [PATCH] debug --- Crow.csproj | 1 + Crow.dll.config | 2 +- src/GraphicObjects/TestWidget.cs | 58 +++++++++++++++++++++++++++++++ testDrm/Main.cs | 8 +++-- testDrm/src/Application.cs | 12 +++---- testDrm/src/Linux/DRIControler.cs | 2 +- testDrm/test.style | 1 + testDrm/testDrm.csproj | 4 +-- testDrm/ui/go.crow | 4 ++- testDrm/ui/menu.crow | 1 + testDrm/ui/perfMeasures.crow | 3 +- 11 files changed, 81 insertions(+), 15 deletions(-) create mode 100644 src/GraphicObjects/TestWidget.cs diff --git a/Crow.csproj b/Crow.csproj index 1c419008..d556c32a 100644 --- a/Crow.csproj +++ b/Crow.csproj @@ -213,6 +213,7 @@ + diff --git a/Crow.dll.config b/Crow.dll.config index ef7562ac..52997305 100644 --- a/Crow.dll.config +++ b/Crow.dll.config @@ -6,7 +6,7 @@ - + diff --git a/src/GraphicObjects/TestWidget.cs b/src/GraphicObjects/TestWidget.cs new file mode 100644 index 00000000..b4880f00 --- /dev/null +++ b/src/GraphicObjects/TestWidget.cs @@ -0,0 +1,58 @@ +// +// TestWidget.cs +// +// Author: +// Jean-Philippe Bruyère +// +// Copyright (c) 2013-2017 Jean-Philippe Bruyère +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. +using System; + +namespace Crow +{ + public class TestWidget : GraphicObject + { + double angle = 0.0; + + public TestWidget ():base() + { + } + + protected override void onDraw (Cairo.Context gr) + { + Rectangle r = ClientRectangle; + + double radius = Math.Min (r.Width / 2, r.Height / 2) - 5; + + gr.SetSourceRGBA (1.0, 0, 0, 1.0); + gr.LineWidth = 10; + gr.Arc (r.Width / 2, r.Height / 2, radius, angle, angle +0.5); + gr.Stroke (); + + if (angle > 2.0 * Math.PI) + angle = 0.0; + else + angle += 0.08; + + RegisterForGraphicUpdate (); + } + } +} + diff --git a/testDrm/Main.cs b/testDrm/Main.cs index 45a95d63..81216d34 100644 --- a/testDrm/Main.cs +++ b/testDrm/Main.cs @@ -55,8 +55,9 @@ namespace testDrm System.Threading.Thread.CurrentThread.Name = "Main"; try { - using (TestApp crowApp = new TestApp ()) + using (TestApp crowApp = new TestApp ()){ crowApp.Run (); + } } catch (Exception ex) { Console.WriteLine (ex.ToString ()); } @@ -73,7 +74,7 @@ namespace testDrm #endregion - public Command CMDViewPerf, CMDViewCfg, CMDViewTest0, CMDOpen; + public Command CMDViewPerf, CMDViewCfg, CMDViewTest0, CMDViewGO, CMDOpen; public TestApp () : base () { CrowInterface.KeyboardKeyDown += CrowInterface_KeyboardKeyDown; @@ -81,12 +82,13 @@ namespace testDrm CMDViewPerf = new Command(new Action(() => Load ("#testDrm.ui.perfMeasures.crow").DataSource = this)) { Caption = "Performances"}; CMDViewCfg = new Command(new Action(() => Load ("#testDrm.ui.2.crow").DataSource = this)) { Caption = "Configuration"}; CMDViewTest0 = new Command(new Action(() => Load ("#testDrm.ui.0.crow").DataSource = this)) { Caption = "Test view 0"}; + CMDViewGO = new Command(new Action(() => Load ("#testDrm.ui.go.crow").DataSource = this)) { Caption = "graphic test"}; CMDOpen = new Command(new Action(() => { lock (CrowInterface.UpdateMutex) CrowInterface.AddWidget(new FileDialog());})) { Caption = "Open"}; Load ("#testDrm.ui.menu.crow").DataSource = this; - initTests (); + //initTests (); } void CrowInterface_KeyboardKeyDown (object sender, KeyboardKeyEventArgs e) diff --git a/testDrm/src/Application.cs b/testDrm/src/Application.cs index 7efc0906..30a9573f 100644 --- a/testDrm/src/Application.cs +++ b/testDrm/src/Application.cs @@ -101,7 +101,7 @@ namespace Crow Console.WriteLine (ex.ToString ()); } } - + gpu = new DRIControler(); initCrow (); @@ -591,11 +591,11 @@ namespace Crow gpu = null; using (VTControler master = new VTControler ()) { - // try { - // master.KDMode = VT.KDMode.TEXT; - // } catch (Exception ex) { - // Console.WriteLine (ex.ToString ()); - // } + try { + master.KDMode = KDMode.TEXT; + } catch (Exception ex) { + Console.WriteLine (ex.ToString ()); + } master.SwitchTo (previousVT); } diff --git a/testDrm/src/Linux/DRIControler.cs b/testDrm/src/Linux/DRIControler.cs index cb2794f2..3d5f3009 100644 --- a/testDrm/src/Linux/DRIControler.cs +++ b/testDrm/src/Linux/DRIControler.cs @@ -231,7 +231,7 @@ namespace Linux.DRI { //setScanOutRegion(); //Thread.Sleep (100); - initPageFlipUpdate (); + //initPageFlipUpdate (); return true; } diff --git a/testDrm/test.style b/testDrm/test.style index 0db7f47d..7e06174b 100644 --- a/testDrm/test.style +++ b/testDrm/test.style @@ -14,4 +14,5 @@ FpsDisp { } Window { Template = #Crow.ToolWindow.template; + Background = DimGray; } diff --git a/testDrm/testDrm.csproj b/testDrm/testDrm.csproj index 27db51e6..2cf19157 100644 --- a/testDrm/testDrm.csproj +++ b/testDrm/testDrm.csproj @@ -19,13 +19,13 @@ - testDrm.TestCrow + testDrm.TestApp true full false - DEBUG; + DEBUG;MEASURE_TIME prompt 4 true diff --git a/testDrm/ui/go.crow b/testDrm/ui/go.crow index c3eda9cc..572e2cca 100755 --- a/testDrm/ui/go.crow +++ b/testDrm/ui/go.crow @@ -1,2 +1,4 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/testDrm/ui/menu.crow b/testDrm/ui/menu.crow index abe22fbc..df760fae 100755 --- a/testDrm/ui/menu.crow +++ b/testDrm/ui/menu.crow @@ -10,6 +10,7 @@ + diff --git a/testDrm/ui/perfMeasures.crow b/testDrm/ui/perfMeasures.crow index efeac653..5584a6b7 100755 --- a/testDrm/ui/perfMeasures.crow +++ b/testDrm/ui/perfMeasures.crow @@ -1,4 +1,5 @@ - + -- 2.47.3