/// This may only be called on the painting side.
This may only be called on the painting side.
This may only be called on the painting side .
pub fn upload(&mut self, graphics_context: &NativePaintingGraphicsContext, data: &[u8]) {
        unsafe {
            // Ensure that we're running on the render task. Take the display.
            let pixmap = self.pixmap;
            // Figure out the width, height, and depth of the pixmap.
            let mut root_window = 0;
            let mut x = 0;
            let mut y = 0;
            let mut width = 0;
            let mut height = 0;
            let mut border_width = 0;
            let mut depth = 0;
            let _ = XGetGeometry(graphics_context.display,
                                 mem::transmute(pixmap),
                                 &mut root_window,
                                 &mut x,
                                 &mut y,
                                 &mut width,
                                 &mut height,
                                 &mut border_width,
                                 &mut depth);
            // Create the image.
            let image = XCreateImage(graphics_context.display,
                                     (*graphics_context.visual_info).visual,
                                     depth,
                                     ZPixmap,
                                     0,
                                     mem::transmute(&data[0]),
                                     width as c_uint,
                                     height as c_uint,
                                     32,
                                     0);
            // Create the X graphics context.
            let gc = XCreateGC(graphics_context.display, pixmap, 0, ptr::null_mut());
            // Draw the image.
            let _ = XPutImage(graphics_context.display,
                              pixmap,
                              gc,
                              image,
                              0,
                              0,
                              0,
                              0,
                              width,
                              height);
        }
    }
pub fn upload ( & mut self , graphics_context : & NativePaintingGraphicsContext , data : & [ u8 ] ) { unsafe { // Ensure that we're running on the render task. Take the display. let pixmap = self . pixmap ; // Figure out the width, height, and depth of the pixmap. let mut root_window = 0 ; let mut x = 0 ; let mut y = 0 ; let mut width = 0 ; let mut height = 0 ; let mut border_width = 0 ; let mut depth = 0 ; let _ = XGetGeometry ( graphics_context . display , mem :: transmute ( pixmap ) , & mut root_window , & mut x , & mut y , & mut width , & mut height , & mut border_width , & mut depth ) ; // Create the image. let image = XCreateImage ( graphics_context . display , ( * graphics_context . visual_info ) . visual , depth , ZPixmap , 0 , mem :: transmute ( & data [ 0 ] ) , width as c_uint , height as c_uint , 32 , 0 ) ; // Create the X graphics context. let gc = XCreateGC ( graphics_context . display , pixmap , 0 , ptr :: null_mut ( ) ) ; // Draw the image. let _ = XPutImage ( graphics_context . display , pixmap , gc , image , 0 , 0 , 0 , 0 , width , height ) ; } }
This may only be called on the painting side.
This may only be called on the painting side .
&mut self
graphics_context
&NativePaintingGraphicsContext
data
&[u8]