@@ -166,7 +166,6 @@ public virtual void SaveScreenshot(ImageRegion imageRegion, string? name)
166166 Directory . CreateDirectory ( path ) ;
167167 }
168168
169- var bitmap = imageRegion . SrcBitmap ;
170169 if ( String . IsNullOrWhiteSpace ( name ) )
171170 {
172171 name = $@ "{ DateTime . Now : yyyyMMddHHmmssffff} .png";
@@ -176,17 +175,25 @@ public virtual void SaveScreenshot(ImageRegion imageRegion, string? name)
176175 var mat = imageRegion . SrcMat ;
177176 if ( TaskContext . Instance ( ) . Config . CommonConfig . ScreenshotUidCoverEnabled )
178177 {
179- var assetScale = TaskContext . Instance ( ) . SystemInfo . ScaleTo1080PRatio ;
180- var rect = new Rect ( ( int ) ( mat . Width - MaskWindowConfig . UidCoverRightBottomRect . X * assetScale ) ,
181- ( int ) ( mat . Height - MaskWindowConfig . UidCoverRightBottomRect . Y * assetScale ) ,
182- ( int ) ( MaskWindowConfig . UidCoverRightBottomRect . Width * assetScale ) ,
183- ( int ) ( MaskWindowConfig . UidCoverRightBottomRect . Height * assetScale ) ) ;
184- mat . Rectangle ( rect , Scalar . White , - 1 ) ;
178+ new Task ( ( ) =>
179+ {
180+ using var mat2 = mat . Clone ( ) ;
181+ var assetScale = TaskContext . Instance ( ) . SystemInfo . ScaleTo1080PRatio ;
182+ var rect = new Rect ( ( int ) ( mat . Width - MaskWindowConfig . UidCoverRightBottomRect . X * assetScale ) ,
183+ ( int ) ( mat . Height - MaskWindowConfig . UidCoverRightBottomRect . Y * assetScale ) ,
184+ ( int ) ( MaskWindowConfig . UidCoverRightBottomRect . Width * assetScale ) ,
185+ ( int ) ( MaskWindowConfig . UidCoverRightBottomRect . Height * assetScale ) ) ;
186+ mat2 . Rectangle ( rect , Scalar . White , - 1 ) ;
187+ Cv2 . ImWrite ( savePath , mat2 ) ;
188+ } ) . Start ( ) ;
185189 }
186- new Task ( ( ) =>
190+ else
187191 {
188- Cv2 . ImWrite ( savePath , mat ) ;
189- } ) . Start ( ) ;
192+ new Task ( ( ) =>
193+ {
194+ Cv2 . ImWrite ( savePath , mat ) ;
195+ } ) . Start ( ) ;
196+ }
190197 }
191198
192199 public void Reset ( )
0 commit comments