Skip to content

Commit

Permalink
Merge pull request #285 from Lehonti/improvesomething1
Browse files Browse the repository at this point in the history
Modernized the syntax of getters in a few places
  • Loading branch information
cameronwhite authored Aug 7, 2023
2 parents 14138d9 + 067fc65 commit 67e02dc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 46 deletions.
10 changes: 5 additions & 5 deletions Pinta.Core/Effects/BaseEffect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ public abstract class BaseEffect
/// <summary>
/// Returns whether this effect can display a configuration dialog to the user. (Implemented by LaunchConfiguration ().)
/// </summary>
public virtual bool IsConfigurable { get { return false; } }
public virtual bool IsConfigurable => false;

/// <summary>
/// Returns the keyboard shortcut for this adjustment. Only affects adjustments, not effects. Default is no shortcut.
/// </summary>
public virtual string? AdjustmentMenuKey { get { return null; } }
public virtual string? AdjustmentMenuKey => null;

/// <summary>
/// Returns the modifier(s) to the keyboard shortcut. Only affects adjustments, not effects. Default is Primary+Shift.
/// </summary>
public virtual string AdjustmentMenuKeyModifiers { get { return "<Primary><Shift>"; } }
public virtual string AdjustmentMenuKeyModifiers => "<Primary><Shift>";

/// <summary>
/// Returns the menu category for an effect. Only affects effects, not adjustments. Default is "General".
/// </summary>
public virtual string EffectMenuCategory { get { return "General"; } }
public virtual string EffectMenuCategory => "General";

/// <summary>
/// The user configurable data this effect uses.
Expand Down Expand Up @@ -217,7 +217,7 @@ public virtual EffectData Clone ()
/// <summary>
/// Returns true if the current values of this EffectData do not modify the image. Returns false if current values modify the image.
/// </summary>
public virtual bool IsDefault { get { return false; } }
public virtual bool IsDefault => false;
}

/// <summary>
Expand Down
26 changes: 10 additions & 16 deletions Pinta.Core/Effects/GradientRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public abstract class GradientRenderer
private readonly ColorBgra[] lerp_colors;

public ColorBgra StartColor {
get { return this.start_color; }

get => this.start_color;
set {
if (this.start_color != value) {
this.start_color = value;
Expand All @@ -38,8 +37,7 @@ public ColorBgra StartColor {
}

public ColorBgra EndColor {
get { return this.end_color; }

get => this.end_color;
set {
if (this.end_color != value) {
this.end_color = value;
Expand All @@ -49,27 +47,23 @@ public ColorBgra EndColor {
}

public PointD StartPoint {
get { return this.start_point; }

set { this.start_point = value; }
get => this.start_point;
set => this.start_point = value;
}

public PointD EndPoint {
get { return this.end_point; }

set { this.end_point = value; }
get => this.end_point;
set => this.end_point = value;
}

public bool AlphaBlending {
get { return this.alpha_blending; }

set { this.alpha_blending = value; }
get => this.alpha_blending;
set => this.alpha_blending = value;
}

public bool AlphaOnly {
get { return this.alpha_only; }

set { this.alpha_only = value; }
get => this.alpha_only;
set => this.alpha_only = value;
}

public virtual void BeforeRender ()
Expand Down
12 changes: 2 additions & 10 deletions Pinta.Core/Effects/Histogram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,9 @@ public long[][] HistogramValues {
}
}

public int Channels {
get {
return this.histogram.Length;
}
}
public int Channels => this.histogram.Length;

public int Entries {
get {
return this.histogram[0].Length;
}
}
public int Entries => this.histogram[0].Length;

protected internal Histogram (int channels, int entries)
{
Expand Down
18 changes: 3 additions & 15 deletions Pinta.Core/Effects/Scanline.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,11 @@ public struct Scanline
private readonly int y;
private readonly int length;

public int X {
get {
return x;
}
}
public readonly int X => x;

public int Y {
get {
return y;
}
}
public readonly int Y => y;

public int Length {
get {
return length;
}
}
public readonly int Length => length;

public override int GetHashCode ()
{
Expand Down

0 comments on commit 67e02dc

Please sign in to comment.