From b9710f05a9d1e7fd10536b604074baf748fb5bd7 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 28 Dec 2014 15:08:41 +0100 Subject: Unify WindowBuilder and HeadlessRendererBuilder for easier implementations --- src/x11/headless.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/x11/headless.rs') diff --git a/src/x11/headless.rs b/src/x11/headless.rs index d6f1023..22d0654 100644 --- a/src/x11/headless.rs +++ b/src/x11/headless.rs @@ -1,4 +1,4 @@ -use HeadlessRendererBuilder; +use BuilderAttribs; use CreationError; use CreationError::OsError; use libc; @@ -13,11 +13,13 @@ pub struct HeadlessContext { } impl HeadlessContext { - pub fn new(builder: HeadlessRendererBuilder) -> Result { + pub fn new(builder: BuilderAttribs) -> Result { + let dimensions = builder.dimensions.unwrap(); + Ok(HeadlessContext { - width: builder.dimensions.0, - height: builder.dimensions.1, - buffer: Vec::from_elem(builder.dimensions.0 * builder.dimensions.1, unsafe { mem::uninitialized() }), + width: dimensions.0, + height: dimensions.1, + buffer: Vec::from_elem(dimensions.0 * dimensions.1, unsafe { mem::uninitialized() }), context: unsafe { let ctxt = ffi::OSMesaCreateContext(0x1908, ptr::null()); if ctxt.is_null() { -- cgit v1.2.3