MetalNanoVG icon indicating copy to clipboard operation
MetalNanoVG copied to clipboard

With stencil strokes enabled, strokewidth = 1. is invisible on non-retina screen

Open olilarkin opened this issue 6 years ago • 12 comments

This didn't used to be the case. Here is a test project demonstrating the problem:

https://github.com/olilarkin/TestNVGMetal/blob/master/TestNVGMetal/Renderer.m#L13

olilarkin avatar Mar 24 '19 13:03 olilarkin

Is it visible on a retina screen?

olliwang avatar Mar 24 '19 17:03 olliwang

yes

olilarkin avatar Mar 24 '19 17:03 olilarkin

Screen Shot 2019-03-24 at 21 08 07

this is how the Moui demo looks on non-retina if i enable stencil strokes

olilarkin avatar Mar 24 '19 21:03 olilarkin

I believe on retina screen the strokes are also thinner than they should be

olilarkin avatar Mar 26 '19 10:03 olilarkin

@olilarkin Are you using macOS older than 10.14? I saw the same effect on my old MacBook Air with macOS 10.13.x installed. However, the issue is gone after I upgraded the macOS to Mojave (10.14). But Mojave introduces other new weird effects on my old MacBook Air. WIll investigate into it later.

olliwang avatar Mar 28 '19 04:03 olliwang

yes. this is on 10.13

olilarkin avatar Mar 28 '19 10:03 olilarkin

So that's the issue only happened on 10.13. Unfortunately, all of my mac devices are upgraded to 10.14. You will need to fix it by yourself if you want to run it on 10.13.

I also found that there is a problem when resizing window on 10.13 and the issue is gone on 10.14.

olliwang avatar Mar 28 '19 10:03 olliwang

@olilarkin It seems that commenting out this line would fix the issue: https://github.com/ollix/MetalNanoVG/blob/e1aad96565191638d4c8e0a804674b70837d6bcb/src/nanovg_mtl.m#L683

Can you test it in your real project to check if there is any side effect?

olliwang avatar Mar 30 '19 16:03 olliwang

i'm away from my non-retina screen at the moment, but i can test next week

olilarkin avatar Mar 30 '19 18:03 olilarkin

Sure. Please test your real project on both retina and non-retina screens. :)

olliwang avatar Mar 31 '19 05:03 olliwang

Good work :-) it fixes the problem. My project and Moui NanoVG demo look fine on both screens now

olilarkin avatar Apr 02 '19 18:04 olilarkin

@olilarkin Thanks for reporting. I just found that the transparency is gone for this solution. We'll need another solution. :(

olliwang avatar Apr 03 '19 09:04 olliwang