Permalink
Browse files

Use a single WriteableBitmapRenderer to improve performance.

  • Loading branch information...
igrali committed Sep 26, 2015
1 parent 1f0dfb6 commit 3647d6e22e6946eaaab52ddc7dc8dea446b49bd1
Showing with 5 additions and 2 deletions.
  1. +5 −2 PropertyDescriptions/MainPage.xaml.cs
@@ -29,6 +29,7 @@ namespace PropertyDescriptions
public sealed partial class MainPage : Page
{
private BitmapImage bitmap;
private WriteableBitmapRenderer renderer;
private WriteableBitmap resultBitmap;
private EffectViewModel viewModel;
@@ -87,11 +88,13 @@ private async void EffectRangeSlider_OnValueChanged(object sender, RangeBaseValu
{
this.viewModel.blur.KernelSize = (int)e.NewValue;
using (var renderer = new WriteableBitmapRenderer(this.viewModel.blur, this.resultBitmap))
if (this.renderer == null)
{
await renderer.RenderAsync();
this.renderer = new WriteableBitmapRenderer(this.viewModel.blur, this.resultBitmap);
}
await this.renderer.RenderAsync();
this.resultBitmap.Invalidate();
this.LoadedImage.Source = this.resultBitmap;

0 comments on commit 3647d6e

Please sign in to comment.