From fd9e219715d4286972742c93d68d79c9b8644914 Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 10 Apr 2014 22:42:58 +0200 Subject: [PATCH 1/2] Update to current rust: use the new attributes syntax. --- lib.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib.rs b/lib.rs index 0200e5d..66cd847 100755 --- a/lib.rs +++ b/lib.rs @@ -7,17 +7,16 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[crate_id = "github.com/mozilla-servo/rust-layers#layers:0.1"]; -#[crate_type = "lib"]; -#[crate_type = "dylib"]; -#[crate_type = "rlib"]; +#![crate_id = "github.com/mozilla-servo/rust-layers#layers:0.1"] +#![crate_type = "lib"] +#![crate_type = "dylib"] +#![crate_type = "rlib"] -#[feature(managed_boxes)]; - -#[feature(phase)]; -#[phase(syntax, link)] extern crate log; +#![feature(managed_boxes, phase)] extern crate geom; +#[phase(syntax, link)] +extern crate log; extern crate opengles; extern crate std; extern crate serialize; From 3bf9725927711ec4b38528295f1d5f024f63a85e Mon Sep 17 00:00:00 2001 From: Ms2ger Date: Thu, 10 Apr 2014 22:43:17 +0200 Subject: [PATCH 2/2] Update to current rust: libc is in its own crate. --- lib.rs | 1 + platform/android/surface.rs | 2 +- platform/linux/surface.rs | 2 +- rendergl.rs | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib.rs b/lib.rs index 66cd847..b0bcef1 100755 --- a/lib.rs +++ b/lib.rs @@ -15,6 +15,7 @@ #![feature(managed_boxes, phase)] extern crate geom; +extern crate libc; #[phase(syntax, link)] extern crate log; extern crate opengles; diff --git a/platform/android/surface.rs b/platform/android/surface.rs index 67fdbef..6c6b467 100644 --- a/platform/android/surface.rs +++ b/platform/android/surface.rs @@ -16,11 +16,11 @@ use geom::size::Size2D; use opengles::gl2::{egl_image_target_texture2d_oes, TEXTURE_2D, glTexImage2D, BGRA, UNSIGNED_BYTE}; use egl::egl::EGLDisplay; use egl::eglext::{EGLImageKHR, DestroyImageKHR}; +use libc::c_void; use std::cast; use std::mem; use std::ptr; use std::slice; -use std::libc::c_void; /// FIXME(Aydin Kim) :Currently, native surface is consist of 2 types of hybrid image buffer. EGLImageKHR is used to GPU rendering and vector is used to CPU rendering. EGL extension seems not provide simple way to accessing its bitmap directly. In the future, we need to find out the way to integrate them. diff --git a/platform/linux/surface.rs b/platform/linux/surface.rs index 63c907a..8a0f7de 100644 --- a/platform/linux/surface.rs +++ b/platform/linux/surface.rs @@ -13,6 +13,7 @@ use platform::surface::NativeSurfaceMethods; use texturegl::Texture; use geom::size::Size2D; +use libc::{c_int, c_uint, c_void}; use opengles::glx::{GLXFBConfig, GLXDrawable}; use opengles::glx::{GLX_BIND_TO_TEXTURE_RGBA_EXT}; use opengles::glx::{GLX_DRAWABLE_TYPE, GLX_FRONT_EXT, GLX_PIXMAP_BIT}; @@ -25,7 +26,6 @@ use opengles::gl2::NO_ERROR; use opengles::gl2; use std::cast; use std::c_str::CString; -use std::libc::{c_int, c_uint, c_void}; use std::ptr; use xlib::xlib::{Display, Pixmap, XCreateGC, XCreateImage, XCreatePixmap, XDefaultScreen}; use xlib::xlib::{XDisplayString, XFreePixmap, XGetGeometry, XOpenDisplay, XPutImage, XRootWindow}; diff --git a/rendergl.rs b/rendergl.rs index 21fbe79..95266be 100755 --- a/rendergl.rs +++ b/rendergl.rs @@ -16,6 +16,7 @@ use geom::matrix::{Matrix4, ortho}; use geom::point::Point2D; use geom::size::Size2D; use geom::rect::Rect; +use libc::c_int; use opengles::gl2::{ARRAY_BUFFER, BLEND, COLOR_BUFFER_BIT, COMPILE_STATUS, FRAGMENT_SHADER}; use opengles::gl2::{LINK_STATUS, NO_ERROR, ONE_MINUS_SRC_ALPHA, SCISSOR_BOX, SCISSOR_TEST}; use opengles::gl2::{SRC_ALPHA, STATIC_DRAW, TEXTURE_2D, TEXTURE0}; @@ -27,7 +28,6 @@ use opengles::gl2::{gen_buffers, get_attrib_location, get_error, get_integer_v, use opengles::gl2::{get_shader_info_log, get_shader_iv, get_uniform_location, is_enabled}; use opengles::gl2::{link_program, scissor, shader_source, uniform_1i, uniform_2f}; use opengles::gl2::{uniform_matrix_4fv, use_program, vertex_attrib_pointer_f32, viewport}; -use std::libc::c_int; static FRAGMENT_2D_SHADER_SOURCE: &'static str = " #ifdef GL_ES