コード例 #1
0
ファイル: QuadPages.cs プロジェクト: lingliy/HtmlRenderer
 public void ResizeAllPages(int newWidth, int newHeight)
 {
     physicalCanvasCollection.Dispose(); physicalCanvasCollection.ResizeAllPages(newWidth, newHeight);
     render_parts = 0;
     if (pageA != null)
     {
         pageA.IsUnused = true;
         pageA          = null;
     }
     if (pageB != null)
     {
         pageB.IsUnused = true;
         pageB          = null;
     }
     if (pageC != null)
     {
         pageC.IsUnused = true;
         pageC          = null;
     }
     if (pageD != null)
     {
         pageD.IsUnused = true;
         pageD          = null;
     }
 }
コード例 #2
0
        public MyGdiPlusCanvas GetCanvasPage(int hPageNum, int vPageNum)
        {
            int j = cachePages.Count;

            for (int i = j - 1; i > -1; i--)
            {
                MyGdiPlusCanvas page = cachePages[i];
                if (page.IsPageNumber(hPageNum, vPageNum))
                {
                    cachePages.RemoveAt(i);
                    if (page.DimensionInvalid)
                    {
                        page.Reset(hPageNum, vPageNum, eachPageWidth, eachPageHeight);
                        page.IsUnused = false;
                    }
                    return(page);
                }
            }

            if (j >= numOfCachePages)
            {
                MyGdiPlusCanvas page = cachePages[0];
                cachePages.RemoveAt(0);
                page.IsUnused = false;
                if (page.DimensionInvalid)
                {
                    page.Reset(hPageNum, vPageNum, eachPageWidth, eachPageHeight);
                }
                else
                {
                    page.Reuse(hPageNum, vPageNum);
                }

                Rectangle rect = page.Rect;
                page.Invalidate(rect);
                return(page);
            }
            else
            {
                return(new MyGdiPlusCanvas(0, 0, eachPageWidth, eachPageHeight));
                //return (MyGdiPlusCanvas)LayoutFarm.UI.GdiPlus.MyWinGdiPortal.P.CreateCanvas(
                //     0, 0, eachPageWidth, eachPageHeight);

                //PixelFarm.Drawing.WinGdi.WinGdiPlusPlatform
                //return new MyGdiPlusCanvas(
                //    hPageNum,
                //    vPageNum,
                //    hPageNum * eachPageWidth,
                //    eachPageHeight * vPageNum,
                //    eachPageWidth,
                //    eachPageHeight);
            }
        }
コード例 #3
0
ファイル: QuadPages.cs プロジェクト: lingliy/HtmlRenderer
        static void UpdateInvalidArea(MyGdiPlusCanvas mycanvas, IRenderElement rootElement)
        {
            mycanvas.OffsetCanvasOrigin(-mycanvas.Left, -mycanvas.Top);
            Rectangle rect = mycanvas.InvalidateArea;

            rootElement.DrawToThisCanvas(mycanvas, rect);
#if DEBUG
            rootElement.dbugShowRenderPart(mycanvas, rect);
#endif

            mycanvas.IsContentReady = true;
            mycanvas.OffsetCanvasOrigin(mycanvas.Left, mycanvas.Top);
        }
コード例 #4
0
ファイル: QuadPages.cs プロジェクト: lingliy/HtmlRenderer
        static void UpdateAllArea(MyGdiPlusCanvas mycanvas, IRenderElement topWindowRenderBox)
        {
            mycanvas.OffsetCanvasOrigin(-mycanvas.Left, -mycanvas.Top);
            Rectangle rect = mycanvas.Rect;

            topWindowRenderBox.DrawToThisCanvas(mycanvas, rect);
#if DEBUG
            topWindowRenderBox.dbugShowRenderPart(mycanvas, rect);
#endif

            mycanvas.IsContentReady = true;
            mycanvas.OffsetCanvasOrigin(mycanvas.Left, mycanvas.Top);
        }
