コード例 #1
0
        //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#:
        //ORIGINAL LINE: void Paint(CompositorContext::ScopedFrame& frame, bool ignore_raster_cache = false) const
        public void Paint(CompositorContext.ScopedFrame frame, bool ignore_raster_cache = false)
        {
            TRACE_EVENT0("flutter", "LayerTree::Paint");
            Layer.PaintContext context = new Layer.PaintContext(frame.canvas(), frame.view_embedder(), frame.context().texture_registry(), ignore_raster_cache ? null : frame.context().raster_cache(), checkerboard_offscreen_layers_);

            if (root_layer_.needs_painting())
            {
                root_layer_.Paint(context);
            }
        }
コード例 #2
0
        public SKPicture Flatten(SKRect bounds)
        {
            TRACE_EVENT0("flutter", "LayerTree::Flatten");

            SKPictureRecorder recorder = new SKPictureRecorder();
            var canvas = recorder.BeginRecording(bounds);

            if (canvas == null)
            {
                return(null);
            }

            Stopwatch       unused_stopwatch            = new Stopwatch();
            TextureRegistry unused_texture_registry     = new TextureRegistry();
            SKMatrix        root_surface_transformation = new SKMatrix();

            // No root surface transformation. So assume identity.
            canvas.ResetMatrix();

            PrerollContext preroll_context = new PrerollContext(
                null, null, null,
                SKRect.Empty,
                unused_stopwatch,
                unused_stopwatch,
                unused_texture_registry,
                false);

            Layer.PaintContext paint_context = new Layer.PaintContext(
                canvas, null,
                unused_stopwatch,
                unused_stopwatch,
                unused_texture_registry,
                null, false);

            // Even if we don't have a root layer, we still need to create an empty
            // picture.
            if (root_layer_ != null)
            {
                root_layer_.Preroll(preroll_context, root_surface_transformation);
                // The needs painting flag may be set after the preroll. So check it after.
                if (root_layer_.needs_painting())
                {
                    root_layer_.Paint(paint_context);
                }
            }

            return(recorder.EndRecording());
        }