aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/msg/platform/macos/surface.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-10-25 14:52:53 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-10-25 16:58:30 -0700
commit3d0bfa50407d820435cbf8ae127d567816f0a8eb (patch)
treebe96d1f487dc93d09139189bd332af9261158e27 /src/components/msg/platform/macos/surface.rs
parentd5bd4bfdb71415fc399b986359ba6ad0ff3ac3de (diff)
downloadservo-3d0bfa50407d820435cbf8ae127d567816f0a8eb.tar.gz
servo-3d0bfa50407d820435cbf8ae127d567816f0a8eb.zip
Implement CPU rendering. Replace texture sharing with native OS surface sharing.
Diffstat (limited to 'src/components/msg/platform/macos/surface.rs')
-rw-r--r--src/components/msg/platform/macos/surface.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/components/msg/platform/macos/surface.rs b/src/components/msg/platform/macos/surface.rs
new file mode 100644
index 00000000000..3bf5f9b5ab7
--- /dev/null
+++ b/src/components/msg/platform/macos/surface.rs
@@ -0,0 +1,26 @@
+/* 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 core_foundation::base::CFWrapper;
+use io_surface::IOSurface;
+use layers::platform::surface::NativeSurface;
+use std::cast;
+
+impl NativeSurfaceAzureMethods for NativeSurface {
+ fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
+ unsafe {
+ let io_surface = IOSurface {
+ contents: CFWrapper::wrap_owned(cast::transmute(surface)),
+ };
+ NativeSurface::from_io_surface(io_surface)
+ }
+ }
+}
+