mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
add android graphic surface layer using EGL extensions
This commit is contained in:
parent
a90d12eaee
commit
8d85f71573
4 changed files with 44 additions and 2 deletions
|
@ -171,6 +171,7 @@ endif
|
|||
|
||||
ifeq ($(CFG_OSTYPE),linux-androideabi)
|
||||
DEPS_rust-azure += \
|
||||
rust-egl \
|
||||
rust-freetype \
|
||||
rust-fontconfig \
|
||||
fontconfig \
|
||||
|
@ -181,6 +182,7 @@ DEPS_rust-azure += \
|
|||
|
||||
# See note at top of file
|
||||
DEPS_rust-layers += \
|
||||
rust-egl \
|
||||
rust-freetype \
|
||||
rust-fontconfig \
|
||||
rust-xlib \
|
||||
|
|
|
@ -11,7 +11,9 @@ use geom::size::Size2D;
|
|||
use gfx::render_task::{ReRenderMsg, UnusedBufferMsg};
|
||||
use layers::layers::{ContainerLayerKind, ContainerLayer, Flip, NoFlip, TextureLayer};
|
||||
use layers::layers::TextureLayerKind;
|
||||
#[cfg(target_os="macos")] use layers::layers::VerticalFlip;
|
||||
#[cfg(target_os="macos")]
|
||||
#[cfg(target_os="android")]
|
||||
use layers::layers::VerticalFlip;
|
||||
use layers::platform::surface::{NativeCompositingGraphicsContext, NativeSurfaceMethods};
|
||||
use layers::texturegl::{Texture, TextureTarget};
|
||||
#[cfg(target_os="macos")] use layers::texturegl::TextureTargetRectangle;
|
||||
|
@ -424,7 +426,18 @@ impl CompositorLayer {
|
|||
(flip, TextureTargetRectangle(size))
|
||||
}
|
||||
|
||||
#[cfg(not(target_os="macos"))]
|
||||
#[cfg(target_os="android")]
|
||||
fn texture_flip_and_target(cpu_painting: bool, size: Size2D<uint>) -> (Flip, TextureTarget) {
|
||||
let flip = if cpu_painting {
|
||||
NoFlip
|
||||
} else {
|
||||
VerticalFlip
|
||||
};
|
||||
|
||||
(flip, TextureTarget2D)
|
||||
}
|
||||
|
||||
#[cfg(target_os="linux")]
|
||||
fn texture_flip_and_target(_: bool, _: Size2D<uint>) -> (Flip, TextureTarget) {
|
||||
(NoFlip, TextureTarget2D)
|
||||
}
|
||||
|
|
|
@ -35,6 +35,13 @@ pub mod platform {
|
|||
pub mod surface;
|
||||
}
|
||||
|
||||
#[cfg(target_os="android")]
|
||||
pub mod android {
|
||||
#[cfg(target_os="android")]
|
||||
pub mod surface;
|
||||
}
|
||||
|
||||
|
||||
pub mod surface;
|
||||
}
|
||||
|
||||
|
|
20
src/components/msg/platform/android/surface.rs
Normal file
20
src/components/msg/platform/android/surface.rs
Normal file
|
@ -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::cast;
|
||||
|
||||
impl NativeSurfaceAzureMethods for NativeSurface {
|
||||
fn from_azure_surface(surface: AzSkiaGrGLSharedSurfaceRef) -> NativeSurface {
|
||||
unsafe {
|
||||
NativeSurface::from_image_khr(cast::transmute(surface))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue