diff options
-rw-r--r-- | components/canvas/Cargo.toml | 7 | ||||
-rw-r--r-- | components/canvas/lib.rs | 1 | ||||
-rw-r--r-- | components/canvas/webgl_paint_task.rs | 49 | ||||
-rw-r--r-- | components/servo/Cargo.lock | 9 | ||||
-rw-r--r-- | ports/cef/Cargo.lock | 9 | ||||
-rw-r--r-- | ports/gonk/Cargo.lock | 126 |
6 files changed, 26 insertions, 175 deletions
diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index adca541b100..52557fca98b 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -22,13 +22,8 @@ path = "../util" [dependencies.gfx] path = "../gfx" -[dependencies.glutin] -git = "https://github.com/servo/glutin" -branch = "servo" -features = ["headless"] - [dependencies.offscreen_gl_context] -git = "https://github.com/servo/rust-offscreen-rendering-context" +git = "https://github.com/ecoal95/rust-offscreen-rendering-context" [dependencies] cssparser = "0.3.1" diff --git a/components/canvas/lib.rs b/components/canvas/lib.rs index 37aaef6d150..2fb0ea8b8f5 100644 --- a/components/canvas/lib.rs +++ b/components/canvas/lib.rs @@ -14,7 +14,6 @@ extern crate util; extern crate gleam; extern crate num; extern crate offscreen_gl_context; -extern crate glutin; #[macro_use] extern crate log; diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs index fa399663c5d..806440db36b 100644 --- a/components/canvas/webgl_paint_task.rs +++ b/components/canvas/webgl_paint_task.rs @@ -16,40 +16,10 @@ use std::sync::mpsc::{channel, Sender}; use util::vec::byte_swap; use offscreen_gl_context::{GLContext, GLContextAttributes}; -use glutin::{HeadlessRendererBuilder, HeadlessContext}; - -// FIXME(ecoal95): We use glutin as a fallback until GLContext support improves. -enum PlatformIndependentContext { - GLContext(GLContext), - GlutinContext(HeadlessContext), -} - -impl PlatformIndependentContext { - fn make_current(&self) { - match *self { - PlatformIndependentContext::GLContext(ref ctx) => ctx.make_current().unwrap(), - PlatformIndependentContext::GlutinContext(ref ctx) => unsafe { ctx.make_current() } - } - } -} - -fn create_offscreen_context(size: Size2D<i32>, attrs: GLContextAttributes) -> Result<PlatformIndependentContext, &'static str> { - match GLContext::create_offscreen(size, attrs) { - Ok(ctx) => Ok(PlatformIndependentContext::GLContext(ctx)), - Err(msg) => { - debug!("GLContext creation error: {}", msg); - match HeadlessRendererBuilder::new(size.width as u32, size.height as u32).build() { - Ok(ctx) => Ok(PlatformIndependentContext::GlutinContext(ctx)), - Err(_) => Err("Glutin headless context creation failed") - } - } - } -} - pub struct WebGLPaintTask { size: Size2D<i32>, original_context_size: Size2D<i32>, - gl_context: PlatformIndependentContext, + gl_context: GLContext, } // This allows trying to create the PaintTask @@ -58,7 +28,8 @@ unsafe impl Send for WebGLPaintTask {} impl WebGLPaintTask { fn new(size: Size2D<i32>) -> Result<WebGLPaintTask, &'static str> { - let context = try!(create_offscreen_context(size, GLContextAttributes::default())); + // TODO(ecoal95): Get the GLContextAttributes from the `GetContext` call + let context = try!(GLContext::create_offscreen(size, GLContextAttributes::default())); Ok(WebGLPaintTask { size: size, original_context_size: size, @@ -104,7 +75,8 @@ impl WebGLPaintTask { match message { CanvasCommonMsg::Close => break, CanvasCommonMsg::SendPixelContents(chan) => painter.send_pixel_contents(chan), - CanvasCommonMsg::Recreate(size) => painter.recreate(size), + // TODO(ecoal95): handle error nicely + CanvasCommonMsg::Recreate(size) => painter.recreate(size).unwrap(), } }, CanvasMsg::Canvas2d(_) => panic!("Wrong message sent to WebGLTask"), @@ -232,20 +204,19 @@ impl WebGLPaintTask { gl::viewport(x, y, width, height); } - fn recreate(&mut self, size: Size2D<i32>) { - // TODO(ecoal95): GLContext should support a resize() method + fn recreate(&mut self, size: Size2D<i32>) -> Result<(), &'static str> { if size.width > self.original_context_size.width || size.height > self.original_context_size.height { - panic!("Can't grow a GLContext (yet)"); + try!(self.gl_context.resize(size)); + self.size = size; } else { - // Right now we just crop the viewport, it will do the job self.size = size; - gl::viewport(0, 0, size.width, size.height); unsafe { gl::Scissor(0, 0, size.width, size.height); } } + Ok(()) } fn init(&mut self) { - self.gl_context.make_current(); + self.gl_context.make_current().unwrap(); } } diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index d1f51b11f44..322b41c5d5b 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -73,16 +73,15 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)", "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.0.1 (git+https://github.com/servo/rust-offscreen-rendering-context)", + "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#16144321dc18d8ab538ee2acc0d2dad155a17899" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -833,13 +832,15 @@ dependencies = [ [[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/servo/rust-offscreen-rendering-context#9ef802439467c287178afe46c5dd7adec13993eb" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 96da921cdd1..8fcf0cc6e50 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -71,16 +71,15 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)", "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.0.1 (git+https://github.com/servo/rust-offscreen-rendering-context)", + "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#16144321dc18d8ab538ee2acc0d2dad155a17899" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -822,13 +821,15 @@ dependencies = [ [[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/servo/rust-offscreen-rendering-context#9ef802439467c287178afe46c5dd7adec13993eb" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index 34030e97138..1c616b24447 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -25,11 +25,6 @@ dependencies = [ ] [[package]] -name = "android_glue" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "azure" version = "0.1.0" source = "git+https://github.com/servo/rust-azure#91e18a325fa5fdee9b1634b44a3a3a7ac1fb09ff" @@ -64,16 +59,15 @@ dependencies = [ "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gfx 0.0.1", "gleam 0.0.1 (git+https://github.com/servo/gleam)", - "glutin 0.0.26 (git+https://github.com/servo/glutin?branch=servo)", "num 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.0.1 (git+https://github.com/servo/rust-offscreen-rendering-context)", + "offscreen_gl_context 0.0.1 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "util 0.0.1", ] [[package]] name = "cgl" version = "0.0.1" -source = "git+https://github.com/servo/rust-cgl#16144321dc18d8ab538ee2acc0d2dad155a17899" +source = "git+https://github.com/servo/rust-cgl#851ca1b90081d221c3c38d33548d3e22a19db79f" dependencies = [ "gleam 0.0.1 (git+https://github.com/servo/gleam)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -333,14 +327,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "gdi32-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "geom" version = "0.1.0" source = "git+https://github.com/servo/rust-geom#c4bdb1ef8f4915ae636eb752b103f69246b50304" @@ -383,17 +369,6 @@ dependencies = [ ] [[package]] -name = "gl" -version = "0.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "gl_common" version = "0.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -423,56 +398,6 @@ dependencies = [ ] [[package]] -name = "glutin" -version = "0.0.26" -source = "git+https://github.com/servo/glutin?branch=servo#11389c9ead188376095297a5a295f53d98129a57" -dependencies = [ - "android_glue 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "gdi32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gl_generator 0.0.24 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_cocoa 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glutin_core_graphics 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "kernel32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "khronos_api 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "osmesa-sys 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "user32-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "x11 0.0.32 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glutin_cocoa" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "objc 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glutin_core_foundation" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "glutin_core_graphics" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "glutin_core_foundation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "glx" version = "0.0.1" source = "git+https://github.com/servo/rust-glx#60ac0aee2438eadb4b51ddc8eac6fc4b5ca8e447" @@ -675,14 +600,6 @@ version = "0.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "malloc_buf" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "matches" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -784,24 +701,17 @@ dependencies = [ ] [[package]] -name = "objc" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "malloc_buf 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "offscreen_gl_context" version = "0.0.1" -source = "git+https://github.com/servo/rust-offscreen-rendering-context#9ef802439467c287178afe46c5dd7adec13993eb" +source = "git+https://github.com/ecoal95/rust-offscreen-rendering-context#c2b3dfd7fe344384e4206672b99c296141f5b4d6" dependencies = [ "cgl 0.0.1 (git+https://github.com/servo/rust-cgl)", + "core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation)", "geom 0.1.0 (git+https://github.com/servo/rust-geom)", "gleam 0.0.1 (git+https://github.com/servo/gleam)", "glx 0.0.1 (git+https://github.com/servo/rust-glx)", "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "xlib 0.1.0 (git+https://github.com/servo/rust-xlib)", ] @@ -828,16 +738,6 @@ dependencies = [ ] [[package]] -name = "osmesa-sys" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gl 0.0.12 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "phf" version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1165,14 +1065,6 @@ dependencies = [ ] [[package]] -name = "user32-sys" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "winapi 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "util" version = "0.0.1" dependencies = [ @@ -1262,14 +1154,6 @@ dependencies = [ ] [[package]] -name = "x11" -version = "0.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "xlib" version = "0.1.0" source = "git+https://github.com/servo/rust-xlib#1a0f3d48fbebf96e2d1bf83ac71309b27f49e0c7" |