예제 #1
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            TRACE_EVENT0("flutter", "ContainerLayer::Preroll");

            SKRect child_paint_bounds = SKRect.Empty;

            PrerollChildren(context, matrix, ref child_paint_bounds);
            set_paint_bounds(child_paint_bounds);
        }
예제 #2
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKRect child_paint_bounds = SKRect.Empty;

            PrerollChildren(context, matrix, ref child_paint_bounds);

            if (child_paint_bounds.IntersectsWith(clip_path_.Bounds))
            {
                set_paint_bounds(child_paint_bounds);
            }
        }
예제 #3
0
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //  public void Dispose();

        public void Preroll(CompositorContext.ScopedFrame frame, bool ignore_raster_cache = false)
        {
            TRACE_EVENT0("flutter", "LayerTree::Preroll");

            //frame.canvas().imageInfo().colorSpace()
            SKColorSpace color_space = frame.canvas() != null ? SKImageInfo.Empty.ColorSpace : null;

            frame.context().raster_cache().SetCheckboardCacheImages(checkerboard_raster_cache_images_);
            PrerollContext context = ignore_raster_cache ? null :new PrerollContext(frame.context().raster_cache(), frame.gr_context(), color_space, SKRect.Empty, frame.context().texture_registry(), checkerboard_offscreen_layers_);

            root_layer_.Preroll(context, frame.root_surface_transformation());
        }
예제 #4
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKMatrix child_matrix = new SKMatrix();

            SKMatrix.Concat(ref child_matrix, matrix, transform_);

            SKRect child_paint_bounds = SKRect.Empty;

            PrerollChildren(context, child_matrix, ref child_paint_bounds);

            transform_.MapRect(child_paint_bounds);
            set_paint_bounds(child_paint_bounds);
        }
예제 #5
0
        protected void PrerollChildren(PrerollContext context, SKMatrix child_matrix, ref SKRect child_paint_bounds)
        {
            foreach (var layer in layers_)
            {
                PrerollContext child_context = context;
                layer.Preroll(child_context, child_matrix);

                if (layer.needs_system_composite())
                {
                    set_needs_system_composite(true);
                }
                child_paint_bounds.Union(layer.paint_bounds());
            }
        }
예제 #6
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());
        }
예제 #7
0
        protected void PrerollChildren(PrerollContext context, SKMatrix child_matrix, SKRect child_paint_bounds)
        {
            foreach (var layer in layers_)
            {
                //C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
                //ORIGINAL LINE: PrerollContext child_context = *context;
                PrerollContext child_context = context;
                layer.Preroll(child_context, child_matrix);

                if (layer.needs_system_composite())
                {
                    set_needs_system_composite(true);
                }
                child_paint_bounds.Union(layer.paint_bounds());
            }
        }
예제 #8
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKMatrix child_matrix = matrix;

            child_matrix.SetScaleTranslate(child_matrix.ScaleX, child_matrix.ScaleY, offset_.X, offset_.Y);
            base.Preroll(context, child_matrix);
            if (context.raster_cache != null && layers().Count == 1)
            {
                Layer    child = layers()[0];//.get();
                SKMatrix ctm   = child_matrix;

#if !SUPPORT_FRACTIONAL_TRANSLATION
                ctm = RasterCache.GetIntegralTransCTM(ctm);
#endif
                context.raster_cache.Prepare(context, child, ctm);
            }
        }
예제 #9
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKPicture sk_picture = picture();

            var      cache = context.raster_cache;
            SKMatrix ctm   = matrix;

            ctm.SetScaleTranslate(ctm.ScaleX, ctm.ScaleY, offset_.X, offset_.Y);
#if !SUPPORT_FRACTIONAL_TRANSLATION
            ctm = RasterCache.GetIntegralTransCTM(ctm);
#endif
            cache.Prepare(context.gr_context, sk_picture, ctm, context.dst_color_space, is_complex_, will_change_);


            SKRect bounds = sk_picture.CullRect;
            bounds.Offset(offset_.X, offset_.Y);
            set_paint_bounds(bounds);
        }
예제 #10
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKRect child_paint_bounds = new SKRect();

            PrerollChildren(context, matrix, ref child_paint_bounds);

            if (elevation_ == 0F)
            {
                set_paint_bounds(path_.Bounds);
            }
            else
            {
                // Add some margin to the paint bounds to leave space for the shadow.
                // The margin is hardcoded to an arbitrary maximum for now because Skia
                // doesn't provide a way to calculate it.  We fill this whole region
                // and clip children to it so we don't need to join the child paint bounds.
                SKRect bounds = path_.Bounds;
                bounds.Offset(20.0f, 20.0f);
                set_paint_bounds(bounds);
            }
        }
예제 #11
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            SKPicture sk_picture = picture();

            var cache = context.raster_cache;
            //C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
            //ORIGINAL LINE: SKMatrix ctm = matrix;
            SKMatrix ctm = matrix;

            ctm.SetScaleTranslate(ctm.ScaleX, ctm.ScaleY, offset_.X, offset_.Y);
#if !SUPPORT_FRACTIONAL_TRANSLATION
            //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
            //ORIGINAL LINE: ctm = RasterCache::GetIntegralTransCTM(ctm);
            ctm = RasterCache.GetIntegralTransCTM(ctm);
#endif
            cache.Prepare(context.gr_context, sk_picture, ctm, context.dst_color_space, is_complex_, will_change_);


            SKRect bounds = sk_picture.CullRect;
            bounds.Offset(offset_.X, offset_.Y);
            set_paint_bounds(bounds);
        }
예제 #12
0
        public override void Preroll(PrerollContext context, SKMatrix matrix)
        {
            //C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
            //ORIGINAL LINE: SKMatrix child_matrix = matrix;
            SKMatrix child_matrix = matrix;

            child_matrix.SetScaleTranslate(child_matrix.ScaleX, child_matrix.ScaleY, offset_.X, offset_.Y);
            base.Preroll(context, child_matrix);
            if (context.raster_cache != null && layers().Count == 1)
            {
                Layer child = layers()[0];//.get();
                //C++ TO C# CONVERTER TODO TASK: The following line was determined to contain a copy constructor call - this should be verified and a copy constructor should be created:
                //ORIGINAL LINE: SKMatrix ctm = child_matrix;
                SKMatrix ctm = child_matrix;
#if !SUPPORT_FRACTIONAL_TRANSLATION
                //C++ TO C# CONVERTER TODO TASK: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'CopyFrom' method should be created:
                //ORIGINAL LINE: ctm = RasterCache::GetIntegralTransCTM(ctm);
                ctm = RasterCache.GetIntegralTransCTM(ctm);
#endif
                context.raster_cache.Prepare(context, child, ctm);
            }
        }
예제 #13
0
        //C++ TO C# CONVERTER TODO TASK: The implementation of the following method could not be found:
        //  public void Dispose();

        public virtual void Preroll(PrerollContext context, SKMatrix matrix)
        {
        }
 public override void Preroll(PrerollContext context, SKMatrix matrix)
 {
     set_needs_system_composite(true);
 }
예제 #15
0
 public override void Preroll(PrerollContext context, SKMatrix matrix)
 {
     set_paint_bounds(new SKRect(offset_.X, offset_.Y, size_.Width, size_.Height));
 }