Skip to content

Commit 5254912

Browse files
committed
fixed: changing color channel after rotation/flipping messed up render size
#2220
1 parent 4ea54cb commit 5254912

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

Source/Components/ImageGlass.Views/ViewerCanvas.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3386,10 +3386,16 @@ public bool FilterColorChannels(ColorChannels colors, bool requestRerender = tru
33863386
_d2dImage = effect.GetD2D1Bitmap1(Device, ignoreAlpha);
33873387

33883388

3389+
// update new source size
3390+
var newSize = _d2dImage.GetSize();
3391+
var isSizeChanged = newSize.width != SourceWidth || newSize.height != SourceHeight;
3392+
SourceWidth = newSize.width;
3393+
SourceHeight = newSize.height;
3394+
33893395
// render the transformation
33903396
if (requestRerender)
33913397
{
3392-
Refresh(resetZoom: false);
3398+
Refresh(resetZoom: isSizeChanged);
33933399
}
33943400

33953401
return true;

Source/ImageGlass/FrmMain/FrmMain.IGMethods.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,7 @@ private void SetImageColorChannels(ColorChannels channels)
34923492

34933493

34943494
// apply color channels filter
3495-
if (PicMain.FilterColorChannels(channels, true))
3495+
if (PicMain.FilterColorChannels(channels, false))
34963496
{
34973497
Local.ImageChannels = channels;
34983498

@@ -3501,6 +3501,14 @@ private void SetImageColorChannels(ColorChannels channels)
35013501
MnuViewChannelGreen.Checked = channels.HasFlag(ColorChannels.G);
35023502
MnuViewChannelBlue.Checked = channels.HasFlag(ColorChannels.B);
35033503
MnuViewChannelAlpha.Checked = channels.HasFlag(ColorChannels.A);
3504+
3505+
if (Local.ImageTransform.HasChanges)
3506+
{
3507+
_ = PicMain.RotateImage(Local.ImageTransform.Rotation, false);
3508+
_ = PicMain.FlipImage(Local.ImageTransform.Flips, false);
3509+
}
3510+
3511+
PicMain.Refresh(resetZoom: false);
35043512
}
35053513
else
35063514
{

0 commit comments

Comments
 (0)