Windows phone 10 black borders

Good evening, I began to use the corona with windows phone 10 and I’m with the problem, the windows phone 8.1 the game resolution is perfect, but the windows phone 10 is large black edges and the game screen is very small regardless of what I do, I’ve tried various solutions more did not work.

On windows phone 8.1 : 

image.jpg

Now the windows phone 10

wp_ss_20160324_0001.png

Are you using Microsoft’s preview/beta of Windows 10 Mobile on your device?

I ask, because Microsoft did state that there were known scaling bugs with some device models on their end.  Case-in-point:

   http://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_update/lumia-640-users-check-here-for-windows-10/e45ddf8c-5660-44bf-aa16-4a2d23c59883?auth=1

The released version of Windows 10 Mobile shouldn’t have these scaling issues.  You can upgrade your phone to the released version of Windows 10 Mobile by downloading Microsoft’s “Upgrade Advisor” from the Windows app store.

I’ve also tested WP8 CoronaCards with the release version of Microsoft’s Windows 10 Mobile emulators.  There is no scaling issues there either.  You can download these emulators via the link below, by clicking that page’s “Download the emulator” link.  That’ll download an install program providing several emulators at different resolutions and different amounts of RAM.

   https://dev.windows.com/en-us/downloads

Good evening, thank you for help.

My phone is with the final version of windows phone 10 testing applications made in corona sdk works normal, the problem is only in mine.

Some who have tested and worked regular:

wp_ss_20160324_00021.png

wp_ss_20160324_00031.png

It works well, am I using the latest version of Corona?

I use v2016.2830

Okay.  So, you’re saying that it works fine on all Windows 10 Mobile device except yours?

Can you tell me the make and model of your device please?  (Example: Lumia 950)

I’m still thinking it’s a bug on Microsoft’s end and that they’re returning the wrong scale factor on the device as mentioned in the link I posted above.  If this is a Microsoft bug that accidentally got released on some devices, then we’ll have to investigate a work-around.  But step 1 is for someone on my end to reproduce this issue.

One more thing.  You *could* try to retarget your project to Windows Phone 8.1.  By doing this, your app will be able to take advantage of 1080P and higher resolution devices (it’ll no longer appear scaled and slightly blurry on those devices), but then you’ll lose 8.0 support.  Your app will only be able to run on 8.1 and 10.  I don’t really recommend it, but it’s worth a try in case there is a backward compatibility bug on Microsoft’s end.  Here’s how to re-target your project:

  1. Open your project in Visual Studio.
  2. Right click on your project in the “Solution Explorer” panel.
  3. Click on “Retarget to Windows Phone 8.1” in the popup menu.
  4. Save and rebuild.

I have the same trouble on my lumia 535. I use released version of Windows 10 with latest updates.

Sometimes the trouble disappears, but reappears after making new build. The reason I can’t identify :frowning:

“Retarget to Windows Phone 8.1” doesn’t solve the trouble.

I still can not solve, my mobile is also a lumia 535, which I do not understand is why the games of other work, it just happens to my games on my phone, I have an application in the phone windows store and some users are already complaining of this problem.

Can you both do a quick test for me please?

Open your “MainPage.xaml.cs” file and add the following lines of code to the bottom of the MainPage() constructor…

System.Diagnostics.Debug.WriteLine("### Resolution Scale: {0}", Windows.Graphics.Display.DisplayProperties.ResolutionScale.ToString()); System.Diagnostics.Debug.WriteLine("### Content Scale: {0}", (double)System.Windows.Application.Current.Host.Content.ScaleFactor / 100.0);

Then run your project in Visual Studio in “Debug” mode on your Lumia 535 device.

The above code will log Microsoft’s scale factors to Visual Studio’s “Output” panel.

Please post the results to this forum here.

If you can do this by tomorrow, then that would be great… because I *think* I know what the issue is, but I need confirmation from real devices.  If you can do this, then I’ll personally jump on this issue tomorrow.  Thanks!

This would be the result:

Resolution Scale: Scale100Percent

Content Scale: 1

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / Português (Brasil) | BR | pt-BR | pt

