File tree 1 file changed +14
-3
lines changed
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/Imaging
1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -387,11 +387,22 @@ internal override void FinalizeCreation()
387
387
if ( _sizeOptions . DoesScale )
388
388
{
389
389
Debug . Assert ( _sizeOptions . Rotation == Rotation . Rotate0 ) ;
390
- uint width , height ;
391
390
391
+ uint sourceWidth , sourceHeight ;
392
+ if ( ! _sourceRect . IsEmpty )
393
+ {
394
+ sourceWidth = ( uint ) _sourceRect . Width ;
395
+ sourceHeight = ( uint ) _sourceRect . Height ;
396
+ }
397
+ else
398
+ {
399
+ HRESULT . Check ( UnsafeNativeMethods . WICBitmapSource . GetSize ( _unmanagedSource , out sourceWidth , out sourceHeight ) ) ;
400
+ }
401
+
402
+ uint width , height ;
392
403
_sizeOptions . GetScaledWidthAndHeight (
393
- ( uint ) _sizeOptions . PixelWidth ,
394
- ( uint ) _sizeOptions . PixelHeight ,
404
+ sourceWidth ,
405
+ sourceHeight ,
395
406
out width ,
396
407
out height ) ;
397
408
You can’t perform that action at this time.
0 commit comments