コード例 #5
0
        public void PaintMe(MyGdiPlusCanvas mycanvas)
        {
            if (this.IsClosed) { return; }
            //------------------------------------ 

            this.rootGraphics.PrepareRender();
            //---------------
            this.rootGraphics.IsInRenderPhase = true;
#if DEBUG
            this.rootGraphics.dbug_rootDrawingMsg.Clear();
            this.rootGraphics.dbug_drawLevel = 0;
#endif

            mycanvas.OffsetCanvasOrigin(-mycanvas.Left, -mycanvas.Top);
            Rectangle rect = mycanvas.Rect;
            this.rootGraphics.TopWindowRenderBox.DrawToThisCanvas(mycanvas, rect);
#if DEBUG
            this.rootGraphics.TopWindowRenderBox.dbugShowRenderPart(mycanvas, rect);
#endif

            mycanvas.IsContentReady = true;
            mycanvas.OffsetCanvasOrigin(mycanvas.Left, mycanvas.Top);
            //if (this.FullMode)
            //{
            //    quadPages.RenderToOutputWindowFullMode(rootGraphics.TopWindowRenderBox, hdc,
            //        this.ViewportX, this.ViewportY, this.ViewportWidth, this.ViewportHeight);
            //}
            //else
            //{
            //    //temp to full mode
            //    //quadPages.RenderToOutputWindowFullMode(rootGraphics.TopWindowRenderBox, hdc, this.ViewportX, this.ViewportY, this.ViewportWidth, this.ViewportHeight);
            //    quadPages.RenderToOutputWindowPartialMode(rootGraphics.TopWindowRenderBox, hdc,
            //        this.ViewportX, this.ViewportY, this.ViewportWidth, this.ViewportHeight);

            //}
            this.rootGraphics.IsInRenderPhase = false;
#if DEBUG

            RootGraphic visualroot = RootGraphic.dbugCurrentGlobalVRoot;
            if (visualroot.dbug_RecordDrawingChain)
            {
                List<dbugLayoutMsg> outputMsgs = dbugOutputWindow.dbug_rootDocDebugMsgs;
                outputMsgs.Clear();
                outputMsgs.Add(new dbugLayoutMsg(null as RenderElement, "[" + debug_render_to_output_count + "]"));
                visualroot.dbug_DumpRootDrawingMsg(outputMsgs);
                dbugOutputWindow.dbug_InvokeVisualRootDrawMsg();
                debug_render_to_output_count++;
            }


            if (dbugHelper01.dbugVE_HighlightMe != null)
            {
                dbugOutputWindow.dbug_HighlightMeNow(dbugHelper01.dbugVE_HighlightMe.dbugGetGlobalRect());
            }
#endif
        }
コード例 #6
0
 public void ReleasePage(MyGdiPlusCanvas page)
 {
     page.IsUnused = true;
     cachePages.Add(page);
 }
コード例 #7
0
 public void ReleasePage(MyGdiPlusCanvas page)
 {
     page.IsUnused = true;
     cachePages.Add(page);
 }
コード例 #8
0
ファイル: QuadPages.cs プロジェクト: prepare/HTML-Renderer
 public void ResizeAllPages(int newWidth, int newHeight)
 {
     physicalCanvasCollection.Dispose(); physicalCanvasCollection.ResizeAllPages(newWidth, newHeight);
     render_parts = 0;
     if (pageA != null)
     {
         pageA.IsUnused = true;
         pageA = null;
     }
     if (pageB != null)
     {
         pageB.IsUnused = true;
         pageB = null;
     }
     if (pageC != null)
     {
         pageC.IsUnused = true;
         pageC = null;
     }
     if (pageD != null)
     {
         pageD.IsUnused = true;
         pageD = null;
     }
 }
コード例 #9
0
ファイル: QuadPages.cs プロジェクト: prepare/HTML-Renderer
        public void CalculateCanvasPages(int viewportX, int viewportY, int viewportWidth, int viewportHeight)
        {
            int firstVerticalPageNum = viewportY / physicalCanvasCollection.EachPageHeight;
            int firstHorizontalPageNum = viewportX / physicalCanvasCollection.EachPageWidth;
            render_parts = PAGE_A;
            if (pageA == null)
            {
                pageA = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum);
            }
            else
            {
                if (!pageA.IsPageNumber(firstHorizontalPageNum, firstVerticalPageNum))
                {
                    physicalCanvasCollection.ReleasePage(pageA);
                    pageA = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum);
                }
            }

            if (pageA.Right >= viewportX + viewportWidth)
            {
                if (pageC != null)
                {
                    physicalCanvasCollection.ReleasePage(pageC);
                    pageC = null;
                }
            }
            else
            {
                if (pageC == null)
                {
                    pageC = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum);
                }
                else
                {
                    if (!pageC.IsPageNumber(firstHorizontalPageNum + 1, firstVerticalPageNum))
                    {
                        physicalCanvasCollection.ReleasePage(pageC);
                        pageC = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum);
                    }
                }
                render_parts |= PAGE_AC;
            }

            if (pageA.Bottom >= viewportY + viewportHeight)
            {
                if (pageB != null)
                {
                    physicalCanvasCollection.ReleasePage(pageB);
                    pageB = null;
                }
            }
            else
            {
                render_parts |= PAGE_AB;
                if (pageB == null)
                {
                    pageB = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum + 1);
                }
                else
                {
                    if (!pageB.IsPageNumber(firstHorizontalPageNum, firstVerticalPageNum + 1))
                    {
                        physicalCanvasCollection.ReleasePage(pageB);
                        pageB = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum + 1);
                    }
                }

                if (pageC != null)
                {
                    render_parts = PAGE_ABCD;
                    if (pageD == null)
                    {
                        pageD = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum + 1);
                    }
                    else
                    {
                        if (!pageD.IsPageNumber(firstHorizontalPageNum + 1, firstVerticalPageNum + 1))
                        {
                            physicalCanvasCollection.ReleasePage(pageD);
                            pageD = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum + 1);
                        }
                    }
                }
                else
                {
                    if (pageD != null)
                    {
                        physicalCanvasCollection.ReleasePage(pageD);
                        pageD = null;
                    }
                }
            }
        }
