]> O.S.I.I.S - jp/crow.git/commitdiff
add clipping to client zone with corner radius
authorjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Feb 2016 13:47:49 +0000 (14:47 +0100)
committerjpbruyere <jp.bruyere@hotmail.com>
Fri, 12 Feb 2016 13:47:49 +0000 (14:47 +0100)
Crow.csproj
Tests/GOLIBTests.cs
src/GraphicObjects/Border.cs
src/GraphicObjects/Group.cs
src/GraphicObjects/PrivateContainer.cs

index 9ae272309ac2f41f15f2f061c2714ab3c413616e..64eab6c955c6428242e3b09a8c79217470e21580 100644 (file)
@@ -46,7 +46,7 @@
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <OutputPath>bin\Debug</OutputPath>
-    <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE</DefineConstants>
+    <DefineConstants>DEBUG_LAYOUTING0;TRACE;DEBUG;__linux__;MEASURE_TIME;DEBUG_LOAD_TIME0;DEBUG_BINDING0;DEBUG_CLIP_RECTANGLE0</DefineConstants>
   </PropertyGroup>
   <!--  <PropertyGroup Condition=" '$(Platform)' == 'Linux_x86' ">
     <DefineConstants>__linux__</DefineConstants>
index 1fb98c18e21ba59a5e6b500cdcc611f5e3ddbca6..b87bfe751f8a79e379bb44343e67a9d6381ccacc 100644 (file)
@@ -37,6 +37,7 @@ namespace test
                int frameCpt = 0;
                int idx = 0;
                string[] testFiles = {
+                       "testWindow.goml",
                        "clip4.crow",
                        "clip3.crow",
                        "clip2.crow",
@@ -69,7 +70,6 @@ namespace test
                        "testWindow2.goml",
 
                        "testWindow3.goml",
-                       "testWindow.goml",
                        "testCheckbox.goml",
                        "testLabel.goml",
                        "testAll.goml",
index c8e4a7bb5ee33ab74d127edddc3209bf30059192..7011690eb04baed3a0cb9dc3d7568b6982d24b7f 100644 (file)
@@ -63,8 +63,14 @@ namespace Crow
                                gr.Stroke ();
                        }
 
+                       gr.Save ();
+                       //clip to client zone
+                       CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                       gr.Clip ();
+
                        if (child != null)
                                child.Paint (ref gr);
+                       gr.Restore ();
                }               
                #endregion
        }
index a2bc4634213207236bd1df95e47c84f89d950b70..e1e955793c0f809e09fbe0f0c65cbb8cc9b1cbf6 100644 (file)
@@ -209,9 +209,15 @@ namespace Crow
                {
                        base.onDraw (gr);
 
+                       gr.Save ();
+                       //clip to client zone
+                       CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                       gr.Clip ();
+
                        foreach (GraphicObject g in children) {
                                g.Paint (ref gr);
                        }
+                       gr.Restore ();
                }
                protected override void UpdateCache (Context ctx)
                {
@@ -224,10 +230,15 @@ namespace Crow
                                        Clipping.clearAndClip (gr);
                                        base.onDraw (gr);
 
+                                       //clip to client zone
+                                       CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                                       gr.Clip ();
+
                                        foreach (GraphicObject c in children) {
                                                if (!c.Visible)
                                                        continue;
-                                               c.Paint (ref gr);                                               
+                                               if (Clipping.intersect(c.Slot + ClientRectangle.Position))
+                                                       c.Paint (ref gr);
                                        }
 
                                        #if DEBUG_CLIP_RECTANGLE
index d3a706497210d051a4d049817ac5199e13a71598..546d0958d2037e73b28835b63e580809bef32baa 100644 (file)
@@ -136,8 +136,15 @@ namespace Crow
                protected override void onDraw (Context gr)
                {
                        base.onDraw (gr);
+
+                       gr.Save ();
+                       //clip to client zone
+                       CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                       gr.Clip ();
+
                        if (child != null)
                                child.Paint (ref gr);
+                       gr.Restore ();
                }
                protected override void UpdateCache (Context ctx)
                {
@@ -157,6 +164,10 @@ namespace Crow
                                                
                                                base.onDraw (gr);
 
+                                               //clip to client zone
+                                               CairoHelpers.CairoRectangle (gr, ClientRectangle, CornerRadius);
+                                               gr.Clip ();
+
                                                child.Paint (ref gr);
                                        }
                                }