Browse Source

[GTK3] Allow to render IDeferredRenderOperation to existing context

pull/1195/head
Nikita Tsukanov 9 years ago
parent
commit
3882cf6cf3
  1. 2
      src/Gtk/Avalonia.Gtk3/IDeferredRenderOperation.cs
  2. 11
      src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs
  3. 2
      src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs

2
src/Gtk/Avalonia.Gtk3/IDeferredRenderOperation.cs

@ -4,6 +4,6 @@ namespace Avalonia.Gtk3
{
public interface IDeferredRenderOperation : IDisposable
{
void RenderNow();
void RenderNow(IntPtr? ctx);
}
}

11
src/Gtk/Avalonia.Gtk3/ImageSurfaceFramebuffer.cs

@ -88,10 +88,10 @@ namespace Avalonia.Gtk3
private readonly int _width;
private readonly int _height;
public RenderOp(GtkWidget widget, ManagedCairoSurface _surface, double factor, int width, int height)
public RenderOp(GtkWidget widget, ManagedCairoSurface surface, double factor, int width, int height)
{
_widget = widget;
this._surface = _surface;
_surface = surface ?? throw new ArgumentNullException();
_factor = factor;
_width = width;
_height = height;
@ -103,9 +103,12 @@ namespace Avalonia.Gtk3
_surface = null;
}
public void RenderNow()
public void RenderNow(IntPtr? ctx)
{
DrawToWidget(_widget, _surface.Surface, _width, _height, _factor);
if(ctx.HasValue)
Draw(ctx.Value, _surface.Surface, _factor);
else
DrawToWidget(_widget, _surface.Surface, _width, _height, _factor);
}
}

2
src/Gtk/Avalonia.Gtk3/WindowBaseImpl.cs

@ -286,7 +286,7 @@ namespace Avalonia.Gtk3
}
if (op != null)
{
op?.RenderNow();
op?.RenderNow(null);
op?.Dispose();
}
}

Loading…
Cancel
Save