mirror of
https://github.com/servo/servo.git
synced 2025-09-30 00:29:14 +01:00
feat: Turn RenderingContext
into a trait (#35052)
* feat: turn RenderingContext into a trait Signed-off-by: DK Liao <dklassic@gmail.com> Add comment and handle drop error Signed-off-by: DK Liao <dklassic@gmail.com> Add doc comment Signed-off-by: DK Liao <dklassic@gmail.com> Allow make_current to propagate Error Signed-off-by: DK Liao <dklassic@gmail.com> Fix all make_current occurances Signed-off-by: DK Liao <dklassic@gmail.com> Move back to Rc<dyn RenderingContext> Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos Signed-off-by: DK Liao <dklassic@gmail.com> Fix build Signed-off-by: DK Liao <dklassic@gmail.com> fix android/ohos again Signed-off-by: DK Liao <dklassic@gmail.com> * Fix macOS smoke test Signed-off-by: DK Liao <dklassic@gmail.com> * Add comment for create_texture and destroy_texture Signed-off-by: DK Liao <dklassic@gmail.com> * Improve comments written Signed-off-by: DK Liao <dklassic@gmail.com> --------- Signed-off-by: DK Liao <dklassic@gmail.com>
This commit is contained in:
parent
ac22157491
commit
a0eceee2ed
14 changed files with 236 additions and 112 deletions
|
@ -20,7 +20,7 @@ use servo::config::prefs::Preferences;
|
|||
use servo::embedder_traits::EventLoopWaker;
|
||||
use servo::servo_config::pref;
|
||||
use servo::url::ServoUrl;
|
||||
use servo::webrender_traits::RenderingContext;
|
||||
use servo::webrender_traits::SurfmanRenderingContext;
|
||||
use servo::Servo;
|
||||
use surfman::Connection;
|
||||
use webxr::glwindow::GlWindowDiscovery;
|
||||
|
@ -113,7 +113,7 @@ impl App {
|
|||
let adapter = connection
|
||||
.create_software_adapter()
|
||||
.expect("Failed to create adapter");
|
||||
RenderingContext::create(
|
||||
SurfmanRenderingContext::create(
|
||||
&connection,
|
||||
&adapter,
|
||||
Some(self.opts.initial_window_size.to_untyped().to_i32()),
|
||||
|
@ -129,7 +129,7 @@ impl App {
|
|||
let adapter = connection
|
||||
.create_adapter()
|
||||
.expect("Failed to create adapter");
|
||||
RenderingContext::create(&connection, &adapter, None)
|
||||
SurfmanRenderingContext::create(&connection, &adapter, None)
|
||||
.expect("Failed to create WR surfman")
|
||||
};
|
||||
|
||||
|
@ -206,7 +206,7 @@ impl App {
|
|||
let mut servo = Servo::new(
|
||||
self.opts.clone(),
|
||||
self.preferences.clone(),
|
||||
rendering_context,
|
||||
Rc::new(rendering_context),
|
||||
embedder,
|
||||
window.clone(),
|
||||
self.servo_shell_preferences.user_agent.clone(),
|
||||
|
|
|
@ -22,7 +22,7 @@ use servo::servo_config::pref;
|
|||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::webrender_api::units::{DeviceIntPoint, DeviceIntRect, DeviceIntSize, DevicePixel};
|
||||
use servo::webrender_api::ScrollLocation;
|
||||
use servo::webrender_traits::RenderingContext;
|
||||
use servo::webrender_traits::SurfmanRenderingContext;
|
||||
use surfman::{Context, Device, SurfaceType};
|
||||
use winit::dpi::{LogicalSize, PhysicalPosition, PhysicalSize};
|
||||
use winit::event::{ElementState, KeyEvent, MouseButton, MouseScrollDelta, TouchPhase};
|
||||
|
@ -59,7 +59,7 @@ pub struct Window {
|
|||
impl Window {
|
||||
pub fn new(
|
||||
opts: &Opts,
|
||||
rendering_context: &RenderingContext,
|
||||
rendering_context: &SurfmanRenderingContext,
|
||||
window_size: Size2D<u32, DeviceIndependentPixel>,
|
||||
event_loop: &ActiveEventLoop,
|
||||
no_native_titlebar: bool,
|
||||
|
|
|
@ -25,7 +25,7 @@ use servo::script_traits::TraversalDirection;
|
|||
use servo::servo_geometry::DeviceIndependentPixel;
|
||||
use servo::servo_url::ServoUrl;
|
||||
use servo::webrender_api::units::DevicePixel;
|
||||
use servo::webrender_traits::RenderingContext;
|
||||
use servo::webrender_traits::SurfmanRenderingContext;
|
||||
use servo::TopLevelBrowsingContextId;
|
||||
use winit::event::{ElementState, MouseButton, WindowEvent};
|
||||
use winit::event_loop::ActiveEventLoop;
|
||||
|
@ -79,7 +79,7 @@ fn truncate_with_ellipsis(input: &str, max_length: usize) -> String {
|
|||
|
||||
impl Minibrowser {
|
||||
pub fn new(
|
||||
rendering_context: &RenderingContext,
|
||||
rendering_context: &SurfmanRenderingContext,
|
||||
event_loop: &ActiveEventLoop,
|
||||
initial_url: ServoUrl,
|
||||
) -> Self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue