private static void IsFrontBufferAvailablePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
Debug.Assert(e.OldValue != e.NewValue);
bool isFrontBufferAvailable = (bool)e.NewValue;
D3DImage img = (D3DImage)d;
if (!isFrontBufferAvailable)
{
//
// This isn't a true "ref" to their surface, so we don't need to do this,
// but if the user clones this D3DImage afterwards we don't want to
// have a pontentially garbage pointer being copied
//
// We are not Detach()-ing from or releasing _pInteropDeviceBitmap because
// if we did, we would never get a notification when the front buffer became
// available again.
//
if (!img._isSoftwareFallbackEnabled)
{
// If software fallback is enabled, we keep this pointer around to make sure SetBackBuffer with
// the same surface pointer is still a no-op. The user is responsible for calling SetBackBuffer
// again (possibly with a null value) to force the release of this pointer.
img._pUserSurfaceUnsafe = IntPtr.Zero;
}
}
if (img._isFrontBufferAvailableChangedHandlers != null)
{
img._isFrontBufferAvailableChangedHandlers(img, e);
}
}