Skip to content

Commit

Permalink
Performance Boost
Browse files Browse the repository at this point in the history
  • Loading branch information
changbowen committed Feb 29, 2016
1 parent 7877695 commit 95c1222
Show file tree
Hide file tree
Showing 8 changed files with 297 additions and 200 deletions.
3 changes: 0 additions & 3 deletions Ken Burns Slideshow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal
Binary file modified Ken Burns Slideshow.v12.suo
Binary file not shown.
6 changes: 6 additions & 0 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
<Image x:Name="slide_img0" RenderOptions.BitmapScalingMode="HighQuality"/>
<Image x:Name="slide_img1" RenderOptions.BitmapScalingMode="HighQuality"/>
<TextBlock x:Name="tb_date0" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Georgia" FontStyle="Italic" Foreground="White">
<TextBlock.CacheMode>
<BitmapCache/>
</TextBlock.CacheMode>
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="2" Opacity="0.8"/>
</TextBlock.Effect>
</TextBlock>
<TextBlock x:Name="tb_date1" HorizontalAlignment="Left" VerticalAlignment="Top" FontFamily="Georgia" FontStyle="Italic" Foreground="White">
<TextBlock.CacheMode>
<BitmapCache/>
</TextBlock.CacheMode>
<TextBlock.Effect>
<DropShadowEffect ShadowDepth="2" Opacity="0.8"/>
</TextBlock.Effect>
Expand Down
434 changes: 264 additions & 170 deletions MainWindow.xaml.vb

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions OptWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,10 @@
<ComboBoxItem Content="Random"/>
</ComboBox>
<TextBlock Canvas.Left="345" TextWrapping="Wrap" Text="Active transition" Canvas.Top="163"/>
<TextBlock Canvas.Left="345" TextWrapping="Wrap" Text="Loading Mode" Canvas.Top="221"/>
<ComboBox x:Name="CbB_LoadMode" Canvas.Left="345" Canvas.Top="242" Width="108" SelectedIndex="0" ToolTip="In the next run, load all image to memory at once or load images one by one.&#10;Choose One by One to for less memory usage.&#10;Choose All at Once for smoother animation.">
<ComboBoxItem Content="One by One"/>
<ComboBoxItem Content="All at Once"/>
</ComboBox>
</Canvas>
</Window>
46 changes: 19 additions & 27 deletions OptWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,12 @@
TB_Framerate.Text = MainWindow.framerate
TB_Duration.Text = MainWindow.duration
CbB_Transit.Text = MainWindow.transit
CbB_LoadMode.Text = MainWindow.loadmode_next
TB_LoadQuality.Text = MainWindow.loadquality
CbB_ScaleMode.SelectedItem = New KeyValuePair(Of Integer, String)(MainWindow.scalemode, MainWindow.ScaleMode_Dic(MainWindow.scalemode))
CbB_BlurMode.Text = MainWindow.blurmode
End Sub

'Private Sub ProfileUpdate() Handles CB_Fadeout.Checked, CB_Fadeout.Unchecked
' If Me.IsLoaded Then
' If CB_Fadeout.IsChecked = True AndAlso CB_ResLk.IsChecked = False Then
' RB_Qlty.IsChecked = True
' ElseIf CB_Fadeout.IsChecked = False AndAlso CB_ResLk.IsChecked = True Then
' RB_Perf.IsChecked = True
' Else
' RB_Custom.IsChecked = True
' End If
' End If
'End Sub

Private Sub CB_HorOptm_Change() Handles CB_HorOptm.Unchecked, CB_HorOptm.Checked
If Me.IsLoaded Then
If CB_HorOptm.IsChecked Then
Expand All @@ -56,20 +45,6 @@
End If
End Sub

'Private Sub RB_Perf_Checked(sender As Object, e As RoutedEventArgs) Handles RB_Perf.Checked
' If Me.IsLoaded Then
' CB_Fadeout.IsChecked = False
' CB_ResLk.IsChecked = True
' End If
'End Sub

