shell/platform/glfw/flutter_glfw.cc
// When GLFW calls back to the window with a framebuffer size change, notify
// FlutterEngine about the new window metrics.
// The Flutter pixel_ratio is defined as DPI/dp.
When GLFW calls back to the window with a framebuffer size change, notify
FlutterEngine about the new window metrics.
The Flutter pixel_ratio is defined as DPI/dp.
When GLFW calls back to the window with a framebuffer size change notify FlutterEngine about the new window metrics . The Flutter pixel_ratio is defined as DPI / dp .
static void GLFWFramebufferSizeCallback(GLFWwindow* window,
                                        int width_px,
                                        int height_px) {
  int width;
  glfwGetWindowSize(window, &width, nullptr);
  auto state = GetSavedWindowState(window);
  state->window_pixels_per_screen_coordinate = width_px / width;
  double dpi = state->window_pixels_per_screen_coordinate *
               state->monitor_screen_coordinates_per_inch;
  double pixel_ratio = std::max(dpi / kDpPerInch, 1.0);
  FlutterWindowMetricsEvent event = {};
  event.struct_size = sizeof(event);
  event.width = width_px;
  event.height = height_px;
  event.pixel_ratio = pixel_ratio;
  FlutterEngineSendWindowMetricsEvent(state->engine, &event);
}
static void GLFWFramebufferSizeCallback ( GLFWwindow * window , int width_px , int height_px ) { int width ; glfwGetWindowSize ( window , & width , nullptr ) ; auto state = GetSavedWindowState ( window ) ; state -> window_pixels_per_screen_coordinate = width_px / width ; double dpi = state -> window_pixels_per_screen_coordinate * state -> monitor_screen_coordinates_per_inch ; double pixel_ratio = std :: max ( dpi / kDpPerInch , 1.0 ) ; FlutterWindowMetricsEvent event = { } ; event . struct_size = sizeof ( event ) ; event . width = width_px ; event . height = height_px ; event . pixel_ratio = pixel_ratio ; FlutterEngineSendWindowMetricsEvent ( state -> engine , & event ) ; }
When GLFW calls back to the window with a framebuffer size change, notify
FlutterEngine about the new window metrics.
When GLFW calls back to the window with a framebuffer size change notify FlutterEngine about the new window metrics .
// Limit the ratio to 1 to avoid rendering a smaller UI in standard resolution // monitors.