@@ -214,8 +214,8 @@ impl TextureProgram {
214214 buffers : & Buffers ,
215215 opacity : f32 ) {
216216 gl:: uniform_1i ( self . sampler_uniform , 0 ) ;
217- gl:: uniform_matrix_4fv ( self . modelview_uniform , false , & transform. to_array ( ) ) ;
218- gl:: uniform_matrix_4fv ( self . projection_uniform , false , & projection_matrix. to_array ( ) ) ;
217+ gl:: uniform_matrix_4fv ( self . modelview_uniform , false , & transform. to_row_major_array ( ) ) ;
218+ gl:: uniform_matrix_4fv ( self . projection_uniform , false , & projection_matrix. to_row_major_array ( ) ) ;
219219
220220 let vertex_size = mem:: size_of :: < TextureVertex > ( ) ;
221221
@@ -226,7 +226,7 @@ impl TextureProgram {
226226
227227 gl:: uniform_matrix_4fv ( self . texture_space_transform_uniform ,
228228 false ,
229- & texture_space_transform. to_array ( ) ) ;
229+ & texture_space_transform. to_row_major_array ( ) ) ;
230230
231231 gl:: uniform_1f ( self . opacity_uniform , opacity) ;
232232 }
@@ -283,8 +283,8 @@ impl SolidColorProgram {
283283 transform : & Matrix4D < f32 > ,
284284 projection_matrix : & Matrix4D < f32 > ,
285285 color : & Color ) {
286- gl:: uniform_matrix_4fv ( self . modelview_uniform , false , & transform. to_array ( ) ) ;
287- gl:: uniform_matrix_4fv ( self . projection_uniform , false , & projection_matrix. to_array ( ) ) ;
286+ gl:: uniform_matrix_4fv ( self . modelview_uniform , false , & transform. to_row_major_array ( ) ) ;
287+ gl:: uniform_matrix_4fv ( self . projection_uniform , false , & projection_matrix. to_row_major_array ( ) ) ;
288288 gl:: uniform_4f ( self . color_uniform ,
289289 color. r as GLfloat ,
290290 color. g as GLfloat ,
@@ -567,15 +567,15 @@ impl RenderContext {
567567 // coordinates when dealing with GL_ARB_texture_rectangle.
568568 let mut texture_transform = Matrix4D :: identity ( ) ;
569569 if texture. flip == VerticalFlip {
570- texture_transform = texture_transform. scale ( 1.0 , -1.0 , 1.0 ) ;
570+ texture_transform = texture_transform. pre_scaled ( 1.0 , -1.0 , 1.0 ) ;
571571 }
572572 if texture_coordinates_need_to_be_scaled_by_size {
573- texture_transform = texture_transform. scale ( texture. size . width as f32 ,
574- texture. size . height as f32 ,
575- 1.0 ) ;
573+ texture_transform = texture_transform. pre_scaled ( texture. size . width as f32 ,
574+ texture. size . height as f32 ,
575+ 1.0 ) ;
576576 }
577577 if texture. flip == VerticalFlip {
578- texture_transform = texture_transform. translate ( 0.0 , -1.0 , 0.0 ) ;
578+ texture_transform = texture_transform. pre_translated ( 0.0 , -1.0 , 0.0 ) ;
579579 }
580580
581581 program. bind_uniforms_and_attributes ( vertices,
@@ -618,7 +618,7 @@ impl RenderContext {
618618 clip_rect : Option < Rect < f32 > > ,
619619 gfx_context : & NativeDisplay ) {
620620 let ts = layer. transform_state . borrow ( ) ;
621- let transform = transform. mul ( & ts. final_transform ) ;
621+ let transform = transform. pre_mul ( & ts. final_transform ) ;
622622 let background_color = * layer. background_color . borrow ( ) ;
623623
624624 // Create native textures for this layer
@@ -784,11 +784,12 @@ impl RenderContext {
784784 } else {
785785 // If the transform is 2d, invert it and back-transform
786786 // the clip rect into world space.
787- let transform = m. invert ( ) ;
788- let xform_2d = Matrix2D :: new ( transform. m11 , transform. m12 ,
789- transform. m21 , transform. m22 ,
790- transform. m41 , transform. m42 ) ;
791- Some ( xform_2d. transform_rect ( & cr) )
787+ m. inverse ( ) . map ( |transform| {
788+ let xform_2d = Matrix2D :: row_major ( transform. m11 , transform. m12 ,
789+ transform. m21 , transform. m22 ,
790+ transform. m41 , transform. m42 ) ;
791+ xform_2d. transform_rect ( & cr)
792+ } )
792793 }
793794
794795 } ) ;
@@ -827,7 +828,7 @@ pub fn render_scene<T>(root_layer: Rc<Layer<T>>,
827828 gl:: depth_func ( gl:: LEQUAL ) ;
828829
829830 // Set up the initial modelview matrix.
830- let transform = Matrix4D :: identity ( ) . scale ( scene. scale . get ( ) , scene. scale . get ( ) , 1.0 ) ;
831+ let transform = Matrix4D :: identity ( ) . pre_scaled ( scene. scale . get ( ) , scene. scale . get ( ) , 1.0 ) ;
831832 let projection = create_ortho ( & scene. viewport . size . to_untyped ( ) ) ;
832833
833834 // Build the list of render items
0 commit comments