aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-01-16 12:57:44 -0700
committerbors-servo <metajack+bors@gmail.com>2015-01-16 12:57:44 -0700
commitefae66bccb116ddf41857436718ef1556243a3f2 (patch)
tree71164ad17115fb9a9d2e280d168cee8519b69fff
parentc70197b48d64a3228c6d0cffafa1671a843fcc9d (diff)
parentc3d23a063080ff7446af904e32ac6b661a4cd653 (diff)
downloadservo-efae66bccb116ddf41857436718ef1556243a3f2.tar.gz
servo-efae66bccb116ddf41857436718ef1556243a3f2.zip
auto merge of #4625 : mrobinson/servo/surface-refactor, r=jdm
We no longer need to implement from_azure_surface in Servo, now that rust-layers is handling more of the glue between rust-layers and Azure.
-rw-r--r--components/compositing/compositor_layer.rs1
-rw-r--r--components/gfx/paint_task.rs22
-rw-r--r--components/msg/lib.rs24
-rw-r--r--components/msg/platform/android/surface.rs20
-rw-r--r--components/msg/platform/linux/surface.rs20
-rw-r--r--components/msg/platform/macos/surface.rs25
-rw-r--r--components/msg/platform/surface.rs12
-rw-r--r--components/servo/Cargo.lock6
-rw-r--r--ports/cef/Cargo.lock6
-rw-r--r--ports/gonk/Cargo.lock6
10 files changed, 20 insertions, 122 deletions
diff --git a/components/compositing/compositor_layer.rs b/components/compositing/compositor_layer.rs
index 9afb50cb005..1510ea51fb4 100644
--- a/components/compositing/compositor_layer.rs
+++ b/components/compositing/compositor_layer.rs
@@ -16,7 +16,6 @@ use gfx::paint_task::Msg as PaintMsg;
use layers::color::Color;
use layers::geometry::LayerPixel;
use layers::layers::{Layer, LayerBufferSet};
-use layers::platform::surface::NativeSurfaceMethods;
use script_traits::CompositorEvent::{ClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent};
use script_traits::{ScriptControlChan, ConstellationControlMsg};
use servo_msg::compositor_msg::{Epoch, LayerId, ScrollPolicy};
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index 5d65739fc28..efb1182a795 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -11,13 +11,13 @@ use font_context::FontContext;
use paint_context::PaintContext;
use azure::azure_hl::{SurfaceFormat, Color, DrawTarget, BackendType, StolenGLResources};
-use azure::AzFloat;
+use azure::{AzFloat, AzGLNativeContextRef};
use geom::matrix2d::Matrix2D;
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
use layers::platform::surface::{NativeGraphicsMetadata, NativePaintingGraphicsContext};
-use layers::platform::surface::{NativeSurface, NativeSurfaceMethods};
+use layers::platform::surface::NativeSurface;
use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers;
use servo_msg::compositor_msg::{Epoch, PaintState, LayerId};
@@ -25,7 +25,6 @@ use servo_msg::compositor_msg::{LayerMetadata, PaintListener, ScrollPolicy};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use servo_msg::constellation_msg::PipelineExitType;
-use servo_msg::platform::surface::NativeSurfaceAzureMethods;
use servo_util::geometry::{Au, ZERO_POINT};
use servo_util::opts;
use servo_util::smallvec::SmallVec;
@@ -315,10 +314,9 @@ impl<C> PaintTask<C> where C: PaintListener + Send {
// Create an empty native surface. We mark it as not leaking
// in case it dies in transit to the compositor task.
let mut native_surface: NativeSurface =
- layers::platform::surface::NativeSurfaceMethods::new(native_graphics_context!(self),
- Size2D(width as i32,
- height as i32),
- width as i32 * 4);
+ layers::platform::surface::NativeSurface::new(native_graphics_context!(self),
+ Size2D(width as i32, height as i32),
+ width as i32 * 4);
native_surface.mark_wont_leak();
Some(box LayerBuffer {
@@ -520,10 +518,13 @@ impl WorkerThread {
} else {
// FIXME(pcwalton): Cache the components of draw targets (texture color buffer,
// paintbuffers) instead of recreating them.
+ let native_graphics_context =
+ native_graphics_context!(self) as *const _ as AzGLNativeContextRef;
let draw_target = DrawTarget::new_with_fbo(BackendType::Skia,
- native_graphics_context!(self),
+ native_graphics_context,
size,
SurfaceFormat::B8G8R8A8);
+
draw_target.make_current();
draw_target
};
@@ -592,13 +593,12 @@ impl WorkerThread {
// GPU painting path:
draw_target.make_current();
let StolenGLResources {
- surface: native_surface
+ surface: azure_surface
} = draw_target.steal_gl_resources().unwrap();
// We mark the native surface as not leaking in case the surfaces
// die on their way to the compositor task.
- let mut native_surface: NativeSurface =
- NativeSurfaceAzureMethods::from_azure_surface(native_surface);
+ let mut native_surface: NativeSurface = NativeSurface::from_azure_surface(azure_surface);
native_surface.mark_wont_leak();
box LayerBuffer {
diff --git a/components/msg/lib.rs b/components/msg/lib.rs
index 5ace3bd90e8..234fba05361 100644
--- a/components/msg/lib.rs
+++ b/components/msg/lib.rs
@@ -21,27 +21,3 @@ extern crate io_surface;
pub mod compositor_msg;
pub mod constellation_msg;
-
-pub mod platform {
- #[cfg(target_os="macos")]
- pub mod macos {
- #[cfg(target_os="macos")]
- pub mod surface;
- }
-
- #[cfg(target_os="linux")]
- pub mod linux {
- #[cfg(target_os="linux")]
- pub mod surface;
- }
-
- #[cfg(target_os="android")]
- pub mod android {
- #[cfg(target_os="android")]
- pub mod surface;
- }
-
-
- pub mod surface;
-}
-
diff --git a/components/msg/platform/android/surface.rs b/components/msg/platform/android/surface.rs
deleted file mode 100644
index 6f2e962d804..00000000000
--- a/components/msg/platform/android/surface.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! EGL-specific implementation of cross-process surfaces. This uses EGL surfaces.
-
-use platform::surface::NativeSurfaceAzureMethods;
-
-use azure::AzSkiaGrGLSharedSurfaceRef;
-use layers::platform::surface::NativeSurface;
-use std::mem;
-
-impl NativeSurfaceAzureMethods for NativeSurface {
- fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
- unsafe {
- NativeSurface::from_image_khr(mem::transmute(surface))
- }
- }
-}
-
diff --git a/components/msg/platform/linux/surface.rs b/components/msg/platform/linux/surface.rs
deleted file mode 100644
index 60cc84bc965..00000000000
--- a/components/msg/platform/linux/surface.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! X11-specific implementation of cross-process surfaces. This uses X pixmaps.
-
-use platform::surface::NativeSurfaceAzureMethods;
-
-use azure::AzSkiaGrGLSharedSurfaceRef;
-use layers::platform::surface::NativeSurface;
-use std::mem;
-
-impl NativeSurfaceAzureMethods for NativeSurface {
- fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
- unsafe {
- NativeSurface::from_pixmap(mem::transmute(surface))
- }
- }
-}
-
diff --git a/components/msg/platform/macos/surface.rs b/components/msg/platform/macos/surface.rs
deleted file mode 100644
index 30b5e405500..00000000000
--- a/components/msg/platform/macos/surface.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! Mac OS-specific implementation of cross-process surfaces. This uses `IOSurface`, introduced
-//! in Mac OS X 10.6 Snow Leopard.
-
-use platform::surface::NativeSurfaceAzureMethods;
-
-use azure::AzSkiaGrGLSharedSurfaceRef;
-use io_surface::IOSurface;
-use layers::platform::surface::NativeSurface;
-use std::mem;
-
-impl NativeSurfaceAzureMethods for NativeSurface {
- fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
- unsafe {
- let io_surface = IOSurface {
- obj: mem::transmute(surface),
- };
- NativeSurface::from_io_surface(io_surface)
- }
- }
-}
-
diff --git a/components/msg/platform/surface.rs b/components/msg/platform/surface.rs
deleted file mode 100644
index eee8dfa5598..00000000000
--- a/components/msg/platform/surface.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-//! Declarations of types for cross-process surfaces.
-
-use azure::AzSkiaGrGLSharedSurfaceRef;
-
-pub trait NativeSurfaceAzureMethods {
- fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> Self;
-}
-
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 7cb2cb25e83..8d302666dd8 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -26,7 +26,7 @@ dependencies = [
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#f4a02f3f621b0a994a20d42e438371a87c62f898"
+source = "git+https://github.com/servo/rust-azure#d0acabef6221e5fd6840254dc23f91c66b874629"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -34,7 +34,6 @@ dependencies = [
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
- "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"skia-sys 0.0.20130412 (git+https://github.com/servo/skia?ref=upstream-2014-06-16)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)",
]
@@ -432,8 +431,9 @@ source = "git+https://github.com/bjz/gl-rs.git#b5e3f4f76c31bc1b459d5e4c10d879ffa
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#574df7e1c1dd464af930d1cc735ca8d6af46bb90"
+source = "git+https://github.com/servo/rust-layers#f20270839f8658a2b19eae6fade9325efe5f4578"
dependencies = [
+ "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index e19dcfe7ea8..56759acaba8 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -27,7 +27,7 @@ dependencies = [
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#f4a02f3f621b0a994a20d42e438371a87c62f898"
+source = "git+https://github.com/servo/rust-azure#d0acabef6221e5fd6840254dc23f91c66b874629"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -35,7 +35,6 @@ dependencies = [
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
- "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"skia-sys 0.0.20130412 (git+https://github.com/servo/skia?ref=upstream-2014-06-16)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)",
]
@@ -400,8 +399,9 @@ source = "git+https://github.com/bjz/gl-rs.git#b5e3f4f76c31bc1b459d5e4c10d879ffa
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#574df7e1c1dd464af930d1cc735ca8d6af46bb90"
+source = "git+https://github.com/servo/rust-layers#f20270839f8658a2b19eae6fade9325efe5f4578"
dependencies = [
+ "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 49e777aed2a..2afc1110cc0 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -15,7 +15,7 @@ dependencies = [
[[package]]
name = "azure"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-azure#f4a02f3f621b0a994a20d42e438371a87c62f898"
+source = "git+https://github.com/servo/rust-azure#d0acabef6221e5fd6840254dc23f91c66b874629"
dependencies = [
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics)",
@@ -23,7 +23,6 @@ dependencies = [
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"geom 0.1.0 (git+https://github.com/servo/rust-geom)",
- "layers 0.1.0 (git+https://github.com/servo/rust-layers)",
"skia-sys 0.0.20130412 (git+https://github.com/servo/skia?ref=upstream-2014-06-16)",
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib)",
]
@@ -354,8 +353,9 @@ source = "git+https://github.com/bjz/gl-rs.git#b5e3f4f76c31bc1b459d5e4c10d879ffa
[[package]]
name = "layers"
version = "0.1.0"
-source = "git+https://github.com/servo/rust-layers#574df7e1c1dd464af930d1cc735ca8d6af46bb90"
+source = "git+https://github.com/servo/rust-layers#f20270839f8658a2b19eae6fade9325efe5f4578"
dependencies = [
+ "azure 0.1.0 (git+https://github.com/servo/rust-azure)",
"cgl 0.0.1 (git+https://github.com/servo/rust-cgl)",
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)",
"egl 0.1.0 (git+https://github.com/servo/rust-egl)",