dbugDrawDiagonalBox() public method

public dbugDrawDiagonalBox ( Color color, RectangleF rect ) : void
color Color
rect PixelFarm.Drawing.RectangleF
return void
Esempio n. 1
0
        public void dbugPaint(PaintVisitor p, RectangleF r)
        {
            if (!PaintVisitor.dbugDrawWireFrame)
            {
                return;
            }
            //
            var htmlE = CssBox.UnsafeGetController(this);

            if (htmlE == null)
            {
                //anonymous box
                //Font f = new Font("tahoma", 10);
                //p.Gfx.DrawString(this.__aa_dbugId.ToString(), f, System.Drawing.Color.Black,
                //     new PointF(r.Left + 10, r.Top + 10), new SizeF(r.Width, r.Height));
                //f.Dispose();

                p.dbugDrawDiagonalBox(Color.Gray, r.Left, r.Top, r.Right, r.Bottom);
            }
            else
            {
                Color color = Color.Green;
                switch (this._cssDisplay)
                {
                case Css.CssDisplay.TableCell:
                    color = Color.OrangeRed;
                    break;
                }
                p.dbugDrawDiagonalBox(color, r.Left, r.Top, r.Right, r.Bottom);
            }
        }
Esempio n. 2
0
        public void dbugPaint(PaintVisitor p, RectangleF r)
        {
            if (!PaintVisitor.dbugDrawWireFrame)
            {
                return;
            }
            //
            var htmlE = CssBox.UnsafeGetController(this);
            if (htmlE == null)
            {
                //anonymous box
                //Font f = new Font("tahoma", 10);
                //p.Gfx.DrawString(this.__aa_dbugId.ToString(), f, System.Drawing.Color.Black,
                //     new PointF(r.Left + 10, r.Top + 10), new SizeF(r.Width, r.Height));
                //f.Dispose();

                p.dbugDrawDiagonalBox(Color.Gray, r.Left, r.Top, r.Right, r.Bottom);
            }
            else
            {
                Color color = Color.Green;
                switch (this._cssDisplay)
                {
                    case Css.CssDisplay.TableCell:
                        color = Color.OrangeRed;
                        break;
                }
                p.dbugDrawDiagonalBox(color, r.Left, r.Top, r.Right, r.Bottom);
            }
        }
Esempio n. 3
0
        internal void dbugPaintRuns(PaintVisitor p)
        {
            if (!PaintVisitor.dbugDrawWireFrame)
            {
                return;
            }
            //linebox
            float x1 = 0;
            float y1 = 0;
            float x2 = x1 + this.CachedLineContentWidth;
            float y2 = y1 + this.CacheLineHeight;

            //draw diagonal
            p.dbugDrawDiagonalBox(Color.Blue, x1, y1, x2, y2);
            //g.DrawRectangle(Pens.Blue,
            //    this.OwnerBox.LocationX,
            //    this.CachedLineTop,
            //    this.CachedLineContentWidth,
            //    this.CacheLineHeight);
            //foreach (var strip in _boxStrips.Values)
            //{
            //    var bound = strip.Bound;
            //    bound.Offset(offset);
            //    dbugDrawDiagnalBox(g, Pens.Green, bound.X, bound.Y, bound.Right, bound.Bottom);
            //}
            //return;
            foreach (CssRun w in _runs)
            {
                p.DrawRectangle(Color.DeepPink, w.Left, w.Top, w.Width, w.Height);
                //p.dbugDrawDiagonalBox(Color.DeepPink, w.Left, w.Top, w.Width, w.Height);
            }

            p.FillRectangle(Color.Red, 0, 0, 5, 5);
        }
        protected override void DrawBoxContent(DrawBoard canvas, Rectangle updateArea)
        {
            //TODO: review here,
            //
            if (_myHtmlCont == null)
            {
                return;
            }

            _myHtmlCont.CheckDocUpdate();

            DrawBoard cpuDrawBoard = null;

            if (PreferSoftwareRenderer &&
                canvas.IsGpuDrawBoard &&
                (cpuDrawBoard = canvas.GetCpuBlitDrawBoard()) != null)
            {
                //TODO: review this again ***
                //test built-in 'shared' software rendering surface

                cpuDrawBoard.Clear(Color.White);
                PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlCont, cpuDrawBoard);

                painter.SetViewportSize(this.Width, this.Height);

#if DEBUG
                painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif


                _myHtmlCont.PerformPaint(painter);
                PaintVisitorStock.ReleaseSharedPaintVisitor(painter);

                //then copy from cpu to gpu
                canvas.BlitFrom(cpuDrawBoard, X, Y, this.Width, this.Height, 0, 0);
            }
            else
            {
                PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlCont, canvas);
                painter.SetViewportSize(this.Width, this.Height);
#if DEBUG
                painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif

                _myHtmlCont.PerformPaint(painter);
                PaintVisitorStock.ReleaseSharedPaintVisitor(painter);
            }
        }
Esempio n. 5
0
        protected override void DrawBoxContent(DrawBoard canvas, Rectangle updateArea)
        {
            //TODO: review here,
            //
            if (myHtmlCont == null)
            {
                return;
            }

            myHtmlCont.CheckDocUpdate();
            PaintVisitor painter = PainterStock.GetSharedPainter(this.myHtmlCont, canvas);

            painter.SetViewportSize(this.Width, this.Height);
#if DEBUG
            painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif

            myHtmlCont.PerformPaint(painter);
            PainterStock.ReleaseSharedPainter(painter);
        }
