Browse Source

Renamed Rect.CenterIn -> CenterRect.

The previous naming suggested that the `Rect` that the method was being
called on was the one being centered.
pull/913/head
Steven Kirk 9 years ago
parent
commit
6cc829a132
  1. 4
      src/Avalonia.Controls/Image.cs
  2. 2
      src/Avalonia.Visuals/Rect.cs

4
src/Avalonia.Controls/Image.cs

@ -63,10 +63,10 @@ namespace Avalonia.Controls
Vector scale = Stretch.CalculateScaling(Bounds.Size, sourceSize);
Size scaledSize = sourceSize * scale;
Rect destRect = viewPort
.CenterIn(new Rect(scaledSize))
.CenterRect(new Rect(scaledSize))
.Intersect(viewPort);
Rect sourceRect = new Rect(sourceSize)
.CenterIn(new Rect(destRect.Size / scale));
.CenterRect(new Rect(destRect.Size / scale));
context.DrawImage(source, 1, sourceRect, destRect);
}

2
src/Avalonia.Visuals/Rect.cs

@ -238,7 +238,7 @@ namespace Avalonia
/// </summary>
/// <param name="rect">The rectangle to center.</param>
/// <returns>The centered rectangle.</returns>
public Rect CenterIn(Rect rect)
public Rect CenterRect(Rect rect)
{
return new Rect(
_x + ((_width - rect._width) / 2),

Loading…
Cancel
Save