Browse Source

Fixed cairo Path tests.

pull/141/head
Steven Kirk 11 years ago
parent
commit
3648d5b822
  1. BIN
      Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png
  2. 5
      src/Gtk/Perspex.Cairo/CairoExtensions.cs
  3. 11
      src/Gtk/Perspex.Cairo/Media/DrawingContext.cs
  4. 3
      src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs
  5. 1
      src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs
  6. BIN
      tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png

BIN
Tests/TestFiles/Cairo/Shapes/Path/Path_Tick_Scaled_Stroke_8px.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

5
src/Gtk/Perspex.Cairo/CairoExtensions.cs

@ -22,6 +22,11 @@ namespace Perspex.Cairo
return new Cairo.Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
}
public static Rect ToPerspex(this Cairo.Rectangle rect)
{
return new Rect(rect.X, rect.Y, rect.Width, rect.Height);
}
public static Rect ToPerspex(this Pango.Rectangle rect)
{
return new Rect(

11
src/Gtk/Perspex.Cairo/Media/DrawingContext.cs

@ -125,13 +125,12 @@ namespace Perspex.Cairo.Media
else
_context.Fill();
}
}
if (pen != null)
{
SetPen(pen, geometry.Bounds.Size);
_context.Stroke();
}
if (pen != null)
{
SetPen(pen, geometry.Bounds.Size);
_context.Stroke();
}
}

3
src/Gtk/Perspex.Cairo/Media/StreamGeometryContextImpl.cs

@ -47,8 +47,7 @@ namespace Perspex.Cairo.Media
if (isClosed)
_context.ClosePath();
var extents = _context.StrokeExtents();
_impl.Bounds = new Rect(extents.X, extents.Y, extents.Width, extents.Height);
_impl.Bounds = _context.FillExtents().ToPerspex();
_impl.Path = _context.CopyPath();
}

1
src/Gtk/Perspex.Cairo/Media/StreamGeometryImpl.cs

@ -61,6 +61,7 @@ namespace Perspex.Cairo.Media
public Rect GetRenderBounds(double strokeThickness)
{
// TODO: Calculate properly.
return Bounds;
}

BIN
tests/TestFiles/Cairo/Shapes/Path/Path_Expander_With_Border.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Loading…
Cancel
Save