internal override void UpdateResource(DUCE.Channel channel, bool skipOnChannelCheck)
{
// If we're told we can skip the channel check, then we must be on channel
Debug.Assert(!skipOnChannelCheck || _duceResource.IsOnChannel(channel));
if (skipOnChannelCheck || _duceResource.IsOnChannel(channel))
{
base.UpdateResource(channel, skipOnChannelCheck);
bool isSynchronous = channel.IsSynchronous;
DUCE.MILCMD_D3DIMAGE data;
unsafe
{
data.Type = MILCMD.MilCmdD3DImage;
data.Handle = _duceResource.GetHandle(channel);
if (_pInteropDeviceBitmap != null)
{
UnsafeNativeMethods.MILUnknown.AddRef(_pInteropDeviceBitmap);
data.pInteropDeviceBitmap = (ulong)_pInteropDeviceBitmap.DangerousGetHandle().ToPointer();
}
else
{
data.pInteropDeviceBitmap = 0;
}
data.pSoftwareBitmap = 0;
if (isSynchronous)
{
_softwareCopy = CopyBackBuffer();
if (_softwareCopy != null)
{
UnsafeNativeMethods.MILUnknown.AddRef(_softwareCopy.WicSourceHandle);
data.pSoftwareBitmap = (ulong)_softwareCopy.WicSourceHandle.DangerousGetHandle().ToPointer();
}
}
// Send packed command structure
channel.SendCommand(
(byte*)&data,
sizeof(DUCE.MILCMD_D3DIMAGE),
false /* sendInSeparateBatch */
);
}
// Presents only happen on the async channel so don't let RTB flip this bit
if (!isSynchronous)
{
_waitingForUpdateResourceBecauseBitmapChanged = false;
}
}
}