Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Rust 0.6 syntax. #2

Merged
merged 3 commits into from Apr 1, 2013
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Next

Update to Rust 0.6 syntax.

  • Loading branch information
metajack committed Mar 29, 2013
commit 3bded769df1fbfdfa74984e295defff865db776f
@@ -2,7 +2,7 @@ use geom::size::Size2D;

pub trait ShareContext {
// Creates a new context for GL object sharing.
static fn new(size: Size2D<int>) -> Self;
fn new(size: Size2D<int>) -> Self;

// Flushes the context.
fn flush(&self);
@@ -8,7 +8,7 @@ struct DummyContext {
}

impl ShareContext for DummyContext {
static fn new(_size: Size2D<int>) -> DummyContext {
fn new(_size: Size2D<int>) -> DummyContext {
DummyContext {
unused: 0
}
@@ -2,14 +2,14 @@ pub extern mod core_foundation;
pub extern mod io_surface;
pub extern mod opengles;

use mod platform::opengles::cgl;
use mod platform::opengles::gl2;

use core::cast::transmute;
use core::ptr::{null, to_unsafe_ptr};
use geom::size::Size2D;
use platform::io_surface::{IOSurface, kIOSurfaceBytesPerElement, kIOSurfaceBytesPerRow};
use platform::io_surface::{kIOSurfaceHeight, kIOSurfaceIsGlobal, kIOSurfaceWidth};
use platform::io_surface::IOSurfaceMethods;
use platform::opengles::cgl::{CGLChoosePixelFormat, CGLContextObj, CGLCreateContext};
use platform::opengles::cgl::{CGLLockContext, CGLSetCurrentContext, CGLTexImageIOSurface2D};
use platform::opengles::cgl::{kCGLNoError, kCGLPFACompliant, kCGLPFADoubleBuffer};
@@ -66,9 +66,8 @@ pub fn init_cgl() -> CGLContextObj {
}


pub fn init_surface(+size: Size2D<int>) -> IOSurface {
pub fn init_surface(size: Size2D<int>) -> IOSurface {
use platform::core_foundation::boolean::{CFBooleanRef, CFBoolean};
use platform::core_foundation::number::{CFNumberRef, CFNumber};
use number = platform::core_foundation::number::CFNumber::new;
use string = platform::core_foundation::string::CFString::wrap_extern;

@@ -111,7 +110,7 @@ pub fn init_texture() -> GLuint {
}

// Assumes the texture is already bound via gl2::bind_texture().
pub fn bind_surface_to_texture(context: &CGLContextObj, surface: &IOSurface, +size: Size2D<int>) {
pub fn bind_surface_to_texture(context: &CGLContextObj, surface: &IOSurface, size: Size2D<int>) {
// FIXME: There should be safe wrappers for this.
unsafe {
let gl_error = CGLTexImageIOSurface2D(*context,
@@ -134,7 +133,7 @@ pub fn bind_texture_to_framebuffer(texture: GLuint) {
}

impl ShareContext for MacContext {
static fn new(size: Size2D<int>) -> MacContext {
fn new(size: Size2D<int>) -> MacContext {
// Initialize CGL.
let context = init_cgl();

@@ -163,7 +162,7 @@ impl ShareContext for MacContext {
gl2::finish();
}

fn id() -> int {
fn id(&self) -> int {
self.surface.get_id() as int
}
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.