diff options
Diffstat (limited to 'components/msg/platform')
-rw-r--r-- | components/msg/platform/android/surface.rs | 20 | ||||
-rw-r--r-- | components/msg/platform/linux/surface.rs | 20 | ||||
-rw-r--r-- | components/msg/platform/macos/surface.rs | 25 | ||||
-rw-r--r-- | components/msg/platform/surface.rs | 12 |
4 files changed, 77 insertions, 0 deletions
diff --git a/components/msg/platform/android/surface.rs b/components/msg/platform/android/surface.rs new file mode 100644 index 00000000000..6f2e962d804 --- /dev/null +++ b/components/msg/platform/android/surface.rs @@ -0,0 +1,20 @@ +/* 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 new file mode 100644 index 00000000000..60cc84bc965 --- /dev/null +++ b/components/msg/platform/linux/surface.rs @@ -0,0 +1,20 @@ +/* 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 new file mode 100644 index 00000000000..30b5e405500 --- /dev/null +++ b/components/msg/platform/macos/surface.rs @@ -0,0 +1,25 @@ +/* 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 new file mode 100644 index 00000000000..eee8dfa5598 --- /dev/null +++ b/components/msg/platform/surface.rs @@ -0,0 +1,12 @@ +/* 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; +} + |