Skip to content

Commit

Permalink
Set image source after setting decode size to fix QuinnDamerell#71
Browse files Browse the repository at this point in the history
Images were decoding at full size despite setting decode size.
This seems to be because the source was set first, so the image
could decode before decode size was set.
  • Loading branch information
dreamlayers authored and ironyman committed Sep 21, 2022
1 parent 7014839 commit 749560e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Baconit/ContentPanels/Panels/BasicImageContentPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,10 +347,6 @@ public bool ReloadImage(bool useFullsize)
bitmapImage.ImageOpened += BitmapImage_ImageOpened;
bitmapImage.ImageFailed += BitmapImage_ImageFailed;

// Set the source.
stream.Seek(0);
bitmapImage.SetSource(stream);

// Get the decode height and width.
int decodeWidth = 0;
int decodeHeight = 0;
Expand Down Expand Up @@ -379,6 +375,10 @@ public bool ReloadImage(bool useFullsize)
// if we use physical.
bitmapImage.DecodePixelType = App.BaconMan.MemoryMan.MemoryPressure < MemoryPressureStates.Medium ? DecodePixelType.Logical : DecodePixelType.Physical;

// Set the source. This must be done after setting decode size and other parameters, so those are respected.
stream.Seek(0);
bitmapImage.SetSource(stream);

// Destroy the old image.
if (m_image.Source != null)
{
Expand Down

0 comments on commit 749560e

Please sign in to comment.