Well there’s the problem.  Microsoft is only supposed to return a scale of 1.0 for a 480x800 resolution device.  Corona uses the “Content.ScaleFactor” property (recommended by Microsoft’s examples) to calculate the pixel width/height of the screen.  Microsoft documents what the content resolution and scales are here…
   https://msdn.microsoft.com/en-us/library/windows/apps/jj206974(v=vs.105).aspx#BKMK_Supportedresolutions
 
From looking at the Lumia 535 device’s specification, it has an unusual resolution of 540x960 pixels…
   https://www.microsoft.com/en/mobile/phone/lumia535/specifications
 
I suspect that Microsoft’s APIs are returning 480x800 pixel resolution for that device based on your screenshots, making it a bug on their end.  You can confirm this by adding the following to your MainPage.xaml.cs file.

public MainPage() { // Initialize this page's components that were set up via the UI designer. InitializeComponent(); // Set up Corona to automatically start up when the control's Loaded event has been raised. // Note: By default, Corona will run the "main.lua" file in the "Assets\Corona" directory. // You can change the defaults via the CoronaPanel's AutoLaunchSettings property. fCoronaPanel.AutoLaunchEnabled = true; // Set up the CoronaPanel control to render fullscreen via the DrawingSurfaceBackgroundGrid control. // This significantly improves the framerate and is the only means of achieving 60 FPS. fCoronaPanel.BackgroundRenderingEnabled = true; fDrawingSurfaceBackgroundGrid.SetBackgroundContentProvider(fCoronaPanel.BackgroundContentProvider); fDrawingSurfaceBackgroundGrid.SetBackgroundManipulationHandler(fCoronaPanel.BackgroundManipulationHandler); this.Loaded += OnLoaded; } private void OnLoaded(object sender, RoutedEventArgs e) { var content = System.Windows.Application.Current.Host.Content; System.Diagnostics.Debug.WriteLine("### Resolution Scale: {0}", Windows.Graphics.Display.DisplayProperties.ResolutionScale.ToString()); System.Diagnostics.Debug.WriteLine("### Content Scale: {0}", (double)content.ScaleFactor / 100.0); System.Diagnostics.Debug.WriteLine("### Content Size: {0}x{1}", content.ActualWidth, content.ActualHeight); System.Diagnostics.Debug.WriteLine("### Page Size: {0}x{1}", this.ActualWidth, this.ActualHeight); System.Diagnostics.Debug.WriteLine("### CoronaPanel Size: {0}x{1}", fCoronaPanel.ActualWidth, fCoronaPanel.ActualHeight); { object result = "null"; Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("RawDpiX", out result); System.Diagnostics.Debug.WriteLine("### RawDpiX: {0}", result); } { object result = "null"; Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("RawDpiY", out result); System.Diagnostics.Debug.WriteLine("### RawDpiY: {0}", result); } { var size = new System.Windows.Size(0, 0); object result = null; Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("PhysicalScreenResolution", out result); if (result is System.Windows.Size) { size = (System.Windows.Size)result; } System.Diagnostics.Debug.WriteLine("### PhysicalScreenResolution: {0}x{1}", size.Width, size.Height); } }

The above will log the widths and height from various APIs to Visual Studio’s “Output” panel like before.  If the above returns a 480x800 resolution, then unfortunately there is nothing we can do in code to fix this.  All we can do is report it as a Lumia 535 specific bug to Microsoft and hope they’ll patch it in the near future.

There is 1 more thing I’d like you to print out.  Please add the following line to your code.

System.Diagnostics.Debug.WriteLine("### Logical DPI: {0}", Windows.Graphics.Display.DisplayProperties.LogicalDpi);

The “LogicalDpi” is the scale factor Microsoft uses to scale fonts and Microsoft typically does dynamic layout based on the system’s default font size.  So, I’m thinking that API has to provide the correct scale factor for your phone.

For your info, the font scale factor is calculated like this…

   scale = logicalDpi / 96.0

So, hopefully the logical DPI is greater than 96.0 for your phone.  (Fingers crossed.)

I understand, but because usually works when the machine is running Windows 8.1 phone?

Right.  I’ve never heard of any scaling bugs on Windows Phone 8.0 or 8.1.

Microsoft did report scaling bugs on Windows Phone 8.x devices that were upgraded to Windows 10 during the beta last year.  You can see that in the link I provided in my 1st forum post up above.  It sounds like Microsoft hasn’t fixed these scaling bugs on all devices yet.  I’m guessing that these scaling bugs only happen with Silverlight *.xap applications and not with Universal *.appx applications which were designed for Windows 10.

If you can tell me what the “LogicalDpi” property returns, then that would be a big help.  I gave you that code snipped in my last forum post on this thread (just above this one).  I’m hoping that property returns the correct scale factor for your device on Windows 10 Mobile.  If it does, then we should be abel to work-around this Microsoft bug.

Hi,

I have the same problem. I am using Lumia 535. Here is output

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2853 

The thread 0x2ec has exited with code 0 (0x0).

The thread 0x16e4 has exited with code 0 (0x0).

Resolution Scale: Scale100Percent

Content Scale: 1

Content Size: 480x800

Page Size: 741x480

CoronaPanel Size: 741x480

RawDpiX: 196,645161290323

RawDpiY: 196,645161290323

PhysicalScreenResolution: 480x800

Logical DPI: 96

It would be great if Corona would provide some kind of solution.

Best,

Primoz

A doubt, because this game: https://www.microsoft.com/pt-br/store/games/corona-cannon/9nblggh5pwvn

It works seamlessly on lumia 535?

Is it any adaptation in the lua code or visual studio project?

Primoz, Welton,

If you look at the returned values, notice that the device is returning a 480x800 resolutions with a 1.0 scale factor.  A Lumia 535 is a 540x960 resolution device.  So, Microsoft’s APIs are clearly returning the wrong values for that device.  That’s the issue.  It’s a Microsoft bug that they need to fix.  I don’t see how we can work-around this issue on our end.

I think the best we can do at this point is report it as a bug to Microsoft.  The only means I know of doing this is to start a “discussion” (aka: forum post) on their website here…

   http://answers.microsoft.com/en-us/mobiledevices

If you are to report it, then the best description to use is…

Lumia 535 running Windows 10 Mobile returns the wrong pixel resolution and scale factor to Silverlight apps.  This causes Direct3D apps to render at a smaller scale onscreen than they should.

The following API returns a 480x800 size when it should return a 540x960 size…

   Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue(“PhysicalScreenResolution”, out result);

​And the following APIs return a 1.0 scale factor when it should be a larger scale since the “Content” object’s ActualWidth/ActualHeight are 480x800…

   System.Windows.Application.Current.Host.Content.ScaleFactor;  // = 100

   Windows.Graphics.Display.DisplayProperties.ResolutionScale;  // = Scale100Percent

   Windows.Graphics.Display.DisplayProperties.LogicalDpi;  // = 96.0

Hmm… apparently this is a common problem with the Lumia 535.  Have a look here…

   http://answers.microsoft.com/en-us/mobiledevices/forum/mdlumia-mdw10phone/help-help-problem-after-upgrade-to-windows-10-my/eaa9b68f-7ea6-45dd-8075-0ddd440b27f2

   http://answers.microsoft.com/en-us/mobiledevices/forum/mdlumia-mdw10phone/black-line/17569f49-897f-44d7-acdb-5446b55e64ea

   http://answers.microsoft.com/en-us/mobiledevices/forum/mdlumia-mdw10phone/navigation-bar-on-lumia-535-running-windows-10/0665266a-4bc1-4c09-aba0-ec999ce2c1e1

We have tried running our Corona Cards apps on some devices running Windows Phone 10: Lumia 535, Lumia 640XL, Lumia 735 and Lumia 550. There was problem on all of them as in welton-alexandre’s first post images (Hello world example). Apps are scaled down and black borders are on top and from side (on Lumia 535 there is diffrent problem, black bar is on the bottom if you hide Windows nav buttons). 

You can try to reproduce this by creating new Corona Cards app (Hello World default template) in Visual Studio (2013 or 2015) and deploy it on any Windows 10 phone. 

We have commented out 3 lines 

// Set up the CoronaPanel control to render fullscreen via the DrawingSurfaceBackgroundGrid control.

// This significantly improves the framerate and is the only means of achieving 60 FPS.

/*fCoronaPanel.BackgroundRenderingEnabled = true;

fDrawingSurfaceBackgroundGrid.SetBackgroundContentProvider(fCoronaPanel.BackgroundContentProvider);

fDrawingSurfaceBackgroundGrid.SetBackgroundManipulationHandler(fCoronaPanel.BackgroundManipulationHandler);*/

regarding DrawingSurfaceBackgroundGrid and now apps are rendered FINE in fullscreen, not scaled down. 

Is this good aproach? Do you use DrawingSurfaceBackgroundGrid in your game Corona Cannon published on MS Store? Can you share VS project of Corona Cannon?
 

Thanks!

I looked up the specs of all the Lumia modes you listed.  The one thing they *all* have in common is that they use an onscreen navigation bar.  So far, this appears to be never an issue with a device that has physical navigation buttons.

We don’t have those specific devices.  So, can you run the code that I’ve posted above to retrieve the resolution and scale factor being reported by Microsoft’s APIs please?  I suspect that Microsoft’s APIs are returning 480x800 resolutions for all of those devices, which would account for the scaling issues.

Regarding disabling background rendering, you’ll run into 2 issues with that.  First, 60 FPS is impossible because rendering to a Silverlight view/control is the equivalent to taking a screenshot every frame; it’s slow, but it’ll work.  Second, the touch/tap points Corona reports will likely be wrong because they’re based on the resolution reported by Microsoft’s APIs I’ve mentioned above.

Note that the reason that disable background rendering works is because we’re rendering to the view’s coordinates and letting Silverlight scale up the view for us.  But background rendering involves us rendering straight to the screen in pixels for best performance and this means Microsoft’s APIs *need* to return the correct resolution and scale in order for us to render fullscreen.

I have installed Corona Cannon ( https://www.microsoft.com/pt-br/store/games/corona-cannon/9nblggh5pwvn ) to all my devices. Game works fine, without any scaling.

If I build Corona Cannon from github ( https://github.com/coronalabs-samples/CoronaCannon ) with BackgroundRenderingEnabled as recommended, game is scaled down, on Lumia 640 XL whole game is rendered to only 1/4 of the screen.

So I assume that if you were using BackgroundRenderingEnabled in Corona Cannon project, there is a *solution*. Maybe it has something to do with your Visual Studio project setup.

Is there a way that you share your Corona Cannon Visual Studio project and Corona Cards version it was build and published with? Which version of Visual Studio and Visual Studio update were you using? I would like to build Corona Cannon as you did.

Anyway, a lot of MS Lumia Windows Phone 10 devices are without physical navigation buttons, so we must figure out workaround :).

Thanks!

Output >>>>>

Lumia 535

Resolution Scale: Scale100Percent

Content Scale: 1

Content Size: 480x800

Page Size: 480x771

CoronaPanel Size: 480x771

RawDpiX: 196,645161290323

RawDpiY: 196,645161290323

PhysicalScreenResolution: 480x800

Logical DPI: 96

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en

Lumia 640 XL

Resolution Scale: Scale150Percent

Content Scale: 1

Content Size: 480x800

Page Size: 480x772

CoronaPanel Size: 480x772

RawDpiX: 171.718309859155

RawDpiY: 171.718309859155

PhysicalScreenResolution: 480x800

Logical DPI: 144

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 305 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en

Lumia 550

Resolution Scale: Scale150Percent

Content Scale: 1

Content Size: 480x800

Page Size: 480x768

CoronaPanel Size: 480x768

RawDpiX: 210.206896551724

RawDpiY: 210.206896551724

PhysicalScreenResolution: 480x800

Logical DPI: 144

Platform: Not Supported Yet / ARM / 8.0 / ANGLE (Qualcomm Adreno 304 Direct3D11 vs_2_0 ps_2_0) / OpenGL ES 2.0 (ANGLE 1.2.0.2446) / 2016.2830 / English (United States) | US | en-US | en