Skip to content
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

fix: Ensure fractional DPI is avoided in HW GTK renderer #14403

Merged
merged 2 commits into from
Nov 14, 2023

Conversation

MartinZikmund
Copy link
Member

@MartinZikmund MartinZikmund commented Nov 13, 2023

GitHub Issue (If applicable): closes #14402, fixes #14250

PR Type

What kind of change does this PR introduce?

Due to GuardBand, the rendering of fractional scales is misbehaving terribly

What is the new behavior?

We now fall back to whole scales instead.

Copilot Summary

🤖 Generated by Copilot at edcf4e5

Fix UI rendering bug on GTK with fractional DPI. Use GetNativeDpi() to get the correct DPI value for the render surface in GtkDisplayInformationExtension.cs.

PR Checklist

Please check if your PR fulfills the following requirements:

Other information

Internal Issue (If applicable):

@MartinZikmund MartinZikmund self-assigned this Nov 13, 2023
@github-actions github-actions bot added the area/skia ✏️ Categorizes an issue or PR as relevant to Skia label Nov 13, 2023
@MartinZikmund
Copy link
Member Author

@Mergifyio backport release/stable/5.0

Copy link
Contributor

mergify bot commented Nov 13, 2023

backport release/stable/5.0

✅ Backports have been created

Copy link
Contributor

@ajpinedam ajpinedam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@jeromelaban
Copy link
Member

@MartinZikmund

/__w/1/s/src/Uno.UI.Runtime.Skia.Gtk/Extensions/GtkDisplayInformationExtension.cs(93,10): error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?) [/__w/1/s/src/Uno.UI.Runtime.Skia.Gtk/Uno.UI.Runtime.Skia.Gtk.csproj::TargetFramework=net7.0]
/__w/1/s/src/Uno.UI.Runtime.Skia.Gtk/Extensions/GtkDisplayInformationExtension.cs(93,10): error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?) [/__w/1/s/src/Uno.UI.Runtime.Skia.Gtk/Uno.UI.Runtime.Skia.Gtk.csproj::TargetFramework=net8.0]

@nventive-devops
Copy link
Contributor

The build 101839 found UI Test snapshots differences: android-28-net7: 0, android-28-net7-Snap: 75, ios: 213, ios-Snap: 861, skia-gtk-screenshots: 25, skia-wpf-screenshots: 18, wasm: 31, wasm-automated-net7.0-UWP-Benchmarks: 0, wasm-automated-net7.0-UWP-Default: 31, wasm-automated-net7.0-UWP-RuntimeTests: 1, wasm-automated-net7.0-WinUI-RuntimeTests: 0

