@@ -25,8 +25,8 @@ use opengles::glx::{GLX_RGBA_BIT, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_DOUBLEBUF
25
25
use opengles:: glx:: { GLX_VENDOR } ;
26
26
use opengles:: gl2:: NO_ERROR ;
27
27
use opengles:: gl2;
28
- use std:: cast;
29
28
use std:: c_str:: CString ;
29
+ use std:: mem;
30
30
use std:: ptr;
31
31
use xlib:: xlib:: { Display , Pixmap , XCreateGC , XCreateImage , XCreatePixmap , XDefaultScreen } ;
32
32
use xlib:: xlib:: { XDisplayString , XFreePixmap , XGetGeometry , XOpenDisplay , XPutImage , XRootWindow } ;
@@ -76,7 +76,7 @@ impl NativeCompositingGraphicsContext {
76
76
/// FIXME(pcwalton): It would be more robust to actually have the compositor pass the visual.
77
77
fn compositor_visual_info ( display : * Display ) -> ( * XVisualInfo , Option < GLXFBConfig > ) {
78
78
unsafe {
79
- let glx_display = cast :: transmute ( display) ;
79
+ let glx_display = mem :: transmute ( display) ;
80
80
81
81
// CONSIDER:
82
82
// In skia, they compute the GLX_ALPHA_SIZE minimum and request
@@ -95,7 +95,7 @@ impl NativeCompositingGraphicsContext {
95
95
let configs = glXChooseFBConfig ( glx_display, screen,
96
96
& fbconfig_attributes[ 0 ] , & mut number_of_configs) ;
97
97
let glXGetClientString: extern "C" fn ( * Display , c_int ) -> * c_char =
98
- cast :: transmute ( glXGetProcAddress ( cast :: transmute ( & "glXGetClientString\x00 " [ 0 ] ) ) ) ;
98
+ mem :: transmute ( glXGetProcAddress ( mem :: transmute ( & "glXGetClientString\x00 " [ 0 ] ) ) ) ;
99
99
assert ! ( glXGetClientString as * c_void != ptr:: null( ) ) ;
100
100
let glx_cli_vendor_c_str = CString :: new ( glXGetClientString ( display, GLX_VENDOR ) , false ) ;
101
101
let glx_cli_vendor = match glx_cli_vendor_c_str. as_str ( ) { Some ( s) => s,
@@ -106,15 +106,15 @@ impl NativeCompositingGraphicsContext {
106
106
// with a full set of 32 bits.
107
107
for i in range ( 0 , number_of_configs as int ) {
108
108
let config = * configs. offset ( i) ;
109
- let visual_info : * XVisualInfo = cast :: transmute ( glXGetVisualFromFBConfig ( glx_display, config) ) ;
109
+ let visual_info : * XVisualInfo = mem :: transmute ( glXGetVisualFromFBConfig ( glx_display, config) ) ;
110
110
if ( * visual_info) . depth == 32 {
111
111
return ( visual_info, Some ( config) )
112
112
}
113
113
}
114
114
} else if number_of_configs != 0 {
115
115
let fbconfig = * configs. offset ( 0 ) ;
116
116
let vi = glXGetVisualFromFBConfig ( glx_display, fbconfig) ;
117
- return ( cast :: transmute ( vi) , Some ( fbconfig) ) ;
117
+ return ( mem :: transmute ( vi) , Some ( fbconfig) ) ;
118
118
}
119
119
fail ! ( "Unable to locate a GLX FB configuration that supports RGBA." ) ;
120
120
}
@@ -151,11 +151,9 @@ impl NativeGraphicsMetadata {
151
151
let display = descriptor. display . with_c_str ( |c_str| {
152
152
XOpenDisplay ( c_str)
153
153
} ) ;
154
-
155
154
if display. is_null ( ) {
156
155
fail ! ( "XOpenDisplay() failed!" ) ;
157
156
}
158
-
159
157
NativeGraphicsMetadata {
160
158
display : display,
161
159
}
@@ -166,7 +164,7 @@ impl NativeGraphicsMetadata {
166
164
/// A sendable form of the X display string.
167
165
#[ deriving( Clone , Decodable , Encodable ) ]
168
166
pub struct NativeGraphicsMetadataDescriptor {
169
- display : ~ str ,
167
+ display : String ,
170
168
}
171
169
172
170
impl NativeGraphicsMetadataDescriptor {
@@ -245,7 +243,7 @@ impl NativeSurfaceMethods for NativeSurface {
245
243
0
246
244
] ;
247
245
248
- let glx_display = cast :: transmute ( native_context. display ) ;
246
+ let glx_display = mem :: transmute ( native_context. display ) ;
249
247
250
248
let glx_pixmap = glXCreatePixmap ( glx_display,
251
249
native_context. framebuffer_configuration . expect (
@@ -254,11 +252,11 @@ impl NativeSurfaceMethods for NativeSurface {
254
252
& pixmap_attributes[ 0 ] ) ;
255
253
256
254
let glXBindTexImageEXT: extern "C" fn ( * Display , GLXDrawable , c_int , * c_int ) =
257
- cast :: transmute ( glXGetProcAddress ( cast :: transmute ( & "glXBindTexImageEXT\x00 " [ 0 ] ) ) ) ;
255
+ mem :: transmute ( glXGetProcAddress ( mem :: transmute ( & "glXBindTexImageEXT\x00 " [ 0 ] ) ) ) ;
258
256
assert ! ( glXBindTexImageEXT as * c_void != ptr:: null( ) ) ;
259
257
let _bound = texture. bind ( ) ;
260
258
glXBindTexImageEXT ( native_context. display ,
261
- cast :: transmute ( glx_pixmap) ,
259
+ mem :: transmute ( glx_pixmap) ,
262
260
GLX_FRONT_EXT ,
263
261
ptr:: null ( ) ) ;
264
262
assert_eq ! ( gl2:: get_error( ) , NO_ERROR ) ;
@@ -283,7 +281,7 @@ impl NativeSurfaceMethods for NativeSurface {
283
281
let mut border_width = 0 ;
284
282
let mut depth = 0 ;
285
283
let _ = XGetGeometry ( graphics_context. display ,
286
- cast :: transmute ( pixmap) ,
284
+ mem :: transmute ( pixmap) ,
287
285
& mut root_window,
288
286
& mut x,
289
287
& mut y,
@@ -298,7 +296,7 @@ impl NativeSurfaceMethods for NativeSurface {
298
296
depth,
299
297
ZPixmap ,
300
298
0 ,
301
- cast :: transmute ( & data[ 0 ] ) ,
299
+ mem :: transmute ( & data[ 0 ] ) ,
302
300
width as c_uint ,
303
301
height as c_uint ,
304
302
32 ,
0 commit comments