From 3924bd1a4364455ab8a5747e3cb0b3000dbaa589 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Fri, 8 Mar 2024 17:16:32 +0100 Subject: [PATCH] Update dependencies from SixLabors to the latest version before the license change (#6440) * nuget: bump SixLabors.ImageSharp from 1.0.4 to 2.1.3 (#3976) * nuget: bump SixLabors.ImageSharp from 1.0.4 to 2.1.3 Bumps [SixLabors.ImageSharp](https://github.com/SixLabors/ImageSharp) from 1.0.4 to 2.1.3. - [Release notes](https://github.com/SixLabors/ImageSharp/releases) - [Commits](https://github.com/SixLabors/ImageSharp/compare/v1.0.4...v2.1.3) --- updated-dependencies: - dependency-name: SixLabors.ImageSharp dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Update for 2.x changes Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mary * Update SixLabors.ImageSharp to 2.1.7 This is the latest version we can update to without the license change. * Update SixLabors.ImageSharp.Drawing to v1.0.0 This is the latest version we can update to without the license change. --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Mary --- Directory.Packages.props | 4 +- .../SoftwareKeyboardRendererBase.cs | 38 +++++++++---------- src/Ryujinx/UI/Windows/IconColorPicker.cs | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 412b33a6e3..00e6a25b03 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -42,8 +42,8 @@ - - + + diff --git a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs index 75c648ff15..0b87f87adc 100644 --- a/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs +++ b/src/Ryujinx.HLE/HOS/Applets/SoftwareKeyboard/SoftwareKeyboardRendererBase.cs @@ -44,10 +44,10 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard private readonly Color _textSelectedColor; private readonly Color _textOverCursorColor; - private readonly IBrush _panelBrush; - private readonly IBrush _disabledBrush; - private readonly IBrush _cursorBrush; - private readonly IBrush _selectionBoxBrush; + private readonly Brush _panelBrush; + private readonly Brush _disabledBrush; + private readonly Brush _cursorBrush; + private readonly Brush _selectionBoxBrush; private readonly Pen _textBoxOutlinePen; private readonly Pen _cursorPen; @@ -97,10 +97,10 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard _cursorBrush = new SolidBrush(_textNormalColor); _selectionBoxBrush = new SolidBrush(selectionBackgroundColor); - _textBoxOutlinePen = new Pen(borderColor, _textBoxOutlineWidth); - _cursorPen = new Pen(_textNormalColor, cursorWidth); - _selectionBoxPen = new Pen(selectionBackgroundColor, cursorWidth); - _padPressedPen = new Pen(borderColor, _padPressedPenWidth); + _textBoxOutlinePen = Pens.Solid(borderColor, _textBoxOutlineWidth); + _cursorPen = Pens.Solid(_textNormalColor, cursorWidth); + _selectionBoxPen = Pens.Solid(selectionBackgroundColor, cursorWidth); + _padPressedPen = Pens.Solid(borderColor, _padPressedPenWidth); _inputTextFontSize = 20; @@ -178,7 +178,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard private static void SetGraphicsOptions(IImageProcessingContext context) { context.GetGraphicsOptions().Antialias = true; - context.GetShapeGraphicsOptions().GraphicsOptions.Antialias = true; + context.GetDrawingOptions().GraphicsOptions.Antialias = true; } private void DrawImmutableElements() @@ -293,31 +293,31 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard } private static RectangleF MeasureString(string text, Font font) { - RendererOptions options = new(font); + TextOptions options = new(font); if (text == "") { - FontRectangle emptyRectangle = TextMeasurer.Measure(" ", options); + FontRectangle emptyRectangle = TextMeasurer.MeasureSize(" ", options); return new RectangleF(0, emptyRectangle.Y, 0, emptyRectangle.Height); } - FontRectangle rectangle = TextMeasurer.Measure(text, options); + FontRectangle rectangle = TextMeasurer.MeasureSize(text, options); return new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } private static RectangleF MeasureString(ReadOnlySpan text, Font font) { - RendererOptions options = new(font); + TextOptions options = new(font); if (text == "") { - FontRectangle emptyRectangle = TextMeasurer.Measure(" ", options); + FontRectangle emptyRectangle = TextMeasurer.MeasureSize(" ", options); return new RectangleF(0, emptyRectangle.Y, 0, emptyRectangle.Height); } - FontRectangle rectangle = TextMeasurer.Measure(text, options); + FontRectangle rectangle = TextMeasurer.MeasureSize(text, options); return new RectangleF(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); } @@ -350,7 +350,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard // Draw the cursor on top of the text and redraw the text with a different color if necessary. Color cursorTextColor; - IBrush cursorBrush; + Brush cursorBrush; Pen cursorPen; float cursorPositionYTop = inputTextY + 1; @@ -435,7 +435,7 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard new PointF(cursorPositionXLeft, cursorPositionYBottom), }; - context.DrawLines(cursorPen, points); + context.DrawLine(cursorPen, points); } else { @@ -562,12 +562,12 @@ namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard // Convert the pixel format used in the image to the one used in the Switch surface. - if (!_surface.TryGetSinglePixelSpan(out Span pixels)) + if (!_surface.DangerousTryGetSinglePixelMemory(out Memory pixels)) { return; } - _bufferData = MemoryMarshal.AsBytes(pixels).ToArray(); + _bufferData = MemoryMarshal.AsBytes(pixels.Span).ToArray(); Span dataConvert = MemoryMarshal.Cast(_bufferData); Debug.Assert(_bufferData.Length == _surfaceInfo.Size); diff --git a/src/Ryujinx/UI/Windows/IconColorPicker.cs b/src/Ryujinx/UI/Windows/IconColorPicker.cs index 4c75a5ff9e..72660351a8 100644 --- a/src/Ryujinx/UI/Windows/IconColorPicker.cs +++ b/src/Ryujinx/UI/Windows/IconColorPicker.cs @@ -127,7 +127,7 @@ namespace Ryujinx.Ava.UI.Windows public static Bgra32[] GetBuffer(Image image) { - return image.TryGetSinglePixelSpan(out var data) ? data.ToArray() : Array.Empty(); + return image.DangerousTryGetSinglePixelMemory(out var data) ? data.ToArray() : Array.Empty(); } private static int GetColorScore(Dictionary dominantColorBin, int maxHitCount, PaletteColor color)