@ -25,7 +25,6 @@ public class MotionElement(
@@ -25,7 +25,6 @@ public class MotionElement(
private int _f rameSize ;
private PipeReader _ pipeReader ;
private SKPointI _ point ;
private SKBitmap _ canvasBitmap ;
private SKBitmap _ motionFrameBitmap ;
private TimeSpan _ startTime ;
private TimeSpan _ endTime ;
@ -55,7 +54,6 @@ public class MotionElement(
@@ -55,7 +54,6 @@ public class MotionElement(
_ cancellationTokenSource ? . Dispose ( ) ;
_ canvasBitmap ? . Dispose ( ) ;
_ motionFrameBitmap ? . Dispose ( ) ;
}
@ -119,12 +117,6 @@ public class MotionElement(
@@ -119,12 +117,6 @@ public class MotionElement(
_f rameSize = targetSize . Width * targetSize . Height * 4 ;
_ canvasBitmap = new SKBitmap (
context . FrameSize . Width ,
context . FrameSize . Height ,
SKColorType . Bgra8888 ,
SKAlphaType . Unpremul ) ;
_ motionFrameBitmap = new SKBitmap (
targetSize . Width ,
targetSize . Height ,
@ -235,7 +227,7 @@ public class MotionElement(
@@ -235,7 +227,7 @@ public class MotionElement(
{
if ( contentTime < = _ endTime )
{
return new PreparedElementImage ( _ canvasBitmap , SKPointI . Empty , 1.0f , ZIndex , false ) ;
return new PreparedElementImage ( _ motionFrameBitmap , _ point , 1.0f , ZIndex , false ) ;
}
_ state = MotionElementState . Finished ;
@ -260,18 +252,11 @@ public class MotionElement(
@@ -260,18 +252,11 @@ public class MotionElement(
sequence . CopyTo ( pixmap . GetPixelSpan ( ) ) ;
}
_ canvasBitmap . Erase ( SKColors . Transparent ) ;
using ( var canvas = new SKCanvas ( _ canvasBitmap ) )
{
canvas . DrawBitmap ( _ motionFrameBitmap , _ point ) ;
}
// mark this frame as consumed
consumed = sequence . End ;
// we are done, return the frame
return new PreparedElementImage ( _ canvasBitmap , SKPointI . Empty , 1.0f , ZIndex , false ) ;
return new PreparedElementImage ( _ motionFrameBitmap , _ point , 1.0f , ZIndex , false ) ;
}
if ( readResult . IsCompleted )
@ -281,7 +266,7 @@ public class MotionElement(
@@ -281,7 +266,7 @@ public class MotionElement(
if ( motionElement . EndBehavior is MotionEndBehavior . Hold )
{
_ state = MotionElementState . Holding ;
return new PreparedElementImage ( _ canvasBitmap , SKPointI . Empty , 1.0f , ZIndex , false ) ;
return new PreparedElementImage ( _ motionFrameBitmap , _ point , 1.0f , ZIndex , false ) ;
}
else
{