@@ -650,12 +650,10 @@ namespace CefSharp
650650 Content = _image = gcnew Image ();
651651 RenderOptions::SetBitmapScalingMode (_image, BitmapScalingMode::NearestNeighbor);
652652
653- // If the display properties is set to 125%, M11 and M22 will be 1.25.
654- auto factorX = _matrix->M11 ;
655- auto factorY = _matrix->M22 ;
656- auto scaleX = 1 / factorX;
657- auto scaleY = 1 / factorY;
658- _image->LayoutTransform = gcnew ScaleTransform (scaleX, scaleY);
653+ if (IsNonStandardDpi ())
654+ {
655+ _image->LayoutTransform = GetScaleTransform ();
656+ }
659657
660658 _popup = gcnew Popup ();
661659 _popup->Child = _popupImage = gcnew Image ();
@@ -678,6 +676,22 @@ namespace CefSharp
678676 _popupImage->VerticalAlignment = ::VerticalAlignment::Top;
679677 }
680678
679+ bool WebView::IsNonStandardDpi ()
680+ {
681+ // If the display properties is set to e.g. 125%, M11 and M22 will be 1.25.
682+ return _matrix->M11 != 1 ||
683+ _matrix->M22 != 1 ;
684+ }
685+
686+ Transform^ WebView::GetScaleTransform()
687+ {
688+ auto factorX = _matrix->M11 ;
689+ auto factorY = _matrix->M22 ;
690+ auto scaleX = 1 / factorX;
691+ auto scaleY = 1 / factorY;
692+ return gcnew ScaleTransform (scaleX, scaleY);
693+ }
694+
681695 void WebView::SetCursor (IntPtr cursor)
682696 {
683697 SafeFileHandle^ handle = gcnew SafeFileHandle (cursor, false );
0 commit comments