From: jpbruyere Date: Sun, 6 Mar 2016 08:09:22 +0000 (+0100) Subject: divers X-Git-Tag: v0.4~93^2 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=refs%2Fpull%2F4%2Fhead;p=jp%2Fcrow.git divers --- diff --git a/OTKCrow/OpenTKGameWindow.cs b/OTKCrow/OpenTKGameWindow.cs index f9043c05..07dd1d58 100644 --- a/OTKCrow/OpenTKGameWindow.cs +++ b/OTKCrow/OpenTKGameWindow.cs @@ -67,7 +67,7 @@ namespace Crow ValueChanged.Raise(this, new ValueChangeEventArgs ("fps", _fps)); #if MEASURE_TIME ValueChanged.Raise (this, new ValueChangeEventArgs ("update", - this.CrowInterface.updateTime.ElapsedTicks.ToString () + " ticks")); + this.CrowInterface.clippingTime.ElapsedTicks.ToString () + " ticks")); ValueChanged.Raise (this, new ValueChangeEventArgs ("layouting", this.CrowInterface.layoutTime.ElapsedTicks.ToString () + " ticks")); ValueChanged.Raise (this, new ValueChangeEventArgs ("drawing", @@ -120,7 +120,7 @@ namespace Crow while (true) { CrowInterface.Update (); - Thread.Sleep (10); + Thread.Sleep (5); } } @@ -201,8 +201,8 @@ namespace Crow CrowInterface.IsDirty = false; } } - uiQuad.Render (PrimitiveType.TriangleStrip); + uiQuad.Render (PrimitiveType.TriangleStrip); GL.BindTexture(TextureTarget.Texture2D, 0); shader.Disable (); diff --git a/Tests/Interfaces/testWindow.goml b/Tests/Interfaces/testWindow.goml index 89e064d4..248f4676 100755 --- a/Tests/Interfaces/testWindow.goml +++ b/Tests/Interfaces/testWindow.goml @@ -36,13 +36,13 @@ Margin="10" Focusable="True" > - - @@ -68,7 +68,7 @@ - + diff --git a/src/GraphicObjects/GraphicObject.cs b/src/GraphicObjects/GraphicObject.cs index dd83c948..b8b2a38f 100644 --- a/src/GraphicObjects/GraphicObject.cs +++ b/src/GraphicObjects/GraphicObject.cs @@ -662,7 +662,7 @@ namespace Crow public virtual void RegisterForLayouting(LayoutingType layoutType){ if (Parent == null) return; - lock (Interface.CurrentInterface.LayoutingQueue) { + lock (Interface.CurrentInterface.LayoutMutex) { //dont set position for stretched item if (Width == 0) layoutType &= (~LayoutingType.X); diff --git a/src/Interface.cs b/src/Interface.cs index 8224f86f..3f4cc918 100644 --- a/src/Interface.cs +++ b/src/Interface.cs @@ -228,7 +228,7 @@ namespace Crow public GraphicObject LoadInterface (string path) { - lock (this) { + lock (UpdateMutex) { GraphicObject tmp = Interface.Load (path, this); AddWidget (tmp); return tmp; @@ -238,7 +238,7 @@ namespace Crow #endregion #if MEASURE_TIME - public Stopwatch updateTime = new Stopwatch (); + public Stopwatch clippingTime = new Stopwatch (); public Stopwatch layoutTime = new Stopwatch (); public Stopwatch guTime = new Stopwatch (); public Stopwatch drawingTime = new Stopwatch (); @@ -259,6 +259,7 @@ namespace Crow public byte[] dirtyBmp; public bool IsDirty = false; public Rectangle DirtyRect; + public object LayoutMutex = new object(); public object RenderMutex = new object(); public object UpdateMutex = new object(); @@ -316,12 +317,8 @@ namespace Crow FocusedWidget.onMouseClick (this, new MouseButtonEventArgs (Mouse.X, Mouse.Y, MouseButton.Left, true)); } } - #if MEASURE_TIME - guTime.Reset (); - updateTime.Restart (); - #endif - lock (this) { + lock (UpdateMutex) { processLayouting (); clippingRegistration (); @@ -329,9 +326,6 @@ namespace Crow processDrawing (); } - #if MEASURE_TIME - updateTime.Stop (); - #endif // if (ToolTip.isVisible) { // ToolTip.panel.processkLayouting(); // if (ToolTip.panel.layoutIsValid) @@ -354,7 +348,7 @@ namespace Crow #if MEASURE_TIME layoutTime.Restart(); #endif - lock (Interface.CurrentInterface.LayoutingQueue) { + lock (LayoutMutex) { //Debug.WriteLine ("======= Layouting queue start ======="); LayoutingQueueItem lqi = null; while (Interface.CurrentInterface.LayoutingQueue.Count > 0) { @@ -367,6 +361,9 @@ namespace Crow #endif } void clippingRegistration(){ + #if MEASURE_TIME + clippingTime.Restart (); + #endif lock (CurrentInterface.GraphicUpdateQueue) { while (CurrentInterface.GraphicUpdateQueue.Count > 0) { GraphicObject g = CurrentInterface.GraphicUpdateQueue.Dequeue (); @@ -388,6 +385,9 @@ namespace Crow } } RedrawList.Clear (); + #if MEASURE_TIME + clippingTime.Stop (); + #endif } void processDrawing(){ #if MEASURE_TIME @@ -504,7 +504,7 @@ namespace Crow public void ProcessResize(Rectangle bounds){ - lock (CurrentInterface) { + lock (UpdateMutex) { clientRectangle = bounds; int stride = 4 * ClientRectangle.Width;