Skip to content
Browse files

Fixed changing alt syntax

  • Loading branch information...
1 parent a3ddb0b commit f071d5e2772973580df979a643deaf9745f5a7f7 @mmeyerho mmeyerho committed
Showing with 19 additions and 25 deletions.
  1. +2 −2 layers.rs
  2. +13 −19 rendergl.rs
  3. +4 −4 test.rs
View
4 layers.rs
@@ -67,10 +67,10 @@ class Image {
drop {
alt copy self.texture {
- none {
+ none => {
// Nothing to do.
}
- some(texture) {
+ some(texture) => {
delete_textures(&[texture]);
}
}
View
32 rendergl.rs
@@ -152,8 +152,8 @@ fn init_buffers() -> (GLuint, GLuint) {
fn create_texture_for_image_if_necessary(image: @Image) {
alt image.texture {
- none {}
- some(_) { return; /* Nothing to do. */ }
+ none => {}
+ some(_) => { return; /* Nothing to do. */ }
}
#debug("making texture");
@@ -169,14 +169,14 @@ fn create_texture_for_image_if_necessary(image: @Image) {
pixel_store_i(UNPACK_ALIGNMENT, 1);
alt image.format {
- RGB24Format {
- tex_image_2d(TEXTURE_2D, 0 as GLint, RGB as GLint, image.width as GLsizei,
- image.height as GLsizei, 0 as GLint, RGB, UNSIGNED_BYTE, image.data);
- }
- ARGB32Format {
- tex_image_2d(TEXTURE_2D, 0 as GLint, RGBA as GLint, image.width as GLsizei,
- image.height as GLsizei, 0 as GLint, BGRA, UNSIGNED_BYTE, image.data);
- }
+ RGB24Format => {
+ tex_image_2d(TEXTURE_2D, 0 as GLint, RGB as GLint, image.width as GLsizei,
+ image.height as GLsizei, 0 as GLint, RGB, UNSIGNED_BYTE, image.data);
+ }
+ ARGB32Format => {
+ tex_image_2d(TEXTURE_2D, 0 as GLint, RGBA as GLint, image.width as GLsizei,
+ image.height as GLsizei, 0 as GLint, BGRA, UNSIGNED_BYTE, image.data);
+ }
}
image.texture = some(texture);
@@ -248,15 +248,9 @@ fn render_scene(render_context: RenderContext, &scene: Scene) {
uniform_matrix_4fv(render_context.projection_uniform, false, projection_matrix.to_array());
alt copy scene.root {
- ContainerLayerKind(*) {
- fail ~"container layers unsupported";
- }
- ImageLayerKind(image_layer) {
- image_layer.render(render_context);
- }
- TiledImageLayerKind(tiled_image_layer) {
- tiled_image_layer.render(render_context);
- }
+ ContainerLayerKind(*) => fail ~"container layers unsupported",
+ ImageLayerKind(image_layer) => image_layer.render(render_context),
+ TiledImageLayerKind(tiled_image_layer) => tiled_image_layer.render(render_context)
}
}
View
8 test.rs
@@ -85,16 +85,16 @@ struct Renderer {
fn display_callback() {
alt self.render_context {
- none {
+ none => {
self.render_context = some(init_render_context());
}
- some(_) {
+ some(_) => {
// Nothing to do.
}
}
let context = alt self.render_context {
- none { fail }
- some(ctx) { ctx }
+ none => fail,
+ some(ctx) => ctx
};
let t = self.t;

0 comments on commit f071d5e

Please sign in to comment.
Something went wrong with that request. Please try again.