]> O.S.I.I.S - jp/crow.git/commitdiff
dont back cache in byte array
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Aug 2017 14:45:33 +0000 (16:45 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sun, 13 Aug 2017 14:45:33 +0000 (16:45 +0200)
CrowIDE/ui/MemberView.crow
CrowIDE/ui/MembersView.template
src/GraphicObjects/GraphicObject.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs

index 7d04a3a527351e3c44e8f849fa560fb314d7df46..8c4c21ec7288917b69090060b0d924e871169499 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <Window Caption="Properties" Width="30%" Height="60%" AlwaysOnTop="true">
-       <MembersView Instance="{SelectedItem}" DataTest="Type">
+       <MembersView Instance="{SelectedItem}" DataTest="Type"  Background="DimGray">
        <!--                            <Template>
                        <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"
                                ValueChanged="./_scroller_ValueChanged">
@@ -21,7 +21,7 @@
                                        MouseEnter="{Background=UnitedNationsBlue}"
                                        MouseLeave="{Background=Transparent}" >
                                <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
-                               <CheckBox Background="White" Margin="1" Caption="" IsChecked="{²Value}"/>
+                               <CheckBox Background="White" Height="Stretched" Caption="" IsChecked="{²Value}"/>
                        </HorizontalStack>
                </ItemTemplate>
                <ItemTemplate DataType="System.Enum">
@@ -29,7 +29,7 @@
                                        MouseEnter="{Background=UnitedNationsBlue}"
                                        MouseLeave="{Background=Transparent}" >
                                <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
-                               <ComboBox Margin="1"  Height="Fit" Width="50%" Data="{Choices}"
+                               <ComboBox Margin="0"  Height="Stretched" Width="50%" Data="{Choices}"
                                                SelectedIndex="{²Value}">
                                        <Template>
                                                <Popper Name="popper" PopDirection="Bottom">
@@ -76,7 +76,7 @@
                                        MouseEnter="{Background=UnitedNationsBlue}"
                                        MouseLeave="{Background=Transparent}" >
                                <Label Margin="1" Text="{Name}" Height="Fit" Width="50%"/>
-                               <Popper Background="White" Margin="1" Caption="{Value}">
+                               <Popper Background="White" Margin="0" Height="Stretched" Caption="{Value}">
                                        <Template>
                                                <HorizontalStack Spacing="3" Height="Fit" Background="{./Background}">
                                                        <Border Foreground="Black" Width="16" Height="10" CornerRadius="3"
index 91b7515d207d0e818716325a2b8981be60b97368..52a9dfe974039b151601f5de870b92a440990210 100755 (executable)
@@ -1,7 +1,9 @@
 <?xml version="1.0"?>
 <Border BorderWidth="5" Margin="1" MinimumSize="10,10">
        <VerticalStack>
-               <Label Text="{./Instance}"/>
+               <Border Height="Fit">
+                       <Label TextAlignment="Left" Text="{./Instance}" Width="Stretched"/>
+               </Border>
                <Scroller  Name="scroller1" Margin="1" VerticalScrolling="true"         
                        ValueChanged="./_scroller_ValueChanged">
                        <VerticalStack LayoutChanged="./_list_LayoutChanged" Spacing="0"
index 0db8fb54e4ca83d4aa279baba8c6c15c235150f1..284e4877ff29d90dc2a3fe2ef429dc3363c796d5 100644 (file)
@@ -137,7 +137,7 @@ namespace Crow
                /// <summary>Prevent requeuing multiple times the same widget</summary>
                public bool IsQueueForRedraw = false;
                /// <summary>drawing Cache, if null, a redraw is done, cached or not</summary>
-               public byte[] bmp;
+               public Surface bmp;
                public bool IsDirty = true;
                /// <summary>
                /// This size is computed on each child' layout changes.
@@ -1116,33 +1116,27 @@ namespace Crow
                /// this trigger the effective drawing routine </summary>
                protected virtual void RecreateCache ()
                {
-                       int stride = 4 * Slot.Width;
-
-                       int bmpSize = Math.Abs (stride) * Slot.Height;
-                       bmp = new byte[bmpSize];
                        IsDirty = false;
-                       using (ImageSurface draw =
-                new ImageSurface(bmp, Format.Argb32, Slot.Width, Slot.Height, stride)) {
-                               using (Context gr = new Context (draw)) {
-                                       gr.Antialias = Interface.Antialias;
-                                       onDraw (gr);
-                               }
-                               draw.Flush ();
+                       if (bmp != null)
+                               bmp.Dispose ();
+                       bmp = new ImageSurface (Format.Argb32, Slot.Width, Slot.Height);
+                       using (Context gr = new Context (bmp)) {
+                               gr.Antialias = Interface.Antialias;
+                               onDraw (gr);
                        }
+                       bmp.Flush ();
                }
                protected virtual void UpdateCache(Context ctx){
                        Rectangle rb = Slot + Parent.ClientRectangle.Position;
-                       using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
-                               if (clearBackground) {
-                                               ctx.Save ();
-                                               ctx.Operator = Operator.Clear;
-                                               ctx.Rectangle (rb);
-                                               ctx.Fill ();
-                                               ctx.Restore ();
-                               }
-                               ctx.SetSourceSurface (cache, rb.X, rb.Y);
-                               ctx.Paint ();
+                       if (clearBackground) {
+                                       ctx.Save ();
+                                       ctx.Operator = Operator.Clear;
+                                       ctx.Rectangle (rb);
+                                       ctx.Fill ();
+                                       ctx.Restore ();
                        }
+                       ctx.SetSourceSurface (bmp, rb.X, rb.Y);
+                       ctx.Paint ();
                        //Clipping.clearAndClip (ctx);
                        Clipping.Reset();
                }
index 549ca2194d0b959e78245303c0362521e07524a9..de6d3e40dc059ddf26eb5763239013d5396c4a70 100644 (file)
@@ -235,35 +235,35 @@ namespace Crow
                {
                        Rectangle rb = Slot + Parent.ClientRectangle.Position;
 
-                       using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
-                               Context gr = new Context (cache);
-
-                               if (Clipping.count > 0) {
-                                       Clipping.clearAndClip (gr);
-                                       base.onDraw (gr);
-
-                                       //clip to client zone
-                                       CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
-                                       gr.Clip ();
-
-                                       lock (Children) {
-                                               foreach (GraphicObject c in Children) {
-                                                       if (!c.Visible)
-                                                               continue;
-                                                       if (Clipping.intersect (c.Slot + ClientRectangle.Position))
-                                                               c.Paint (ref gr);
-                                               }
-                                       }
 
-                                       #if DEBUG_CLIP_RECTANGLE
-                                       Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
-                                       #endif
+                       Context gr = new Context (bmp);
+
+                       if (Clipping.count > 0) {
+                               Clipping.clearAndClip (gr);
+                               base.onDraw (gr);
+
+                               //clip to client zone
+                               CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                               gr.Clip ();
+
+                               lock (Children) {
+                                       foreach (GraphicObject c in Children) {
+                                               if (!c.Visible)
+                                                       continue;
+                                               if (Clipping.intersect (c.Slot + ClientRectangle.Position))
+                                                       c.Paint (ref gr);
+                                       }
                                }
-                               gr.Dispose ();
 
-                               ctx.SetSourceSurface (cache, rb.X, rb.Y);
-                               ctx.Paint ();
+                               #if DEBUG_CLIP_RECTANGLE
+                               Clipping.stroke (gr, Color.Amaranth.AdjustAlpha (0.8));
+                               #endif
                        }
+                       gr.Dispose ();
+
+                       ctx.SetSourceSurface (bmp, rb.X, rb.Y);
+                       ctx.Paint ();
+
                        Clipping.Reset();
                }
                #endregion
index 4076b5ec59a048662d57ed23510825978af783f8..d018bd77b1c58ed50e068ee1f8e80278f5925984 100644 (file)
@@ -179,21 +179,18 @@ namespace Crow
                {
                        Rectangle rb = Slot + Parent.ClientRectangle.Position;
 
-                       using (ImageSurface cache = new ImageSurface (bmp, Format.Argb32, Slot.Width, Slot.Height, 4 * Slot.Width)) {
-                               Context gr = new Context (cache);
+                       Context gr = new Context (bmp);
 
-                               if (Clipping.count > 0) {
-                                       Clipping.clearAndClip (gr);
+                       if (Clipping.count > 0) {
+                               Clipping.clearAndClip (gr);
 
-                                       onDraw (gr);
-                               }
-                                       
-                               gr.Dispose ();
-
-                               ctx.SetSourceSurface (cache, rb.X, rb.Y);
-                               ctx.Paint ();
+                               onDraw (gr);
                        }
-                       Clipping.Reset();
+                               
+                       gr.Dispose ();
+
+                       ctx.SetSourceSurface (bmp, rb.X, rb.Y);
+                       ctx.Paint ();
                }
                #endregion