Skip to content

Commit

Permalink
Use the SKPaint.FilterQuality for the SamplingOptions in obsolete met…
Browse files Browse the repository at this point in the history
…hods (#2924)
  • Loading branch information
mattleibow authored Jul 5, 2024
1 parent c264c44 commit 5feff85
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions binding/SkiaSharp/SKCanvas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public void DrawPoint (float x, float y, SKColor color)

public void DrawImage (SKImage image, SKPoint p, SKPaint paint = null)
{
DrawImage (image, p.X, p.Y, SKSamplingOptions.Default, paint);
DrawImage (image, p.X, p.Y, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, paint);
}

public void DrawImage (SKImage image, SKPoint p, SKSamplingOptions sampling, SKPaint paint = null)
Expand All @@ -460,7 +460,7 @@ public void DrawImage (SKImage image, SKPoint p, SKSamplingOptions sampling, SKP

public void DrawImage (SKImage image, float x, float y, SKPaint paint = null)
{
DrawImage (image, x, y, SKSamplingOptions.Default, paint);
DrawImage (image, x, y, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, paint);
}

public void DrawImage (SKImage image, float x, float y, SKSamplingOptions sampling, SKPaint paint = null)
Expand All @@ -472,7 +472,7 @@ public void DrawImage (SKImage image, float x, float y, SKSamplingOptions sampli

public void DrawImage (SKImage image, SKRect dest, SKPaint paint = null)
{
DrawImage (image, null, &dest, SKSamplingOptions.Default, paint);
DrawImage (image, null, &dest, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, paint);
}

public void DrawImage (SKImage image, SKRect dest, SKSamplingOptions sampling, SKPaint paint = null)
Expand All @@ -482,7 +482,7 @@ public void DrawImage (SKImage image, SKRect dest, SKSamplingOptions sampling, S

public void DrawImage (SKImage image, SKRect source, SKRect dest, SKPaint paint = null)
{
DrawImage (image, &source, &dest, SKSamplingOptions.Default, paint);
DrawImage (image, &source, &dest, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, paint);
}

public void DrawImage (SKImage image, SKRect source, SKRect dest, SKSamplingOptions sampling, SKPaint paint = null)
Expand Down Expand Up @@ -941,25 +941,25 @@ public void DrawRoundRectDifference (SKRoundRect outer, SKRoundRect inner, SKPai

// DrawAtlas

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKPaint paint) =>
DrawAtlas (atlas, sprites, transforms, null, SKBlendMode.Dst, SKSamplingOptions.Default, null, paint);
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, null, SKBlendMode.Dst, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, null, paint);

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKSamplingOptions sampling, SKPaint paint) =>
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKSamplingOptions sampling, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, null, SKBlendMode.Dst, sampling, null, paint);

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKPaint paint) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, SKSamplingOptions.Default, null, paint);
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, null, paint);

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKPaint paint) =>
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, sampling, null, paint);

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKRect cullRect, SKPaint paint) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, SKSamplingOptions.Default, &cullRect, paint);
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKRect cullRect, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, paint?.FilterQuality.ToSamplingOptions() ?? SKSamplingOptions.Default, &cullRect, paint);

public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKRect cullRect, SKPaint paint) =>
public void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKRect cullRect, SKPaint paint = null) =>
DrawAtlas (atlas, sprites, transforms, colors, mode, sampling, &cullRect, paint);

private void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKRect* cullRect, SKPaint paint)
private void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[] transforms, SKColor[] colors, SKBlendMode mode, SKSamplingOptions sampling, SKRect* cullRect, SKPaint paint = null)
{
if (atlas == null)
throw new ArgumentNullException (nameof (atlas));
Expand All @@ -976,7 +976,7 @@ private void DrawAtlas (SKImage atlas, SKRect[] sprites, SKRotationScaleMatrix[]
fixed (SKRect* s = sprites)
fixed (SKRotationScaleMatrix* t = transforms)
fixed (SKColor* c = colors) {
SkiaApi.sk_canvas_draw_atlas (Handle, atlas.Handle, t, s, (uint*)c, transforms.Length, mode, &sampling, cullRect, paint.Handle);
SkiaApi.sk_canvas_draw_atlas (Handle, atlas.Handle, t, s, (uint*)c, transforms.Length, mode, &sampling, cullRect, paint?.Handle ?? IntPtr.Zero);
}
}

Expand Down

0 comments on commit 5feff85

Please sign in to comment.