'Private Sub RB_Qlty_Checked(sender As Object, e As RoutedEventArgs) Handles RB_Qlty.Checked
' If Me.IsLoaded Then
' CB_Fadeout.IsChecked = True
' CB_ResLk.IsChecked = False
' End If
'End Sub

Private Function CheckConsist(chk_str As String, ByRef target As Double, min As Double, max As Double, inclu_min As Boolean, inclu_max As Boolean, err_msg As String) As Boolean
Dim tmp As Double = 0
If Double.TryParse(chk_str, tmp) AndAlso If(inclu_min, tmp >= min, tmp > min) AndAlso If(inclu_max, tmp <= max, tmp < max) Then
Expand Down Expand Up @@ -135,6 +110,7 @@
MainWindow.resolutionLock = CB_ResLk.IsChecked
MainWindow.fadeout = CB_Fadeout.IsChecked
MainWindow.transit = CbB_Transit.Text
MainWindow.loadmode_next = CbB_LoadMode.Text
MainWindow.scalemode = CbB_ScaleMode.SelectedItem.Key
MainWindow.blurmode = CbB_BlurMode.Text

Expand All @@ -161,6 +137,7 @@
config.Add(New XElement("LoadQuality", TB_LoadQuality.Text))
config.Add(New XElement("ScaleMode", CbB_ScaleMode.SelectedItem.Key))
config.Add(New XElement("BlurMode", CbB_BlurMode.Text))
config.Add(New XElement("LoadMode", CbB_LoadMode.Text))
Using lop_str = New IO.StringWriter()
MainWindow.ListOfPic.WriteXml(lop_str)
Dim lop = XElement.Parse(lop_str.ToString)
Expand Down Expand Up @@ -227,7 +204,22 @@
If CB_ResLk.IsChecked Then
TB_LoadQuality.IsEnabled = True
Else
TB_LoadQuality.IsEnabled = False
If CbB_LoadMode.Text = "All at Once" AndAlso MsgBox("It is highly recommended to enable Resolution Lock when Load Mode is set to All at Once. Otherwise it can easily run out of memory when loading large images." & vbCrLf & "Click OK to keep Resolution Lock enabled.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
e.Handled = True
CB_ResLk.IsChecked = True
Else
TB_LoadQuality.IsEnabled = False
End If
End If
End If
End Sub

Private Sub CbB_LoadMode_SelectionChanged(sender As Object, e As SelectionChangedEventArgs) Handles CbB_LoadMode.SelectionChanged
If Me.IsLoaded Then
If CbB_LoadMode.SelectedItem.Content = "All at Once" AndAlso Not CB_ResLk.IsChecked Then
If MsgBox("It is highly recommended to enable Resolution Lock when Load Mode is set to All at Once. Otherwise it can easily run out of memory when loading large images." & vbCrLf & "Click OK to enable Resolution Lock.", MsgBoxStyle.Exclamation + MsgBoxStyle.OkCancel) = MsgBoxResult.Ok Then
CB_ResLk.IsChecked = True
End If
End If
End If
End Sub
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ This idea came to me while watching a slideshow on iPad. How nice would it be if
- Options for each slide is now available by pressing F11.

## Updates
- 2016-03-01
- Added Load Mode option for better performance. **Greatly improved transition framerate under All-at-Once mode.**
- 2016-02-26
- **New transition animation "Throw" added!**
- Changed how certain animations are handled.
Expand Down Expand Up @@ -77,3 +79,4 @@ transitions.
- Animation might not be as smooth when not using Windows Aero themes on Windows 7.
- Preferably a Windows 7 or above PC with a modern discrete GPU gives better / smoother performance.
- Framedrops may occur when certain programs are opened such as Potplayer and Foobar 2000.
- Choose "All at Once" under Load Mode to load all images at program start. It uses more memory but eliminates frame-drops in transition animation.
Binary file modified bin/Release/Ken Burns Slideshow.exe
Binary file not shown.

0 comments on commit 95c1222

Please sign in to comment.