public LayerManager(IGraphicsSurface surfaceInfo, Action<GraphicsProfiler> graphicsUpdateCallback)
            : base(surfaceInfo, graphicsUpdateCallback)
        {
            modifiers = new GenericModifier(this, this);

            activeLayers = new SortedContainer<Layer>();

            InsertionPolicy = InsertionPolicy.BringToFront;
        }
Esempio n. 2
0
            /// <summary>
            /// Creates a new <see cref="ScrollingHitObjectContainer"/>.
            /// </summary>
            /// <param name="scrollingAxes">The axes upon which hit objects should appear to scroll inside this container.</param>
            public ScrollingHitObjectContainer(Axes scrollingAxes)
            {
                this.scrollingAxes = scrollingAxes;

                AddInternal(speedAdjustments = new SortedContainer {
                    RelativeSizeAxes = Axes.Both
                });

                // Default speed adjustment
                AddSpeedAdjustment(defaultSpeedAdjustment = new SpeedAdjustmentContainer(new MultiplierControlPoint(0)));
            }
 public void Dispose()
 {
     objectCollection = null;
     rasterizer = null;
 }
 public CompositionStage(SortedContainer<Layer> objectCollection, RasterizerStage rasterizer)
 {
     this.objectCollection = objectCollection;
     this.rasterizer = rasterizer;
 }
        public void UpdateFrame(SortedContainer<Layer> objectCollection,
                                IRenderingPolicy renderPolicy)
        {
            // Clip the invalidated region to the size of the frame
            renderPolicy.ClipToFrame(frame.Size);

            // Refreh the invalidated frame/region
            profiler.ProfileClearFrame(() =>
            {
                Color clearColor = Color.FromArgb(255, surfaceInfo.GraphicsBackground);
                using (SolidBrush clearBrush = new SolidBrush(clearColor))
                {
                    /*var localPolicy = renderPolicy as MinimalUpdate;
                    if (localPolicy != null && localPolicy.OldRegion != default(Rectangle))
                    {
                        _frameGraphics.FillRectangle(clearBrush, localPolicy.OldRegion);
                    }*/
                    frameGraphics.FillRectangle(clearBrush, renderPolicy.DirtyRegion);
                }
            });

            profiler.ProfileRasterizeObjects(() =>
            {
                using (var frameInfo = new BitmapHelper(frame)) // lock framebuffer data
                using (var rasterizer = new RasterizerStage(objectCollection, surfaceInfo)) // rasterize all scene objects
                using (var compositor = new CompositionStage(objectCollection, rasterizer))
                {
                    // perform scene composition on needed regions
                    compositor.Composite(renderPolicy, frameInfo);
                }
            });

            // Draw the new completed frame/region on the visible area
            profiler.ProfileDrawFrame(() =>
            {
                RefreshFrame(renderPolicy);
            });

            // Notify interested clients with statistics after frame update
            if (graphicsUpdateCallback != null) graphicsUpdateCallback.BeginInvoke(profiler, null, null);
        }