Browse Source

Fixed @kekekeks notes.

Fixed test name (Line instead of Circle).
pull/393/head
Ivan Kochurkin 11 years ago
parent
commit
2cfa6f842e
  1. 11
      src/Perspex.SceneGraph/Media/LineGeometry.cs
  2. 1
      tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj
  3. 1
      tests/Perspex.RenderTests/Perspex.Skia.RenderTests.csproj
  4. 2
      tests/Perspex.RenderTests/Shapes/LineTests.cs
  5. BIN
      tests/TestFiles/Cairo/Shapes/Line/Line_1px_Stroke.expected.png
  6. BIN
      tests/TestFiles/Direct2D1/Shapes/Line/Line_1px_Stroke.expected.png
  7. BIN
      tests/TestFiles/Skia/Shapes/Line/Line_1px_Stroke.expected.png

11
src/Perspex.SceneGraph/Media/LineGeometry.cs

@ -10,6 +10,9 @@ namespace Perspex.Media
/// </summary> /// </summary>
public class LineGeometry : Geometry public class LineGeometry : Geometry
{ {
private Point _startPoint;
private Point _endPoint;
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="LineGeometry"/> class. /// Initializes a new instance of the <see cref="LineGeometry"/> class.
/// </summary> /// </summary>
@ -17,21 +20,23 @@ namespace Perspex.Media
/// <param name="endPoint">The end point.</param> /// <param name="endPoint">The end point.</param>
public LineGeometry(Point startPoint, Point endPoint) public LineGeometry(Point startPoint, Point endPoint)
{ {
_startPoint = startPoint;
_endPoint = endPoint;
IPlatformRenderInterface factory = PerspexLocator.Current.GetService<IPlatformRenderInterface>(); IPlatformRenderInterface factory = PerspexLocator.Current.GetService<IPlatformRenderInterface>();
IStreamGeometryImpl impl = factory.CreateStreamGeometry(); IStreamGeometryImpl impl = factory.CreateStreamGeometry();
using (IStreamGeometryContextImpl context = impl.Open()) using (IStreamGeometryContextImpl context = impl.Open())
{ {
context.BeginFigure(startPoint, true); context.BeginFigure(startPoint, false);
context.LineTo(endPoint); context.LineTo(endPoint);
context.EndFigure(true); context.EndFigure(false);
} }
PlatformImpl = impl; PlatformImpl = impl;
} }
/// <inheritdoc/> /// <inheritdoc/>
public override Rect Bounds => PlatformImpl.Bounds; public override Rect Bounds => new Rect(_startPoint, _endPoint);
/// <inheritdoc/> /// <inheritdoc/>
public override Geometry Clone() public override Geometry Clone()

1
tests/Perspex.RenderTests/Perspex.Cairo.RenderTests.csproj

@ -71,6 +71,7 @@
<Compile Include="Media\ImageBrushTests.cs" /> <Compile Include="Media\ImageBrushTests.cs" />
<Compile Include="Media\LinearGradientBrushTests.cs" /> <Compile Include="Media\LinearGradientBrushTests.cs" />
<Compile Include="Media\VisualBrushTests.cs" /> <Compile Include="Media\VisualBrushTests.cs" />
<Compile Include="Shapes\LineTests.cs" />
<Compile Include="Shapes\PathTests.cs" /> <Compile Include="Shapes\PathTests.cs" />
<Compile Include="Shapes\EllipseTests.cs" /> <Compile Include="Shapes\EllipseTests.cs" />
<Compile Include="Shapes\RectangleTests.cs" /> <Compile Include="Shapes\RectangleTests.cs" />

1
tests/Perspex.RenderTests/Perspex.Skia.RenderTests.csproj

@ -68,6 +68,7 @@
<Compile Include="Media\LinearGradientBrushTests.cs" /> <Compile Include="Media\LinearGradientBrushTests.cs" />
<Compile Include="Media\VisualBrushTests.cs" /> <Compile Include="Media\VisualBrushTests.cs" />
<Compile Include="Shapes\EllipseTests.cs" /> <Compile Include="Shapes\EllipseTests.cs" />
<Compile Include="Shapes\LineTests.cs" />
<Compile Include="Shapes\PathTests.cs" /> <Compile Include="Shapes\PathTests.cs" />
<Compile Include="Shapes\RectangleTests.cs" /> <Compile Include="Shapes\RectangleTests.cs" />
<Compile Include="TestBase.cs" /> <Compile Include="TestBase.cs" />

2
tests/Perspex.RenderTests/Shapes/LineTests.cs

@ -22,7 +22,7 @@ namespace Perspex.Direct2D1.RenderTests.Shapes
} }
[Fact] [Fact]
public void Circle_1px_Stroke() public void Line_1px_Stroke()
{ {
Decorator target = new Decorator Decorator target = new Decorator
{ {

BIN
tests/TestFiles/Direct2D1/Shapes/Line/Circle_1px_Stroke.expected.png → tests/TestFiles/Cairo/Shapes/Line/Line_1px_Stroke.expected.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 624 B

After

Width:  |  Height:  |  Size: 618 B

BIN
tests/TestFiles/Direct2D1/Shapes/Line/Line_1px_Stroke.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

BIN
tests/TestFiles/Skia/Shapes/Line/Line_1px_Stroke.expected.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Loading…
Cancel
Save