Ejemplo n.º 1
0
Archivo: Group.cs Proyecto: masums/Crow
        protected override void UpdateCache(Context ctx)
        {
            Rectangle rb = Slot + Parent.ClientRectangle.Position;


            Context gr = new Context(bmp);

            if (!Clipping.IsEmpty)
            {
                for (int i = 0; i < Clipping.NumRectangles; i++)
                {
                    gr.Rectangle(Clipping.GetRectangle(i));
                }
                gr.ClipPreserve();
                gr.Operator = Operator.Clear;
                gr.Fill();
                gr.Operator = Operator.Over;

                base.onDraw(gr);

                if (ClipToClientRect)
                {
                    CairoHelpers.CairoRectangle(gr, ClientRectangle, CornerRadius);
                    gr.Clip();
                }

                childrenRWLock.EnterReadLock();

                foreach (GraphicObject c in Children)
                {
                    if (!c.Visible)
                    {
                        continue;
                    }
                    if (Clipping.Contains(c.Slot + ClientRectangle.Position) == RegionOverlap.Out)
                    {
                        continue;
                    }
                    c.Paint(ref gr);
                }

                childrenRWLock.ExitReadLock();

                                #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.Dispose();
            Clipping = new Region();
        }