-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use device scale factor to support higher DPI on WPF #842
Use device scale factor to support higher DPI on WPF #842
Conversation
Is it possible to remove the |
@@ -811,6 +812,12 @@ public BitmapInfo CreateBitmapInfo(bool isPopup) | |||
return BitmapFactory.CreateBitmap(isPopup); | |||
} | |||
|
|||
float _deviceScaleFactor = 1.0F; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Underscores only in c++
code - consistency.
Variables should also be declared in the one place for consistency.
Additional info on scaling in this thread https://code.google.com/p/chromiumembedded/issues/detail?id=946#c6 |
- move variable declaration
Actually it's the combination of the ScaleTransform and device scale factor that makes it work properly. Without the transform and the device scale factor the wpf browser content would be the correct size on screen. WPF will upscale the image to comply with the current DPI setting, but this would just be an upscaling of the bitmap image -> very blurry. The scale transform keeps the pixel size from cef, which leads to a too small image when you have a higher DPI than 100%. The device scale factor "zooms" the rendered content from cef up to the correct size on screen. |
That's based on the transformed dimensions. I still think there's some investigation required. |
We should also expose this http://magpcss.org/ceforum/apidocs3/projects/(default)/CefBrowserHost.html#NotifyScreenInfoChanged() |
The NotifyScreenInfoChanged should then probably be triggered in this method: https://github.com/cefsharp/CefSharp/blob/master/CefSharp.Wpf/ChromiumWebBrowser.cs#L647 That would also mean that the scale transform needs to be updated at the same time, I believe. |
- update the scaletransform when presentation source is changed
I've merged this though I still think further research is needed. The fact that it works is definitely an improvement, though I'm not convinced what we have is the
It's my understanding that |
… can be conducted - need to look more info how scale factor works and if the ScaleTransform we have is required.
#836