//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: void Paint(PaintContext& context) const override public override void Paint(PaintContext context) { TRACE_EVENT0("flutter", "OpacityLayer::Paint"); FML_DCHECK(needs_painting()); SKPaint paint = new SKPaint(); paint.Color = paint.Color.WithAlpha((byte)alpha_); //C++ TO C# CONVERTER TODO TASK: There is no equivalent in C# to 'static_assert': // (...) static_assert(false, "missing name for " "SkAutoCanvasRestore") save(&context.canvas, true); context.canvas.Translate(offset_.X, offset_.Y); #if !SUPPORT_FRACTIONAL_TRANSLATION context.canvas.SetMatrix(RasterCache.GetIntegralTransCTM(context.canvas.TotalMatrix)); #endif if (layers().Count == 1)// && context.raster_cache) { SKMatrix ctm = context.canvas.TotalMatrix; RasterCacheResult child_cache = context.raster_cache.Get(layers()[0], ctm); if (child_cache.is_valid) { child_cache.draw(context.canvas, paint); return; } } Layer.AutoSaveLayer save_layer = Layer.AutoSaveLayer.Create(context, paint_bounds(), paint); PaintChildren(context); }
//C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: void Paint(PaintContext& context) const override public override void Paint(PaintContext context) { TRACE_EVENT0("flutter", "PictureLayer::Paint"); //FML_DCHECK(picture_); FML_DCHECK(needs_painting()); //C++ TO C# CONVERTER TODO TASK: There is no equivalent in C# to 'static_assert': // (...) static_assert(false, "missing name for " "SkAutoCanvasRestore") save(&context.canvas, true); context.canvas.Translate(offset_.X, offset_.Y); #if !SUPPORT_FRACTIONAL_TRANSLATION context.canvas.SetMatrix(RasterCache.GetIntegralTransCTM(context.canvas.TotalMatrix)); #endif if (context.raster_cache != null) { SKMatrix ctm = context.canvas.TotalMatrix; RasterCacheResult result = context.raster_cache.Get(picture(), ctm); if (result.is_valid) { result.draw(context.canvas); return; } } context.canvas.DrawPicture(picture()); }
public override void Paint(PaintContext context) { TRACE_EVENT0("flutter", "OpacityLayer::Paint"); FML_DCHECK(needs_painting()); SKPaint paint = new SKPaint(); paint.Color = paint.Color.WithAlpha((byte)alpha_); context.canvas.Translate(offset_.X, offset_.Y); #if !SUPPORT_FRACTIONAL_TRANSLATION context.canvas.SetMatrix(RasterCache.GetIntegralTransCTM(context.canvas.TotalMatrix)); #endif if (layers().Count == 1 && context.raster_cache != null) { SKMatrix ctm = context.canvas.TotalMatrix; RasterCacheResult child_cache = context.raster_cache.Get(layers()[0], ctm); if (child_cache.is_valid) { child_cache.draw(context.canvas, paint); return; } } Layer.AutoSaveLayer save_layer = Layer.AutoSaveLayer.Create(context, paint_bounds(), paint); PaintChildren(context); }
public bool is_valid => image_ != null; //?? I'm not sure if this is right //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: void draw(SKCanvas& canvas, const SKPaint* paint = null) const public void draw(SKCanvas canvas, SKPaint paint = null) { var bounds = RasterCache.GetDeviceBounds(logical_rect_, canvas.TotalMatrix); canvas.ResetMatrix(); canvas.DrawImage(image_, bounds.Left, bounds.Top, paint); }
public bool is_valid => image_ != null; //?? I'm not sure if this is right //{ // return (bool)image_; //} //C++ TO C# CONVERTER WARNING: 'const' methods are not available in C#: //ORIGINAL LINE: void draw(SKCanvas& canvas, const SKPaint* paint = null) const public void draw(SKCanvas canvas, SKPaint paint = null) { //C++ TO C# CONVERTER TODO TASK: There is no equivalent in C# to 'static_assert': // (...) static_assert(false, "missing name for " "SkAutoCanvasRestore") auto_restore(&canvas, true); var bounds = RasterCache.GetDeviceBounds(logical_rect_, canvas.TotalMatrix); //FML_DCHECK(bounds.Size == image_..dimensions()); canvas.ResetMatrix(); canvas.DrawImage(image_, bounds.Left, bounds.Top, paint); }
public PaintContext(SKCanvas canvas, ExternalViewEmbedder view_embedder, TextureRegistry texture_registry, RasterCache raster_cache, bool checkerboard_offscreen_layers) { this.canvas = canvas; this.view_embedder = view_embedder; this.texture_registry = texture_registry; this.raster_cache = raster_cache; this.checkerboard_offscreen_layers = checkerboard_offscreen_layers; }
public PrerollContext(RasterCache raster_cache, GRContext gr_context, SKColorSpace dst_color_space, SKRect child_paint_bounds, TextureRegistry texture_registry, bool checkerboard_offscreen_layers) { this.raster_cache = raster_cache; this.gr_context = gr_context; this.dst_color_space = dst_color_space; this.child_paint_bounds = child_paint_bounds; this.texture_registry = texture_registry; this.checkerboard_offscreen_layers = checkerboard_offscreen_layers; }
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); } }
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); }
internal static RasterCacheResult Rasterize(GRContext context, SKMatrix ctm, SKColorSpace dst_color_space, bool checkerboard, SKRect logical_rect, Action <SKCanvas> draw_function) { SKRectI cache_rect = RasterCache.GetDeviceBounds(logical_rect, ctm); SKImageInfo image_info = new SKImageInfo(cache_rect.Width, cache_rect.Height); SKSurface surface = context != null?SKSurface.CreateAsRenderTarget(context, new GRGlBackendTextureDesc() { Width = cache_rect.Width, Height = cache_rect.Height }) : SKSurface.Create(image_info); //{ image_info. if (surface == null) { return(new RasterCacheResult()); } SKCanvas canvas = surface.Canvas; SKCanvas xformCanvas = canvas; //if (dst_color_space != null) //{ // xformCanvas = SkCreateColorSpaceXformCanvas(canvas, GlobalMembers.sk_ref_sp(dst_color_space)); // if (xformCanvas != null) // { // canvas = xformCanvas; // } //} canvas.Clear(GlobalMembers.SK_ColorTRANSPARENT); canvas.Translate(-cache_rect.Left, -cache_rect.Top); canvas.Concat(ref ctm); draw_function(canvas); //if (checkerboard) //{ // DrawCheckerboard(canvas, logical_rect); //} return(new RasterCacheResult(surface.Snapshot(), logical_rect)); }
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); }
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); } }
public override void Paint(PaintContext context) { TRACE_EVENT0("flutter", "PictureLayer::Paint"); //FML_DCHECK(picture_); FML_DCHECK(needs_painting()); context.canvas.Translate(offset_.X, offset_.Y); #if !SUPPORT_FRACTIONAL_TRANSLATION context.canvas.SetMatrix(RasterCache.GetIntegralTransCTM(context.canvas.TotalMatrix)); #endif if (context.raster_cache != null) { SKMatrix ctm = context.canvas.TotalMatrix; RasterCacheResult result = context.raster_cache.Get(picture(), ctm); if (result.is_valid) { result.draw(context.canvas); return; } } context.canvas.DrawPicture(picture()); }
public PrerollContext(RasterCache raster_cache, GRContext gr_context, SKColorSpace dst_color_space, SKRect child_paint_bounds, Stopwatch frameTime, Stopwatch engineTime, TextureRegistry texture_registry, bool checkerboard_offscreen_layers) { this.raster_cache = raster_cache; if (raster_cache == null) { this.raster_cache = new RasterCache(); } this.gr_context = gr_context; this.dst_color_space = dst_color_space; this.child_paint_bounds = child_paint_bounds; this.frame_time = frameTime; this.engine_time = engineTime; this.texture_registry = texture_registry; this.checkerboard_offscreen_layers = checkerboard_offscreen_layers; }