Esempio n. 1
0
        /// <summary>
        /// Draws the view within the specified rectangle.
        /// </summary>
        /// <param name="rect">Rect.</param>
        public override void Draw(CGRect rect)
        {
            _rect = rect;
            base.Draw(rect);

            lock (_bufferSynchronisation)
            {
                // recreate the view.
                View2D view = this.CreateView(this.Frame);
                float zoomFactor = (float)this.Map.Projection.ToZoomFactor(this.MapZoom);

                // call the canvas renderer.
                CGContext context = UIGraphics.GetCurrentContext();

                if (context != null)
                {
                    context.InterpolationQuality = CGInterpolationQuality.None;
                    context.SetShouldAntialias(false);
                    context.SetBlendMode(CGBlendMode.Copy);
                    context.SetAlpha(1);

                    long afterViewChanged = DateTime.Now.Ticks;
                    CGContextRenderer renderer = new CGContextRenderer(1);
                    renderer.Render(
                        new CGContextWrapper(context, this.Frame),
                        view,
                        zoomFactor,
                        new Primitive2D[] { _onScreenBuffer });
                    long afterRendering = DateTime.Now.Ticks;
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Draws the view within the specified rectangle.
        /// </summary>
        /// <param name="rect">Rect.</param>
        public override void Draw(System.Drawing.RectangleF rect)
        {
            _rect = rect;
            base.Draw (rect);

            lock (_cachedScene) {
                // recreate the view.
                //View2D view = this.CreateView (_rect);
                View2D view = this.CreateView (this.Frame);

                // call the canvas renderer.
                CGContext context = UIGraphics.GetCurrentContext ();

                if (context != null) {
                    context.InterpolationQuality = CGInterpolationQuality.None;
                    context.SetShouldAntialias (false);
                    context.SetBlendMode (CGBlendMode.Copy);
                    context.SetAlpha (1);

                    long afterViewChanged = DateTime.Now.Ticks;
                    CGContextRenderer renderer = new CGContextRenderer (1);
            //					renderer.Render (new CGContextWrapper (context, _rect),
                    //					                _cachedScene, view);
                    renderer.Render (new CGContextWrapper (context, this.Frame),
                        _cachedScene, view);
                    long afterRendering = DateTime.Now.Ticks;
                }
            }
        }