Esempio n. 6
0
        protected override void RenderClientContent(DrawBoard d, UpdateArea updateArea)
        {
            //TODO: review here,
            if (_myHtmlVisualRoot == null)
            {
                return;
            }

            bool useBackbuffer = d.IsGpuDrawBoard;

            //useBackbuffer = false;

            //... TODO: review here, check doc update here?
            _myHtmlVisualRoot.CheckDocUpdate();

            if (useBackbuffer)
            {
                PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, d);

                if (_builtInBackBuffer == null)
                {
                    _builtInBackBuffer = painter.CreateOffscreenDrawBoard(this.Width, this.Height);
                }

#if DEBUG
                painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif
                if (!_builtInBackBuffer.IsValid)
                {
                    //painter.FillRectangle(Color.Red, 0, 0, 100, 100);//debug
                    //painter.DrawText(i.ToString().ToCharArray(), 0, 1, new PointF(0, 0), new SizeF(100, 100)); //debug


                    float backupViewportW = painter.ViewportWidth;       //backup
                    float backupViewportH = painter.ViewportHeight;      //backup

                    painter.EnterNewDrawboardBuffer(_builtInBackBuffer); //*** switch to builtInBackbuffer
                    painter.SetViewportSize(this.Width, this.Height);

                    if (!_hasAccumRect)
                    {
                        _invalidateRect = new Rectangle(0, 0, Width, Height);
                    }

#if DEBUG
                    //System.Diagnostics.Debug.WriteLine("inv_rect:" + _invalidateRect + "," + painter.ToString());
#endif
                    if (painter.PushLocalClipArea(
                            _invalidateRect.Left, _invalidateRect.Top,
                            _invalidateRect.Width, _invalidateRect.Height))
                    {
#if DEBUG
                        //for debug , test clear with random color
                        //another useful technique to see latest clear area frame-by-frame => use random color
                        //painter.Clear(ColorEx.dbugGetRandomColor());

                        painter.Clear(Color.White);
#else
                        painter.Clear(Color.White);
#endif
                        _myHtmlVisualRoot.PerformPaint(painter);

                        painter.PopLocalClipArea();
                    }


                    //
                    _builtInBackBuffer.IsValid = true;
                    _hasAccumRect = false;

                    painter.ExitCurrentDrawboardBuffer();                      //*** switch back
                    painter.SetViewportSize(backupViewportW, backupViewportH); //restore viewport size
                }

                painter.DrawImage(_builtInBackBuffer.GetImage(), 0, 0, this.Width, this.Height);

                PaintVisitorStock.ReleaseSharedPaintVisitor(painter);
            }
#if DEBUG
            else if (dbugPreferSoftwareRenderer && d.IsGpuDrawBoard)
            {
                //TODO: review this again ***
                //test built-in 'shared' software rendering surface
                DrawBoard cpuDrawBoard = null;
                if ((cpuDrawBoard = d.GetCpuBlitDrawBoard()) != null)
                {
                    cpuDrawBoard.Clear(Color.White);
                    PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, cpuDrawBoard);

                    painter.SetViewportSize(this.Width, this.Height);

#if DEBUG
                    painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif


                    _myHtmlVisualRoot.PerformPaint(painter);
                    PaintVisitorStock.ReleaseSharedPaintVisitor(painter);

                    //then copy from cpu to gpu
                    d.BlitFrom(cpuDrawBoard, X, Y, this.Width, this.Height, 0, 0);
                }
            }
#endif
            else
            {
                PaintVisitor painter = PaintVisitorStock.GetSharedPaintVisitor(_myHtmlVisualRoot, d);
                painter.SetViewportSize(this.Width, this.Height);
#if DEBUG
                //System.Diagnostics.Debug.WriteLine(">> 500x500");
                painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);

                //for debug , test clear with random color
                //another useful technique to see latest clear area frame-by-frame => use random color
                //painter.Clear(Color.FromArgb(255, dbugRandom.Next(0, 255), dbugRandom.Next(0, 255), dbugRandom.Next(0, 255)));
#endif

#if DEBUG
                //System.Diagnostics.Debug.WriteLine("inv_rect:" + _invalidateRect + "," + painter.ToString());
#endif
                //painter.SetClipRect(new Rectangle(0, 0, 200, 200));
                _myHtmlVisualRoot.PerformPaint(painter);
#if DEBUG
                //System.Diagnostics.Debug.WriteLine("<< 500x500");
                //painter.dbugDrawDiagonalBox(Color.Blue, this.X, this.Y, this.Width, this.Height);
#endif
                PaintVisitorStock.ReleaseSharedPaintVisitor(painter);
            }
        }
Esempio n. 7
0
        internal void dbugPaintRuns(PaintVisitor p)
        {
            if (!PaintVisitor.dbugDrawWireFrame)
            {
                return;
            }
            //linebox  
            float x1 = 0;
            float y1 = 0;
            float x2 = x1 + this.CachedLineContentWidth;
            float y2 = y1 + this.CacheLineHeight;
            //draw diagonal  
            p.dbugDrawDiagonalBox(Color.Blue, x1, y1, x2, y2);
            //g.DrawRectangle(Pens.Blue,
            //    this.OwnerBox.LocationX,
            //    this.CachedLineTop,
            //    this.CachedLineContentWidth,
            //    this.CacheLineHeight);
            //foreach (var strip in this._boxStrips.Values)
            //{
            //    var bound = strip.Bound;
            //    bound.Offset(offset);
            //    dbugDrawDiagnalBox(g, Pens.Green, bound.X, bound.Y, bound.Right, bound.Bottom);
            //} 
            //return; 
            foreach (CssRun w in this._runs)
            {
                p.DrawRectangle(Color.DeepPink, w.Left, w.Top, w.Width, w.Height);
                //p.dbugDrawDiagonalBox(Color.DeepPink, w.Left, w.Top, w.Width, w.Height);
            }

            p.FillRectangle(Color.Red, 0, 0, 5, 5);
        }