diff --git a/Cairo/Perspex.Cairo/Renderer.cs b/Cairo/Perspex.Cairo/Renderer.cs
index b33e26b9c4..eea2ec56d3 100644
--- a/Cairo/Perspex.Cairo/Renderer.cs
+++ b/Cairo/Perspex.Cairo/Renderer.cs
@@ -17,9 +17,9 @@ namespace Perspex.Cairo
public class Renderer : IRenderer
{
///
- /// The target cairo surface.
+ /// The handle of the window to draw to.
///
- private Surface surface;
+ private IntPtr hwnd;
///
/// Initializes a new instance of the class.
@@ -29,16 +29,7 @@ namespace Perspex.Cairo
/// The height of the window.
public Renderer(IntPtr hwnd, double width, double height)
{
- surface = new Win32Surface(GetDC(hwnd));
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The target surface.
- public Renderer(Surface surface)
- {
- this.surface = surface;
+ this.hwnd = hwnd;
}
///
@@ -47,7 +38,8 @@ namespace Perspex.Cairo
/// The visual to render.
public void Render(IVisual visual)
{
- using (DrawingContext context = new DrawingContext(this.surface))
+ using (var surface = new Win32Surface(GetDC(this.hwnd)))
+ using (DrawingContext context = new DrawingContext(surface))
{
this.Render(visual, context);
}
@@ -60,9 +52,6 @@ namespace Perspex.Cairo
/// The new height.
public void Resize(int width, int height)
{
- var s = this.surface.CreateSimilar(Content.ColorAlpha, width, height);
- this.surface.Dispose();
- this.surface = s;
}
[DllImport("user32.dll")]