Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set image source after setting decode size to fix #71 #77

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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