shell/platform/windows/flutter_windows_engine.cc
FlutterRendererConfig GetOpenGLRendererConfig() {
  FlutterRendererConfig config = {};
  config.type = kOpenGL;
  config.open_gl.struct_size = sizeof(config.open_gl);
  config.open_gl.make_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->MakeCurrent();
  };
  config.open_gl.clear_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->ClearContext();
  };
  config.open_gl.present = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->SwapBuffers();
  };
  config.open_gl.fbo_reset_after_present = true;
  config.open_gl.fbo_with_frame_info_callback =
      [](void* user_data, const FlutterFrameInfo* info) -> uint32_t {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (host->view()) {
      return host->view()->GetFrameBufferId(info->size.width,
                                            info->size.height);
    } else {
      return kWindowFrameBufferID;
    }
  };
  config.open_gl.gl_proc_resolver = [](void* user_data,
                                       const char* what) -> void* {
    return reinterpret_cast<void*>(eglGetProcAddress(what));
  };
  config.open_gl.make_resource_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->MakeResourceCurrent();
  };
  config.open_gl.gl_external_texture_frame_callback =
      [](void* user_data, int64_t texture_id, size_t width, size_t height,
         FlutterOpenGLTexture* texture) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->texture_registrar()) {
      return false;
    }
    return host->texture_registrar()->PopulateTexture(texture_id, width, height,
                                                      texture);
  };
  return config;
}
// Creates and returns a FlutterRendererConfig that renders to the view (if any)
// of a FlutterWindowsEngine, using OpenGL (via ANGLE).
// The user_data received by the render callbacks refers to the
// FlutterWindowsEngine.
Creates and returns a FlutterRendererConfig that renders to the view (if any)
of a FlutterWindowsEngine, using OpenGL (via ANGLE).
The user_data received by the render callbacks refers to the
FlutterWindowsEngine.
Creates and returns a FlutterRendererConfig that renders to the view ( if any ) of a FlutterWindowsEngine using OpenGL ( via ANGLE ) . The user_data received by the render callbacks refers to the FlutterWindowsEngine .
FlutterRendererConfig GetOpenGLRendererConfig() {
  FlutterRendererConfig config = {};
  config.type = kOpenGL;
  config.open_gl.struct_size = sizeof(config.open_gl);
  config.open_gl.make_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->MakeCurrent();
  };
  config.open_gl.clear_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->ClearContext();
  };
  config.open_gl.present = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->SwapBuffers();
  };
  config.open_gl.fbo_reset_after_present = true;
  config.open_gl.fbo_with_frame_info_callback =
      [](void* user_data, const FlutterFrameInfo* info) -> uint32_t {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (host->view()) {
      return host->view()->GetFrameBufferId(info->size.width,
                                            info->size.height);
    } else {
      return kWindowFrameBufferID;
    }
  };
  config.open_gl.gl_proc_resolver = [](void* user_data,
                                       const char* what) -> void* {
    return reinterpret_cast<void*>(eglGetProcAddress(what));
  };
  config.open_gl.make_resource_current = [](void* user_data) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->view()) {
      return false;
    }
    return host->view()->MakeResourceCurrent();
  };
  config.open_gl.gl_external_texture_frame_callback =
      [](void* user_data, int64_t texture_id, size_t width, size_t height,
         FlutterOpenGLTexture* texture) -> bool {
    auto host = static_cast<FlutterWindowsEngine*>(user_data);
    if (!host->texture_registrar()) {
      return false;
    }
    return host->texture_registrar()->PopulateTexture(texture_id, width, height,
                                                      texture);
  };
  return config;
}
FlutterRendererConfig GetOpenGLRendererConfig ( ) { FlutterRendererConfig config = { } ; config . type = kOpenGL ; config . open_gl . struct_size = sizeof ( config . open_gl ) ; config . open_gl . make_current = [ ] ( void * user_data ) -> bool { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( ! host -> view ( ) ) { return false ; } return host -> view ( ) -> MakeCurrent ( ) ; } ; config . open_gl . clear_current = [ ] ( void * user_data ) -> bool { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( ! host -> view ( ) ) { return false ; } return host -> view ( ) -> ClearContext ( ) ; } ; config . open_gl . present = [ ] ( void * user_data ) -> bool { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( ! host -> view ( ) ) { return false ; } return host -> view ( ) -> SwapBuffers ( ) ; } ; config . open_gl . fbo_reset_after_present = true ; config . open_gl . fbo_with_frame_info_callback = [ ] ( void * user_data , const FlutterFrameInfo * info ) -> uint32_t { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( host -> view ( ) ) { return host -> view ( ) -> GetFrameBufferId ( info -> size . width , info -> size . height ) ; } else { return kWindowFrameBufferID ; } } ; config . open_gl . gl_proc_resolver = [ ] ( void * user_data , const char * what ) -> void * { return reinterpret_cast < void * > ( eglGetProcAddress ( what ) ) ; } ; config . open_gl . make_resource_current = [ ] ( void * user_data ) -> bool { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( ! host -> view ( ) ) { return false ; } return host -> view ( ) -> MakeResourceCurrent ( ) ; } ; config . open_gl . gl_external_texture_frame_callback = [ ] ( void * user_data , int64_t texture_id , size_t width , size_t height , FlutterOpenGLTexture * texture ) -> bool { auto host = static_cast < FlutterWindowsEngine * > ( user_data ) ; if ( ! host -> texture_registrar ( ) ) { return false ; } return host -> texture_registrar ( ) -> PopulateTexture ( texture_id , width , height , texture ) ; } ; return config ; }
Creates and returns a FlutterRendererConfig that renders to the view (if any)
of a FlutterWindowsEngine, using OpenGL (via ANGLE).
Creates and returns a FlutterRendererConfig that renders to the view ( if any ) of a FlutterWindowsEngine using OpenGL ( via ANGLE ) .