コード例 #10
0
ファイル: QuadPages.cs プロジェクト: prepare/HTML-Renderer
        static void UpdateInvalidArea(MyGdiPlusCanvas mycanvas, IRenderElement rootElement)
        {
            mycanvas.OffsetCanvasOrigin(-mycanvas.Left, -mycanvas.Top);
            Rectangle rect = mycanvas.InvalidateArea;
            rootElement.DrawToThisCanvas(mycanvas, rect);
#if DEBUG
            rootElement.dbugShowRenderPart(mycanvas, rect);
#endif

            mycanvas.IsContentReady = true;
            mycanvas.OffsetCanvasOrigin(mycanvas.Left, mycanvas.Top);
        }
コード例 #11
0
ファイル: QuadPages.cs プロジェクト: prepare/HTML-Renderer
        static void UpdateAllArea(MyGdiPlusCanvas mycanvas, IRenderElement topWindowRenderBox)
        {
            mycanvas.OffsetCanvasOrigin(-mycanvas.Left, -mycanvas.Top);
            Rectangle rect = mycanvas.Rect;
            topWindowRenderBox.DrawToThisCanvas(mycanvas, rect);
#if DEBUG
            topWindowRenderBox.dbugShowRenderPart(mycanvas, rect);
#endif

            mycanvas.IsContentReady = true;
            mycanvas.OffsetCanvasOrigin(mycanvas.Left, mycanvas.Top);
        }
コード例 #12
0
ファイル: QuadPages.cs プロジェクト: lingliy/HtmlRenderer
        public void CalculateCanvasPages(int viewportX, int viewportY, int viewportWidth, int viewportHeight)
        {
            int firstVerticalPageNum   = viewportY / physicalCanvasCollection.EachPageHeight;
            int firstHorizontalPageNum = viewportX / physicalCanvasCollection.EachPageWidth;

            render_parts = PAGE_A;
            if (pageA == null)
            {
                pageA = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum);
            }
            else
            {
                if (!pageA.IsPageNumber(firstHorizontalPageNum, firstVerticalPageNum))
                {
                    physicalCanvasCollection.ReleasePage(pageA);
                    pageA = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum);
                }
            }

            if (pageA.Right >= viewportX + viewportWidth)
            {
                if (pageC != null)
                {
                    physicalCanvasCollection.ReleasePage(pageC);
                    pageC = null;
                }
            }
            else
            {
                if (pageC == null)
                {
                    pageC = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum);
                }
                else
                {
                    if (!pageC.IsPageNumber(firstHorizontalPageNum + 1, firstVerticalPageNum))
                    {
                        physicalCanvasCollection.ReleasePage(pageC);
                        pageC = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum);
                    }
                }
                render_parts |= PAGE_AC;
            }

            if (pageA.Bottom >= viewportY + viewportHeight)
            {
                if (pageB != null)
                {
                    physicalCanvasCollection.ReleasePage(pageB);
                    pageB = null;
                }
            }
            else
            {
                render_parts |= PAGE_AB;
                if (pageB == null)
                {
                    pageB = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum + 1);
                }
                else
                {
                    if (!pageB.IsPageNumber(firstHorizontalPageNum, firstVerticalPageNum + 1))
                    {
                        physicalCanvasCollection.ReleasePage(pageB);
                        pageB = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum, firstVerticalPageNum + 1);
                    }
                }

                if (pageC != null)
                {
                    render_parts = PAGE_ABCD;
                    if (pageD == null)
                    {
                        pageD = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum + 1);
                    }
                    else
                    {
                        if (!pageD.IsPageNumber(firstHorizontalPageNum + 1, firstVerticalPageNum + 1))
                        {
                            physicalCanvasCollection.ReleasePage(pageD);
                            pageD = physicalCanvasCollection.GetCanvasPage(firstHorizontalPageNum + 1, firstVerticalPageNum + 1);
                        }
                    }
                }
                else
                {
                    if (pageD != null)
                    {
                        physicalCanvasCollection.ReleasePage(pageD);
                        pageD = null;
                    }
                }
            }
        }