@@ -112,12 +112,12 @@ unsafe impl StaticType for Surface {
112112const VELLO_SURFACE_FORMAT : wgpu:: TextureFormat = wgpu:: TextureFormat :: Rgba8Unorm ;
113113
114114impl WgpuExecutor {
115- pub async fn render_vello_scene_to_texture ( & self , scene : & Scene , size : UVec2 , context : & RenderContext , background : Color ) -> Result < wgpu:: Texture > {
115+ pub async fn render_vello_scene_to_texture ( & self , scene : & Scene , size : UVec2 , context : & RenderContext , background : Option < Color > ) -> Result < wgpu:: Texture > {
116116 let mut output = None ;
117117 self . render_vello_scene_to_target_texture ( scene, size, context, background, & mut output) . await ?;
118118 Ok ( output. unwrap ( ) . texture )
119119 }
120- pub async fn render_vello_scene_to_target_texture ( & self , scene : & Scene , size : UVec2 , context : & RenderContext , background : Color , output : & mut Option < TargetTexture > ) -> Result < ( ) > {
120+ pub async fn render_vello_scene_to_target_texture ( & self , scene : & Scene , size : UVec2 , context : & RenderContext , background : Option < Color > , output : & mut Option < TargetTexture > ) -> Result < ( ) > {
121121 // Initialize (lazily) if this is the first call
122122 if output. is_none ( ) {
123123 * output = Some ( TargetTexture :: new ( & self . context . device , size) ) ;
@@ -126,7 +126,7 @@ impl WgpuExecutor {
126126 if let Some ( target_texture) = output. as_mut ( ) {
127127 target_texture. ensure_size ( & self . context . device , size) ;
128128
129- let [ r, g, b, a] = background. to_rgba8_srgb ( ) ;
129+ let [ r, g, b, a] = background. unwrap_or ( Color :: TRANSPARENT ) . to_rgba8_srgb ( ) ;
130130 let render_params = RenderParams {
131131 base_color : vello:: peniko:: Color :: from_rgba8 ( r, g, b, a) ,
132132 width : size. x ,
0 commit comments