Details
  • android-28-net7: 0 changed over 1

  • android-28-net7-Snap: 75 changed over 1048

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Progress_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220_UITests_Windows_UI_Xaml_Controls_ProgressRing_WindowsProgressRing_GH1220
    • SwipeControl_MUXControlsTestApp_SwipeControlPage2_MUXControlsTestApp_SwipeControlPage2
    • Gesture_Recognizer_Pointer_Events_test_bench_UITests_Shared_Windows_UI_Input_GestureRecognizer_PointersEvents
    • Image_ImageWithNoSpecificSize_Uno_UI_Samples_UITests_ImageTestsControl_ImageWithNoSpecificSize
    • ListView_ListViewGroupedVariableHeightComplexTemplate_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewGroupedVariableHeightComplexTemplate
    • Pointers_Sequence_UITests_Shared_Windows_UI_Input_PointersTests_EventsSequences
    • ScrollViewer_UITests_Windows_UI_Xaml_Controls_ScrollViewerTests_ScrollViewer_Padding_UITests_Windows_UI_Xaml_Controls_ScrollViewerTests_ScrollViewer_Padding
    • Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes_UITests_Windows_UI_Xaml_Shapes_Offscreen_Shapes
    • Image_ImageSourceStream_Uno_UI_Samples_UITests_ImageTestsControl_ImageSourceStream
    • ListView_ListViewIncrementalLoading_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewIncrementalLoading
    • ListView_ListView_With_ListViews_Count_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_With_ListViews_Count_Measure
    • Pointers_UITests_Windows_UI_Input_PointersTests_ScrollHandled_UITests_Windows_UI_Input_PointersTests_ScrollHandled
    • GridView_Uno_UI_Samples_Content_UITests_GridView_GridView_Inside_ScrollViewer_Uno_UI_Samples_Content_UITests_GridView_GridView_Inside_ScrollViewer
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats_UITests_Windows_UI_Xaml_Controls_ImageTests_Image_Formats
    • Path_UITests_Shared_Windows_UI_Xaml_Shapes_PathTestsControl_Path_LinearGradientBrush_UITests_Shared_Windows_UI_Xaml_Shapes_PathTestsControl_Path_LinearGradientBrush
    • TextBlock_TextBlock_Visibility_Arrange_UITests_Shared_Windows_UI_Xaml_Controls_TextBlockControl_TextBlock_Visibility_Arrange
    • TextBlock_TextBoxSizeChanging_Uno_UI_Samples_Content_UITests_TextBlockControl_TextBoxSizeChanging
    • MUX_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage_UITests_Shared_Microsoft_UI_Xaml_Controls_TreeViewTests_TreeViewPage
    • Path_Test2_SamplesApp_Windows_UI_Xaml_Shapes_PathTestsControl_Test2
    • Path_Test3_SamplesApp_Windows_UI_Xaml_Shapes_PathTestsControl_Test3
  • ios: 213 changed over 267

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • BitmapSource_PixelSize_UITests_Shared_Windows_UI_Xaml_Controls_ImageTests_Image_ImageSource_PixelSize
    • Check_ListView_Swallows_Measure_before_scroll
    • DatePicker_Flyout_DatePicker_-_Flyout
    • Image_Margins_Identical_WriteableBitmap_Invalidate_-_Result
    • Keyboard_Textbox_NoScrollViewer_Validation_2_-_Remove_Focus_on_placeholderTextTextBox
    • ListView_ExpandableItemLarge_ExpandHeaderWithSingleItem_Validation_Expanded_State
    • ListView_ExpandableItem_ExpandSingleItem_Initial_State
    • ListView_SelectedItem_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListView_SelectedItem
    • Screenshots_Image_Stretch_Algmnt_Inf_Horizontal_Mode-0
    • Screenshots_Image_Stretch_Algmnt_Inf_Horizontal_Mode-1
    • TextBox_AutoGrow_Horizontally_Test_Uno_UI_Samples_Content_UITests_TextBoxControl_Input_Multiline_AutoHeight
    • TextBox_AutoGrow_Vertically_Test_Uno_UI_Samples_Content_UITests_TextBoxControl_Input_Multiline_AutoHeight
    • TextBox_TextAlignment_Justify_Validation_Uno_UI_Samples_Content_UITests_TextBoxControl_TextBox_TextAlignment
    • TextBox_TextAlignment_Left_Validation_Uno_UI_Samples_Content_UITests_TextBoxControl_TextBox_TextAlignment
    • When_Foreground_Brush_Color_Changed_afterColor
    • Button_IsEnabled_Validation_Uno_UI_Samples_Content_UITests_ButtonTestsControl_Button_IsEnabled_Automated
    • ContentPresenter_Template_Uno_UI_Samples_Content_UITests_ContentPresenter_ContentPresenter_Template
    • Flyout_ShowAt_Window_Content_UITests_Windows_UI_Xaml_Controls_FlyoutTests_Flyout_ShowAt_Window_Content
    • Image_Invalid_image_invalid_before_hide
    • Image_Invalid_Uno_UI_Samples_UITests_ImageTests_Image_Invalid
  • ios-Snap: 861 changed over 1039

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Border_Border_Corner_Overlap_UITests_Shared_Windows_UI_Xaml_Controls_BorderTests_Border_CornerOverlap
    • Border_UniformThicknessandNonUniformRadius_Uno_UI_Samples_UITests_BorderTestsControl_UniformThicknessandNonUniformRadius
    • Brushes_ImageBrushLocalAsset_Uno_UI_Samples_UITests_ImageBrushTestControl_ImageBrushLocalAsset
    • Brushes_RectangleStretchFill_Uno_UI_Samples_UITests_ImageBrushTestControl_RectangleStretchFill
    • ContentPresenter_ContentPresenter_Content_DataContext_Uno_UI_Samples_Content_UITests_ContentPresenter_ContentPresenter_Content_DataContext
    • Default_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_Weird_Measure_UITests_Shared_Windows_UI_Xaml_Controls_ListView_ListView_Weird_Measure
    • Default_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Focus_Programmatic_UITests_Windows_UI_Xaml_Controls_TextBox_TextBox_Focus_Programmatic
    • DragAndDrop_UITests_Windows_UI_Xaml_DragAndDrop_DragDrop_ListView_Custom_States_UITests_Windows_UI_Xaml_DragAndDrop_DragDrop_ListView_Custom_States
    • DragAndDrop_UITests_Windows_UI_Xaml_DragAndDrop_DragDrop_TreeView_UITests_Windows_UI_Xaml_DragAndDrop_DragDrop_TreeView
    • Flyouts_UITests_Windows_UI_Xaml_Controls_FlyoutTests_Flyout_ShowAt_Window_Content_UITests_Windows_UI_Xaml_Controls_FlyoutTests_Flyout_ShowAt_Window_Content
    • Flyouts_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent_UITests_Windows_UI_Xaml_Controls_Flyout_Flyout_TemplatedParent
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromStream_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_FromStream
    • Image_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons_UITests_Windows_UI_Xaml_Controls_ImageTests_SvgImageSource_Icons
    • Image_Uno_UI_Samples_UITests_ImageTests_Image_Invalid_Uno_UI_Samples_UITests_ImageTests_Image_Invalid
    • ListView_ListViewItem_PressedState_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewItem_PressedState
    • ListView_ListViewLargeHeader_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewLargeHeader
    • Pointers_Sequence_UITests_Shared_Windows_UI_Input_PointersTests_EventsSequences
    • Pointers_TappedEventTest_Uno_UI_Samples_Samples_Shared_Content_UITests_TappedEventTest
    • Resources_ResourceLoader_Simple_UITests_Shared_Windows_ApplicationModel_Resources_ResourceLoader_ResourceLoader_Simple
    • Resources_StaticResource_Simple_UITests_Shared_Resources_StaticResource_StaticResource_Simple
  • skia-gtk-screenshots: 25 changed over 1137

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView-ListViewSelectedItems.png
    • ListView-ListView_Weird_Measure.png
    • Pickers-CalendarView_Theming.png
    • Image-UniformToFill100x100.png
    • Image-ImageSourceStream.png
    • DragAndDrop-DragDrop_TestPage.png
    • MUX-NavigationViewRS4Page.png
    • Progress-WindowsProgressRing_GH1220.png
    • MediaPlayerElement-MediaPlayerElement_Stretch_Fill.png
    • MediaPlayerElement-Using .3gp.png
    • PipsPager-PipsPagerExamples.png
    • MUX-WinUIProgressRingPage.png
    • MUX-WinUIProgressRing_CustomSources.png
    • ListView-ListView_IsSelected.png
    • NavigationView-NavigationViewRS4Page.png
    • Progress-WinUIProgressRingPage.png
    • Progress-WinUIProgressRing_CustomSources.png
    • Progress-WinUIProgressRing_Features.png
    • Transform-TransformToVisual_Translate2d.png
    • WinUI-PipsPagerExamples.png
  • skia-wpf-screenshots: 18 changed over 1137

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • Automation-AutomationProperties_Name.png
    • Pickers-CalendarView_Theming.png
    • DragAndDrop-DragDrop_TestPage.png
    • Brushes-ImageBrush_SameWithDelay.png
    • Progress-ProgressRingHeightTest.png
    • ListView-ListViewSelectedItems.png
    • MUX-WinUIProgressRingPage.png
    • MUX-WinUIProgressRing_CustomSources.png
    • PipsPager-PipsPagerExamples.png
    • Progress-WinUIProgressRingPage.png
    • Progress-WinUIProgressRing_CustomSources.png
    • Progress-WinUIProgressRing_Features.png
    • Progress-WindowsProgressRing_GH1220.png
    • Transform-TransformToVisual_Translate2d.png
    • Windows.UI.Composition-CompositionMaskBrush.png
    • Windows.UI.Composition-CompositionVisualSurface.png
    • Windows.UI.Composition-RedirectVisual.png
    • WinUI-PipsPagerExamples.png
  • wasm: 31 changed over 1044

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • MUXControlsTestApp.NavigationViewBlankPage1
    • UITests.Microsoft_UI_Xaml_Controls.TabViewTests.TabViewPage
    • UITests.Windows_UI_Xaml_Controls.ProgressRing.WindowsProgressRing_GH1220
    • SamplesApp.Samples.NavigationViewSample.NavigationViewSample
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Ogg_Extension
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Stretch_Fill
    • UITests.Windows_UI_Xaml.DragAndDrop.DragDrop_TestPage
    • UITests.Windows_UI_ViewManagement.ApplicationViewSizing
    • UITests.Shared.Microsoft_UI_Xaml_Controls.ColorPickerTests.WinUIColorPickerPage
    • SamplesApp.Wasm.Windows_UI_Xaml_Controls.ListView.ListView_IsSelected
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRingPage
    • UITests.Microsoft_UI_Xaml_Controls.ProgressRing.WinUIProgressRing_CustomSources
    • initial_state
    • SamplesApp.Windows_UI_Xaml_Controls.ListView.ListViewSelectedItems
    • MUXControlsTestApp.SwipeControlPage2
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_3gp_Extension
    • UITests.Windows_UI_Xaml_Controls.CalendarView.CalendarView_Theming
    • MUXControlsTestApp.NavigationViewCompactPaneLengthTestPage
    • UITests.Microsoft_UI_Xaml_Controls.NavigationViewTests.NavigationViewBasicPage
    • UITests.Shared.Windows_UI_Xaml_Controls.MediaPlayerElement.MediaPlayerElement_Avi_Extension
  • wasm-automated-net7.0-UWP-Benchmarks: 0 changed over 1

  • wasm-automated-net7.0-UWP-Default: 31 changed over 1937

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • ListView_SelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • DatePicker_Flyout_DatePicker_-_Flyout
    • MediaPlayerElement_Using_mov_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mov_Extension
    • MediaPlayerElement_Using_mp3_Audio_only_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mp3_Extension
    • MediaPlayerElement_Using_ogg_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Ogg_Extension
    • ListView_ListViewSelectedItems_SamplesApp_Windows_UI_Xaml_Controls_ListView_ListViewSelectedItems
    • Default_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected_SamplesApp_Wasm_Windows_UI_Xaml_Controls_ListView_ListView_IsSelected
    • Automation_UITests_Shared_Windows_UI_Xaml_Automation_AutomationProperties_Name_UITests_Shared_Windows_UI_Xaml_Automation_AutomationProperties_Name
    • Default_StrokeThickness_MyPolygon
    • MediaPlayerElement_MediaPlayerElement_Stretch_Fill_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Stretch_Fill
    • MediaPlayerElement_Mini_player_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Minimal
    • MediaPlayerElement_Sources_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Sources
    • MediaPlayerElement_Using_3gp_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_3gp_Extension
    • MediaPlayerElement_Using_avi_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Avi_Extension
    • MediaPlayerElement_Using_flv_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Flv_Extension
    • MediaPlayerElement_Using_mkv_UITests_Shared_Windows_UI_Xaml_Controls_MediaPlayerElement_MediaPlayerElement_Mkv_Extension
    • When_SingleSelectionWithItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • When_SingleSelectionWithoutItemClick_Then_PointersEvents_UITests_Windows_UI_Xaml_Controls_ListView_ListView_Selection_Pointers
    • SequentialAnimations_SamplesApp_Windows_UI_Xaml_Media_Animation_SequentialAnimationsPage
    • Progress_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features_UITests_Microsoft_UI_Xaml_Controls_ProgressRing_WinUIProgressRing_Features
  • wasm-automated-net7.0-UWP-RuntimeTests: 1 changed over 1

    🚨🚨 Comparison Details (first 20) 🚨🚨
    • RunRuntimeTests_SamplesApp_Samples_UnitTests_UnitTestsPage
  • wasm-automated-net7.0-WinUI-RuntimeTests: 0 changed over 1

@MartinZikmund MartinZikmund merged commit 184b680 into master Nov 14, 2023
86 checks passed
@MartinZikmund MartinZikmund deleted the dev/mazi/gtk-hw branch November 14, 2023 12:07
jeromelaban added a commit that referenced this pull request Nov 14, 2023
…5.0/pr-14403

fix: Ensure fractional DPI is avoided in HW GTK renderer (backport #14403)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/skia ✏️ Categorizes an issue or PR as relevant to Skia
Projects
None yet
5 participants