Esempio n. 1
0
        private void RenderTask(RenderTask task)
        {
            Rect contentRect = new Rect(0, 0, desktop.Width, desktop.Height);
            var  dirtyRect   = contentRect;

            if (task != null)
            {
                dirtyRect = task.DirtyArea.Intersection(contentRect);
            }
            if (dirtyRect.IsZero)
            {
                return;
            }

            //dt = DateTime.Now;
            var dc = new DrawingContext(bitmap);

            dc.PushClippingRectangle(dirtyRect);
            if (!dc.ClippingRectangle.IsZero)
            {
                desktop.RenderRecursive(dc);
                desktop.PostRenderRecursive(dc);
            }
            dc.PopClippingRectangle();
            dc.Close();
            //ts = DateTime.Now - dt;

            if (OnRenderRequest != null)
            {
                OnRenderRequest(bitmap, dirtyRect);
            }
            else
            {
                bitmap.Flush(dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height);
            }


            //Rect dirtyRect2 = new Rect(0, 0, 300, 20);
            //dc = new DrawingContext(screen);
            //dc.PushClippingRectangle(dirtyRect2);
            //Font font = Resources.GetFont(Resources.FontResources.CourierNew_10);
            //dc.DrawRectangle(new SolidColorBrush(Color.White), null, 0, 0, 300, 20);
            //dc.DrawText(dirtyRect.ToString() + "; Render: " + ts.ToString(), font, Color.Red, 3, 3);
            //dc.PopClippingRectangle();
            //dc.Close();
            //screen.Flush(dirtyRect2.X, dirtyRect2.Y, dirtyRect2.Width, dirtyRect2.Height);
            //Debug.Print("Render task: " + ts.ToString());
        }
Esempio n. 2
0
 internal void ProcessTask(RenderTask task /*optional*/)
 {
     if (desktop != null && bitmap != null)
         RenderTask(task);
 }
Esempio n. 3
0
        private void RenderTask(RenderTask task)
        {
            Rect contentRect = new Rect(0, 0, desktop.Width, desktop.Height);
            var dirtyRect = contentRect;
            if (task != null)
                dirtyRect = task.DirtyArea.Intersection(contentRect);
            if (dirtyRect.IsZero)
                return;

            //dt = DateTime.Now;
            var dc = new DrawingContext(bitmap);
            dc.PushClippingRectangle(dirtyRect);
            if (!dc.ClippingRectangle.IsZero)
            {
                desktop.RenderRecursive(dc);
                desktop.PostRenderRecursive(dc);
            }
            dc.PopClippingRectangle();
            dc.Close();
            //ts = DateTime.Now - dt;

            if (OnRenderRequest != null)
                OnRenderRequest(bitmap, dirtyRect);
            else
                bitmap.Flush(dirtyRect.X, dirtyRect.Y, dirtyRect.Width, dirtyRect.Height);

            //Rect dirtyRect2 = new Rect(0, 0, 300, 20);
            //dc = new DrawingContext(screen);
            //dc.PushClippingRectangle(dirtyRect2);
            //Font font = Resources.GetFont(Resources.FontResources.CourierNew_10);
            //dc.DrawRectangle(new SolidColorBrush(Color.White), null, 0, 0, 300, 20);
            //dc.DrawText(dirtyRect.ToString() + "; Render: " + ts.ToString(), font, Color.Red, 3, 3);
            //dc.PopClippingRectangle();
            //dc.Close();
            //screen.Flush(dirtyRect2.X, dirtyRect2.Y, dirtyRect2.Width, dirtyRect2.Height);
            //Debug.Print("Render task: " + ts.ToString());
        }