diff --git a/src/Resources/Icons.axaml b/src/Resources/Icons.axaml index 001c7ee7..5e954942 100644 --- a/src/Resources/Icons.axaml +++ b/src/Resources/Icons.axaml @@ -88,6 +88,7 @@ M0 512M1024 512M512 0M512 1024M813 448c-46 0-83 37-83 83 0 46 37 83 83 83 46 0 83-37 83-83 0-46-37-83-83-83zM211 448C165 448 128 485 128 531c0 46 37 83 83 83 46 0 83-37 83-83 0-46-37-83-83-83zM512 448c-46 0-83 37-83 83 0 46 37 83 83 83 46 0 83-37 83-83C595 485 558 448 512 448z M299 811 299 725 384 725 384 811 299 811M469 811 469 725 555 725 555 811 469 811M640 811 640 725 725 725 725 811 640 811M299 640 299 555 384 555 384 640 299 640M469 640 469 555 555 555 555 640 469 640M640 640 640 555 725 555 725 640 640 640M299 469 299 384 384 384 384 469 299 469M469 469 469 384 555 384 555 469 469 469M640 469 640 384 725 384 725 469 640 469M299 299 299 213 384 213 384 299 299 299M469 299 469 213 555 213 555 299 469 299M640 299 640 213 725 213 725 299 640 299Z M64 363l0 204 265 0L329 460c0-11 6-18 14-20C349 437 355 437 362 441c93 60 226 149 226 149 33 22 34 60 0 82 0 0-133 89-226 149-14 9-32-3-32-18l-1-110L64 693l0 117c0 41 34 75 75 75l746 0c41 0 75-34 75-74L960 364c0-0 0-1 0-1L64 363zM64 214l0 75 650 0-33-80c-16-38-62-69-103-69l-440 0C97 139 64 173 64 214z + M3.28034 2.21968C2.98745 1.92678 2.51257 1.92677 2.21968 2.21966C1.92678 2.51255 1.92677 2.98743 2.21966 3.28032L3.48327 4.54395C3.17684 5.03983 3 5.62427 3 6.25001V17.75C3 19.5449 4.45507 21 6.25 21H17.75C18.3757 21 18.96 20.8232 19.4559 20.5169L20.7194 21.7805C21.0123 22.0734 21.4872 22.0734 21.7801 21.7805C22.073 21.4876 22.073 21.0127 21.7801 20.7198L3.28034 2.21968ZM12.0681 13.1289L18.2739 19.3349C18.2929 19.3572 18.3118 19.3794 18.3305 19.4014C18.1489 19.4653 17.9535 19.5 17.75 19.5H6.25C6.04613 19.5 5.8504 19.4651 5.66845 19.4011L11.4752 13.7148L12.0681 13.1289ZM11.1189 12.1797C10.8678 12.2865 10.6322 12.4409 10.4258 12.643L4.60326 18.3437C4.53643 18.1583 4.5 17.9584 4.5 17.75V6.25001C4.5 6.04371 4.5357 5.84575 4.60125 5.66196L11.1189 12.1797Z M19.5 16.3183V6.25001C19.5 5.28351 18.7165 4.50001 17.75 4.50001H7.68194L6.18265 3.00069C6.20505 3.00024 6.2275 3.00001 6.25 3.00001H17.75C19.5449 3.00001 21 4.45508 21 6.25001V17.75C21 17.7726 20.9998 17.7952 20.9993 17.8176L19.5 16.3183Z M15.2521 6.50001C16.4959 6.50001 17.5042 7.50832 17.5042 8.75212C17.5042 9.99593 16.4959 11.0042 15.2521 11.0042C14.0083 11.0042 13 9.99593 13 8.75212C13 7.50832 14.0083 6.50001 15.2521 6.50001ZM15.2521 8.00001C14.8367 8.00001 14.5 8.33674 14.5 8.75212C14.5 9.16751 14.8367 9.50424 15.2521 9.50424C15.6675 9.50424 16.0042 9.16751 16.0042 8.75212C16.0042 8.33674 15.6675 8.00001 15.2521 8.00001Z M683 409v204L1024 308 683 0v191c-413 0-427 526-427 526c117-229 203-307 427-307zm85 492H102V327h153s38-63 114-122H51c-28 0-51 27-51 61v697c0 34 23 61 51 61h768c28 0 51-27 51-61V614l-102 100v187z M841 627A43 43 0 00811 555h-299v85h196l-183 183A43 43 0 00555 896h299v-85h-196l183-183zM299 170H213v512H85l171 171 171-171H299zM725 128h-85c-18 0-34 11-40 28l-117 313h91L606 384h154l32 85h91l-117-313A43 43 0 00725 128zm-88 171 32-85h26l32 85h-90z M512 0a512 512 0 01512 512 57 57 0 01-114 0 398 398 0 10-398 398 57 57 0 010 114A512 512 0 01512 0zm367 600 121 120a57 57 0 01-80 81l-40-40V967a57 57 0 01-50 57l-7 0a57 57 0 01-57-57v-205l-40 40a57 57 0 01-75 5l-5-5a57 57 0 01-0-80l120-121a80 80 0 01113-0zM512 272a57 57 0 0157 57V499h114a57 57 0 0156 50L740 556a57 57 0 01-57 57H512a57 57 0 01-57-57v-228a57 57 0 0150-57L512 272z diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index afdff5da..833a84aa 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -266,6 +266,7 @@ LFS OBJECT CHANGE Next Difference NO CHANGES OR ONLY EOL CHANGES + Diable Image filtering Previous Difference Save as Patch Show hidden symbols diff --git a/src/ViewModels/Preferences.cs b/src/ViewModels/Preferences.cs index e41e046e..3a7548b6 100644 --- a/src/ViewModels/Preferences.cs +++ b/src/ViewModels/Preferences.cs @@ -237,6 +237,20 @@ namespace SourceGit.ViewModels set => SetProperty(ref _ignoreWhitespaceChangesInDiff, value); } + public static event Action NoImageFilteringChanged; + + public bool NoImageFiltering + { + get => _noImageFiltering; + set { + if ( SetProperty(ref _noImageFiltering, value)) + { + OnPropertyChanged(); + NoImageFilteringChanged?.Invoke(); + } + } + } + public bool EnableDiffViewWordWrap { get => _enableDiffViewWordWrap; @@ -695,6 +709,7 @@ namespace SourceGit.ViewModels private bool _useFullTextDiff = false; private bool _useBlockNavigationInDiffView = false; private int _lfsImageActiveIdx = 0; + private bool _noImageFiltering = false; private Models.ChangeViewMode _unstagedChangeViewMode = Models.ChangeViewMode.List; private Models.ChangeViewMode _stagedChangeViewMode = Models.ChangeViewMode.List; diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index d1a3966d..3d6322be 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -120,6 +120,25 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/Views/ImageContainer.cs b/src/Views/ImageContainer.cs index b62746ed..f2f393ba 100644 --- a/src/Views/ImageContainer.cs +++ b/src/Views/ImageContainer.cs @@ -11,6 +11,16 @@ namespace SourceGit.Views { public class ImageContainer : Control { + public ImageContainer() + { + SourceGit.ViewModels.Preferences.NoImageFilteringChanged += OnNoImageFilteringChanged; + } + + private void OnNoImageFilteringChanged() + { + InvalidateVisual(); + } + public override void Render(DrawingContext context) { if (_bgBrush == null) @@ -66,7 +76,8 @@ namespace SourceGit.Views public override void Render(DrawingContext context) { base.Render(context); - + var interpolationMode = SourceGit.ViewModels.Preferences.Instance.NoImageFiltering ? BitmapInterpolationMode.None : BitmapInterpolationMode.HighQuality; + using(context.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = interpolationMode })) if (Image is { } image) context.DrawImage(image, new Rect(0, 0, Bounds.Width, Bounds.Height)); } @@ -152,10 +163,12 @@ namespace SourceGit.Views var h = Bounds.Height; var x = w * alpha; var left = OldImage; - if (left != null && alpha > 0) + var interpolationMode = SourceGit.ViewModels.Preferences.Instance.NoImageFiltering ? BitmapInterpolationMode.None : BitmapInterpolationMode.HighQuality; + if (left != null && alpha > 0) { var src = new Rect(0, 0, left.Size.Width * alpha, left.Size.Height); var dst = new Rect(0, 0, x, h); + using(context.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = interpolationMode })) context.DrawImage(left, src, dst); } @@ -164,6 +177,7 @@ namespace SourceGit.Views { var src = new Rect(right.Size.Width * alpha, 0, right.Size.Width * (1 - alpha), right.Size.Height); var dst = new Rect(x, 0, w - x, h); + using (context.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = interpolationMode })) context.DrawImage(right, src, dst); } @@ -296,6 +310,8 @@ namespace SourceGit.Views var right = NewImage; var drawLeft = left != null && alpha < 1.0; var drawRight = right != null && alpha > 0; + var interpolationMode = SourceGit.ViewModels.Preferences.Instance.NoImageFiltering ? BitmapInterpolationMode.None : BitmapInterpolationMode.HighQuality; + using (context.PushRenderOptions(new RenderOptions { BitmapInterpolationMode = interpolationMode })) if (drawLeft && drawRight) { @@ -312,7 +328,6 @@ namespace SourceGit.Views using (dc.PushOpacity(alpha)) dc.DrawImage(right, rtRect); } - context.DrawImage(rt, rtRect, rect); } } diff --git a/src/Views/ImageDiffView.axaml b/src/Views/ImageDiffView.axaml index d0b79f57..058942fe 100644 --- a/src/Views/ImageDiffView.axaml +++ b/src/Views/ImageDiffView.axaml @@ -91,8 +91,7 @@ + NewImage="{Binding New}"/> diff --git a/src/Views/RevisionFiles.axaml b/src/Views/RevisionFiles.axaml index b4bd3354..e2ab3c9a 100644 --- a/src/Views/RevisionFiles.axaml +++ b/src/Views/RevisionFiles.axaml @@ -142,6 +142,26 @@ + + + + + + + + +