Skip to content

Commit dd4f6c0

Browse files
committed
make OxyPlot.Xamarin.iOS compile
1 parent ad250aa commit dd4f6c0

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

Source/OxyPlot.Xamarin.iOS/CoreGraphicsRenderContext.cs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace OxyPlot.Xamarin.iOS
2121
/// <summary>
2222
/// Implements a <see cref="IRenderContext"/> for CoreGraphics.
2323
/// </summary>
24-
public class CoreGraphicsRenderContext : RenderContextBase, IDisposable
24+
public class CoreGraphicsRenderContext : ClippingRenderContext, IDisposable
2525
{
2626
/// <summary>
2727
/// The images in use.
@@ -68,10 +68,11 @@ public CoreGraphicsRenderContext(CGContext context)
6868
/// <param name="fill">The fill color.</param>
6969
/// <param name="stroke">The stroke color.</param>
7070
/// <param name="thickness">The thickness.</param>
71-
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
71+
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode erm)
7272
{
73-
this.SetAlias(false);
74-
var convertedRectangle = rect.Convert();
73+
bool aliased = this.ShouldUseAntiAliasingForEllipse(erm);
74+
this.SetAlias(aliased);
75+
var convertedRectangle = aliased ? rect.ConvertAliased() : rect.Convert();
7576
if (fill.IsVisible())
7677
{
7778
this.SetFill(fill);
@@ -155,17 +156,16 @@ public override void CleanUp()
155156
/// </summary>
156157
/// <param name="rect">The clip rectangle.</param>
157158
/// <returns>True if the clip rectangle was set.</returns>
158-
public override bool SetClip(OxyRect rect)
159+
protected override void SetClip(OxyRect rect)
159160
{
160161
this.gctx.SaveState();
161162
this.gctx.ClipToRect(rect.Convert());
162-
return true;
163163
}
164164

165165
/// <summary>
166166
/// Resets the clip rectangle.
167167
/// </summary>
168-
public override void ResetClip()
168+
protected override void ResetClip()
169169
{
170170
this.gctx.RestoreState();
171171
}
@@ -178,11 +178,11 @@ public override void ResetClip()
178178
/// <param name="thickness">The stroke thickness.</param>
179179
/// <param name="dashArray">The dash array.</param>
180180
/// <param name="lineJoin">The line join type.</param>
181-
/// <param name="aliased">if set to <c>true</c> the shape will be aliased.</param>
182-
public override void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double thickness, double[] dashArray, LineJoin lineJoin, bool aliased)
181+
public override void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double thickness, EdgeRenderingMode erm, double[] dashArray, LineJoin lineJoin)
183182
{
184183
if (stroke.IsVisible() && thickness > 0)
185184
{
185+
bool aliased = this.ShouldUseAntiAliasingForLine(erm, points);
186186
this.SetAlias(aliased);
187187
this.SetStroke(stroke, thickness, dashArray, lineJoin);
188188

@@ -206,9 +206,9 @@ public override void DrawLine(IList<ScreenPoint> points, OxyColor stroke, double
206206
/// <param name="thickness">The stroke thickness.</param>
207207
/// <param name="dashArray">The dash array.</param>
208208
/// <param name="lineJoin">The line join type.</param>
209-
/// <param name="aliased">If set to <c>true</c> the shape will be aliased.</param>
210-
public override void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness, double[] dashArray, LineJoin lineJoin, bool aliased)
209+
public override void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode erm, double[] dashArray, LineJoin lineJoin)
211210
{
211+
bool aliased = this.ShouldUseAntiAliasingForLine(erm, points);
212212
this.SetAlias(aliased);
213213
var convertedPoints = (aliased ? points.Select(p => p.ConvertAliased()) : points.Select(p => p.Convert())).ToArray();
214214
if (fill.IsVisible())
@@ -246,10 +246,11 @@ public override void DrawPolygon(IList<ScreenPoint> points, OxyColor fill, OxyCo
246246
/// <param name="fill">The fill color.</param>
247247
/// <param name="stroke">The stroke color.</param>
248248
/// <param name="thickness">The stroke thickness.</param>
249-
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
249+
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness, EdgeRenderingMode erm)
250250
{
251-
this.SetAlias(true);
252-
var convertedRect = rect.ConvertAliased();
251+
bool aliased = this.ShouldUseAntiAliasingForRect(erm);
252+
this.SetAlias(aliased);
253+
var convertedRect = aliased ? rect.ConvertAliased() : rect.Convert();
253254

254255
if (fill.IsVisible())
255256
{

Source/OxyPlot.Xamarin.iOS/PlotView.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ public override void Draw(CoreGraphics.CGRect rect)
313313
context.FillRect (rect);
314314
}
315315

316-
actualModel.Render(renderer, rect.Width, rect.Height);
316+
OxyRect orect = new OxyRect(0, 0, rect.Width, rect.Height);
317+
actualModel.Render(renderer, orect);
317318
}
318319
}
319320
}

0 commit comments

Comments
 (0)