mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Update euclid, azure, skia, offscreen_gl_context, plane-split, webrender
This commit is contained in:
parent
76270ad6c1
commit
e17697fb0e
47 changed files with 196 additions and 211 deletions
|
@ -10,7 +10,7 @@ name = "compositing"
|
|||
path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
euclid = "0.15"
|
||||
euclid = "0.16"
|
||||
gfx_traits = {path = "../gfx_traits"}
|
||||
gleam = "0.4"
|
||||
image = "0.17"
|
||||
|
|
|
@ -6,7 +6,7 @@ use CompositionPipeline;
|
|||
use SendableFrameTree;
|
||||
use compositor_thread::{CompositorProxy, CompositorReceiver};
|
||||
use compositor_thread::{InitialCompositorState, Msg};
|
||||
use euclid::{TypedPoint2D, TypedVector2D, ScaleFactor};
|
||||
use euclid::{TypedPoint2D, TypedVector2D, TypedScale};
|
||||
use gfx_traits::Epoch;
|
||||
use gleam::gl;
|
||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
|
@ -108,7 +108,7 @@ pub struct IOCompositor<Window: WindowMethods> {
|
|||
pipeline_details: HashMap<PipelineId, PipelineDetails>,
|
||||
|
||||
/// The scene scale, to allow for zooming and high-resolution painting.
|
||||
scale: ScaleFactor<f32, LayerPixel, DevicePixel>,
|
||||
scale: TypedScale<f32, LayerPixel, DevicePixel>,
|
||||
|
||||
/// The size of the rendering area.
|
||||
frame_size: DeviceUintSize,
|
||||
|
@ -124,10 +124,10 @@ pub struct IOCompositor<Window: WindowMethods> {
|
|||
max_viewport_zoom: Option<PinchZoomFactor>,
|
||||
|
||||
/// "Desktop-style" zoom that resizes the viewport to fit the window.
|
||||
page_zoom: ScaleFactor<f32, CSSPixel, DeviceIndependentPixel>,
|
||||
page_zoom: TypedScale<f32, CSSPixel, DeviceIndependentPixel>,
|
||||
|
||||
/// The device pixel ratio for this window.
|
||||
scale_factor: ScaleFactor<f32, DeviceIndependentPixel, DevicePixel>,
|
||||
scale_factor: TypedScale<f32, DeviceIndependentPixel, DevicePixel>,
|
||||
|
||||
/// The type of composition to perform
|
||||
composite_target: CompositeTarget,
|
||||
|
@ -366,7 +366,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
pipeline_details: HashMap::new(),
|
||||
frame_size: frame_size,
|
||||
window_rect: window_rect,
|
||||
scale: ScaleFactor::new(1.0),
|
||||
scale: TypedScale::new(1.0),
|
||||
scale_factor: scale_factor,
|
||||
composition_request: CompositionRequest::NoCompositingNecessary,
|
||||
touch_handler: TouchHandler::new(),
|
||||
|
@ -374,7 +374,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
waiting_for_results_of_scroll: false,
|
||||
composite_target: composite_target,
|
||||
shutdown_state: ShutdownState::NotShuttingDown,
|
||||
page_zoom: ScaleFactor::new(1.0),
|
||||
page_zoom: TypedScale::new(1.0),
|
||||
viewport_zoom: PinchZoomFactor::new(1.0),
|
||||
min_viewport_zoom: None,
|
||||
max_viewport_zoom: None,
|
||||
|
@ -1016,10 +1016,10 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
// deltas instead of summing them.
|
||||
if let ScrollLocation::Delta(delta) = last_combined_event.scroll_location {
|
||||
let old_event_count =
|
||||
ScaleFactor::new(last_combined_event.event_count as f32);
|
||||
TypedScale::new(last_combined_event.event_count as f32);
|
||||
last_combined_event.event_count += 1;
|
||||
let new_event_count =
|
||||
ScaleFactor::new(last_combined_event.event_count as f32);
|
||||
TypedScale::new(last_combined_event.event_count as f32);
|
||||
last_combined_event.scroll_location = ScrollLocation::Delta(
|
||||
(delta * old_event_count + this_delta) /
|
||||
new_event_count);
|
||||
|
@ -1110,34 +1110,34 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
}
|
||||
}
|
||||
|
||||
fn hidpi_factor(&self) -> ScaleFactor<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> {
|
||||
match opts::get().device_pixels_per_px {
|
||||
Some(device_pixels_per_px) => ScaleFactor::new(device_pixels_per_px),
|
||||
Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px),
|
||||
None => match opts::get().output_file {
|
||||
Some(_) => ScaleFactor::new(1.0),
|
||||
Some(_) => TypedScale::new(1.0),
|
||||
None => self.scale_factor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn device_pixels_per_page_px(&self) -> ScaleFactor<f32, CSSPixel, DevicePixel> {
|
||||
fn device_pixels_per_page_px(&self) -> TypedScale<f32, CSSPixel, DevicePixel> {
|
||||
self.page_zoom * self.hidpi_factor()
|
||||
}
|
||||
|
||||
fn update_zoom_transform(&mut self) {
|
||||
let scale = self.device_pixels_per_page_px();
|
||||
self.scale = ScaleFactor::new(scale.get());
|
||||
self.scale = TypedScale::new(scale.get());
|
||||
}
|
||||
|
||||
pub fn on_zoom_reset_window_event(&mut self) {
|
||||
self.page_zoom = ScaleFactor::new(1.0);
|
||||
self.page_zoom = TypedScale::new(1.0);
|
||||
self.update_zoom_transform();
|
||||
self.send_window_size(WindowSizeType::Resize);
|
||||
self.update_page_zoom_for_webrender();
|
||||
}
|
||||
|
||||
pub fn on_zoom_window_event(&mut self, magnification: f32) {
|
||||
self.page_zoom = ScaleFactor::new((self.page_zoom.get() * magnification)
|
||||
self.page_zoom = TypedScale::new((self.page_zoom.get() * magnification)
|
||||
.max(MIN_ZOOM).min(MAX_ZOOM));
|
||||
self.update_zoom_transform();
|
||||
self.send_window_size(WindowSizeType::Resize);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use euclid::{TypedPoint2D, TypedVector2D};
|
||||
use euclid::ScaleFactor;
|
||||
use euclid::TypedScale;
|
||||
use script_traits::{EventResult, TouchId};
|
||||
use self::TouchState::*;
|
||||
use style_traits::DevicePixel;
|
||||
|
@ -124,7 +124,7 @@ impl TouchHandler {
|
|||
let (d1, c1) = self.pinch_distance_and_center();
|
||||
|
||||
let magnification = d1 / d0;
|
||||
let scroll_delta = c1 - c0 * ScaleFactor::new(magnification);
|
||||
let scroll_delta = c1 - c0 * TypedScale::new(magnification);
|
||||
|
||||
TouchAction::Zoom(magnification, scroll_delta)
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use compositor_thread::EventLoopWaker;
|
||||
use euclid::{Point2D, Size2D};
|
||||
use euclid::{ScaleFactor, TypedPoint2D, TypedSize2D};
|
||||
use euclid::{TypedScale, TypedPoint2D, TypedSize2D};
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, TopLevelBrowsingContextId, TraversalDirection};
|
||||
|
@ -162,7 +162,7 @@ pub trait WindowMethods {
|
|||
fn history_changed(&self, ctx: TopLevelBrowsingContextId, Vec<LoadData>, usize);
|
||||
|
||||
/// Returns the scale factor of the system (device pixels / device independent pixels).
|
||||
fn hidpi_factor(&self) -> ScaleFactor<f32, DeviceIndependentPixel, DevicePixel>;
|
||||
fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel>;
|
||||
|
||||
/// Returns a thread-safe object to wake up the window's event loop.
|
||||
fn create_event_loop_waker(&self) -> Box<EventLoopWaker>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue