Skip to content
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
9 changes: 7 additions & 2 deletions XamlBrewer.Uwp.AnimatedSplashScreen/PageExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;

using System;
using System.Numerics;
using Windows.Foundation;
using Windows.UI;
Expand All @@ -19,6 +20,8 @@ public static class PageExtensions
/// </summary>
private static Page currentPage;

private static float ScaleFactor;

/// <summary>
/// Opens from splash screen.
/// </summary>
Expand Down Expand Up @@ -60,6 +63,8 @@ public static void OpenFromSplashScreen(this Page page, Rect imageBounds, Uri im
/// <param name="imageUri">The URI of the image.</param>
public static void OpenFromSplashScreen(this Page page, Rect imageBounds, Color backgroundColor, Uri imageUri)
{
ScaleFactor = (float)DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel;

page.Loaded += Page_Loaded;

// Initialize the surface loader
Expand Down Expand Up @@ -119,7 +124,7 @@ private static async void ShowImage(Page page, Rect imageBounds, Uri imageUri, C
var imageSprite = compositor.CreateSpriteVisual();
imageSprite.Brush = compositor.CreateSurfaceBrush(surface);
imageSprite.Offset = new Vector3((float)imageBounds.X, (float)imageBounds.Y, 0f);
imageSprite.Size = new Vector2((float)imageBounds.Width, (float)imageBounds.Height);
imageSprite.Size = new Vector2((float)imageBounds.Width / ScaleFactor, (float)imageBounds.Height / ScaleFactor);
container.Children.InsertAtTop(imageSprite);
}

Expand Down