@@ -564,6 +564,7 @@ impl<'a> WgpuCommandHandler<'a> {
564
564
fn add_to_current (
565
565
& mut self ,
566
566
matrix : Matrix ,
567
+ tz : f64 ,
567
568
color_transform : ColorTransform ,
568
569
command_builder : impl FnOnce ( wgpu:: DynamicOffset ) -> DrawCommand ,
569
570
) {
@@ -575,7 +576,7 @@ impl<'a> WgpuCommandHandler<'a> {
575
576
[
576
577
matrix. tx . to_pixels ( ) as f32 ,
577
578
matrix. ty . to_pixels ( ) as f32 ,
578
- 0.0 ,
579
+ tz as f32 ,
579
580
1.0 ,
580
581
] ,
581
582
] ,
@@ -642,6 +643,7 @@ impl CommandHandler for WgpuCommandHandler<'_> {
642
643
let transform = Transform {
643
644
matrix : Matrix :: scale ( target. width ( ) as f32 , target. height ( ) as f32 ) ,
644
645
color_transform : Default :: default ( ) ,
646
+ tz : 0.0 ,
645
647
} ;
646
648
let texture = target. take_color_texture ( ) ;
647
649
let bind_group =
@@ -673,6 +675,7 @@ impl CommandHandler for WgpuCommandHandler<'_> {
673
675
} ) ;
674
676
self . add_to_current (
675
677
transform. matrix ,
678
+ transform. tz ,
676
679
transform. color_transform ,
677
680
|transform_buffer| DrawCommand :: RenderTexture {
678
681
_texture : texture,
@@ -726,15 +729,18 @@ impl CommandHandler for WgpuCommandHandler<'_> {
726
729
texture. texture . height ( ) as f32 ,
727
730
) ;
728
731
}
729
- self . add_to_current ( matrix, transform. color_transform , |transform_buffer| {
730
- DrawCommand :: RenderBitmap {
732
+ self . add_to_current (
733
+ matrix,
734
+ transform. tz ,
735
+ transform. color_transform ,
736
+ |transform_buffer| DrawCommand :: RenderBitmap {
731
737
bitmap,
732
738
transform_buffer,
733
739
smoothing,
734
740
blend_mode : TrivialBlend :: Normal ,
735
741
render_stage3d : false ,
736
- }
737
- } ) ;
742
+ } ,
743
+ ) ;
738
744
}
739
745
fn render_stage3d ( & mut self , bitmap : BitmapHandle , transform : Transform ) {
740
746
let mut matrix = transform. matrix ;
@@ -745,20 +751,24 @@ impl CommandHandler for WgpuCommandHandler<'_> {
745
751
texture. texture . height ( ) as f32 ,
746
752
) ;
747
753
}
748
- self . add_to_current ( matrix, transform. color_transform , |transform_buffer| {
749
- DrawCommand :: RenderBitmap {
754
+ self . add_to_current (
755
+ matrix,
756
+ transform. tz ,
757
+ transform. color_transform ,
758
+ |transform_buffer| DrawCommand :: RenderBitmap {
750
759
bitmap,
751
760
transform_buffer,
752
761
smoothing : false ,
753
762
blend_mode : TrivialBlend :: Normal ,
754
763
render_stage3d : true ,
755
- }
756
- } ) ;
764
+ } ,
765
+ ) ;
757
766
}
758
767
759
768
fn render_shape ( & mut self , shape : ShapeHandle , transform : Transform ) {
760
769
self . add_to_current (
761
770
transform. matrix ,
771
+ transform. tz ,
762
772
transform. color_transform ,
763
773
|transform_buffer| DrawCommand :: RenderShape {
764
774
shape,
@@ -770,6 +780,7 @@ impl CommandHandler for WgpuCommandHandler<'_> {
770
780
fn draw_rect ( & mut self , color : Color , matrix : Matrix ) {
771
781
self . add_to_current (
772
782
matrix,
783
+ 0.0 ,
773
784
ColorTransform :: multiply_from ( color) ,
774
785
|transform_buffer| DrawCommand :: DrawRect { transform_buffer } ,
775
786
) ;
@@ -785,6 +796,7 @@ impl CommandHandler for WgpuCommandHandler<'_> {
785
796
matrix. ty += Twips :: HALF_PX ;
786
797
self . add_to_current (
787
798
matrix,
799
+ 0.0 ,
788
800
ColorTransform :: multiply_from ( color) ,
789
801
|transform_buffer| DrawCommand :: DrawLine { transform_buffer } ,
790
802
) ;
@@ -801,6 +813,7 @@ impl CommandHandler for WgpuCommandHandler<'_> {
801
813
matrix. ty += Twips :: HALF_PX ;
802
814
self . add_to_current (
803
815
matrix,
816
+ 0.0 ,
804
817
ColorTransform :: multiply_from ( color) ,
805
818
|transform_buffer| DrawCommand :: DrawLineRect { transform_buffer } ,
806
819
) ;
0 commit comments