Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Imaging / UnmanagedBitmapWrapper.cs / 1305600 / UnmanagedBitmapWrapper.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation. All Rights Reserved. // // File: UnmanagedBitmapWrapper.cs // //----------------------------------------------------------------------------- using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Reflection; using MS.Internal; using MS.Win32.PresentationCore; using System.Security; using System.Security.Permissions; using System.Diagnostics; using System.Windows.Media; using System.Globalization; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using MS.Internal.PresentationCore; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace System.Windows.Media.Imaging { internal sealed class UnmanagedBitmapWrapper : BitmapSource { ////// Critical - calls critical code method BitmapSource.UpdateCachedSettings /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] public UnmanagedBitmapWrapper(BitmapSourceSafeMILHandle bitmapSource) : base(true) { _bitmapInit.BeginInit(); // // This constructor is used by BitmapDecoder and BitmapFrameDecode for thumbnails and // previews. The bitmapSource parameter comes from BitmapSource.CreateCachedBitmap // which already calculated memory pressure, so there's no need to do it here. // WicSourceHandle = bitmapSource; _bitmapInit.EndInit(); UpdateCachedSettings(); } #region Protected Methods ////// Critical - eventually access'es critical resources (_wicSource) /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] internal UnmanagedBitmapWrapper(bool initialize) : base(true) { // Call BeginInit and EndInit if initialize is true. if (initialize) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } } ////// Implementation of protected override Freezable CreateInstanceCore() { return new UnmanagedBitmapWrapper(false); } private void CopyCommon(UnmanagedBitmapWrapper sourceBitmap) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } ///Freezable.CreateInstanceCore . ////// Implementation of protected override void CloneCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCore . ////// Implementation of protected override void CloneCurrentValueCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCurrentValueCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCurrentValueCore . ////// Implementation of protected override void GetAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.GetAsFrozenCore . ////// Implementation of protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetCurrentValueAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation. All Rights Reserved. // // File: UnmanagedBitmapWrapper.cs // //----------------------------------------------------------------------------- using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Reflection; using MS.Internal; using MS.Win32.PresentationCore; using System.Security; using System.Security.Permissions; using System.Diagnostics; using System.Windows.Media; using System.Globalization; using System.Runtime.InteropServices; using System.Windows; using System.Windows.Media.Animation; using System.Windows.Media.Composition; using MS.Internal.PresentationCore; using SR = MS.Internal.PresentationCore.SR; using SRID = MS.Internal.PresentationCore.SRID; namespace System.Windows.Media.Imaging { internal sealed class UnmanagedBitmapWrapper : BitmapSource { ///Freezable.GetCurrentValueAsFrozenCore . ////// Critical - calls critical code method BitmapSource.UpdateCachedSettings /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] public UnmanagedBitmapWrapper(BitmapSourceSafeMILHandle bitmapSource) : base(true) { _bitmapInit.BeginInit(); // // This constructor is used by BitmapDecoder and BitmapFrameDecode for thumbnails and // previews. The bitmapSource parameter comes from BitmapSource.CreateCachedBitmap // which already calculated memory pressure, so there's no need to do it here. // WicSourceHandle = bitmapSource; _bitmapInit.EndInit(); UpdateCachedSettings(); } #region Protected Methods ////// Critical - eventually access'es critical resources (_wicSource) /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] internal UnmanagedBitmapWrapper(bool initialize) : base(true) { // Call BeginInit and EndInit if initialize is true. if (initialize) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } } ////// Implementation of protected override Freezable CreateInstanceCore() { return new UnmanagedBitmapWrapper(false); } private void CopyCommon(UnmanagedBitmapWrapper sourceBitmap) { _bitmapInit.BeginInit(); _bitmapInit.EndInit(); } ///Freezable.CreateInstanceCore . ////// Implementation of protected override void CloneCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCore . ////// Implementation of protected override void CloneCurrentValueCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.CloneCurrentValueCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.CloneCurrentValueCore . ////// Implementation of protected override void GetAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } ///Freezable.GetAsFrozenCore . ////// Implementation of protected override void GetCurrentValueAsFrozenCore(Freezable sourceFreezable) { UnmanagedBitmapWrapper sourceBitmap = (UnmanagedBitmapWrapper)sourceFreezable; base.GetCurrentValueAsFrozenCore(sourceFreezable); CopyCommon(sourceBitmap); } #endregion } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.Freezable.GetCurrentValueAsFrozenCore . ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- RtfToXamlReader.cs
- CriticalHandle.cs
- BehaviorDragDropEventArgs.cs
- SoapTypeAttribute.cs
- TakeOrSkipWhileQueryOperator.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- shaperfactoryquerycacheentry.cs
- DynamicScriptObject.cs
- FileDataSource.cs
- XpsPackagingPolicy.cs
- CrossAppDomainChannel.cs
- SqlTopReducer.cs
- KnownIds.cs
- PropertyGridCommands.cs
- SqlReorderer.cs
- storepermission.cs
- TemplateApplicationHelper.cs
- X509Chain.cs
- ReadOnlyPermissionSet.cs
- SHA512.cs
- BindingSource.cs
- MonitoringDescriptionAttribute.cs
- ClientRolePrincipal.cs
- XmlDataSourceView.cs
- Adorner.cs
- MultipartIdentifier.cs
- MarginsConverter.cs
- listitem.cs
- ClonableStack.cs
- XPathAxisIterator.cs
- ScriptingJsonSerializationSection.cs
- FullTextLine.cs
- PathFigure.cs
- ModelTreeManager.cs
- DataTableNewRowEvent.cs
- XmlHierarchicalDataSourceView.cs
- ReverseComparer.cs
- BamlLocalizabilityResolver.cs
- GenericTypeParameterBuilder.cs
- WebPartEditorOkVerb.cs
- Compiler.cs
- CodeTypeMember.cs
- CodeAccessPermission.cs
- HtmlHistory.cs
- TextElement.cs
- TextEditorContextMenu.cs
- MarkedHighlightComponent.cs
- RecommendedAsConfigurableAttribute.cs
- WindowsRegion.cs
- ServiceDurableInstanceContextProvider.cs
- AutomationPatternInfo.cs
- RangeValidator.cs
- RtfControlWordInfo.cs
- DragCompletedEventArgs.cs
- PropertyToken.cs
- StringUtil.cs
- DetailsView.cs
- CookieProtection.cs
- MergablePropertyAttribute.cs
- CopyOnWriteList.cs
- XAMLParseException.cs
- SystemIPInterfaceStatistics.cs
- StringDictionary.cs
- DXD.cs
- followingquery.cs
- AppSecurityManager.cs
- SoapIgnoreAttribute.cs
- TypeConverterHelper.cs
- BooleanKeyFrameCollection.cs
- TextAction.cs
- ResolveMatchesCD1.cs
- Parser.cs
- TextTreeRootTextBlock.cs
- ToolBarTray.cs
- MenuItem.cs
- HostVisual.cs
- XmlSchemaGroup.cs
- Int16Storage.cs
- RuntimeCompatibilityAttribute.cs
- X509Certificate2.cs
- InfoCardCryptoHelper.cs
- ConstructorNeedsTagAttribute.cs
- ADRoleFactoryConfiguration.cs
- DefaultBindingPropertyAttribute.cs
- UrlRoutingHandler.cs
- ConsoleEntryPoint.cs
- VersionedStream.cs
- SqlServices.cs
- XmlSchemaAll.cs
- ImpersonationContext.cs
- VisualStyleRenderer.cs
- EdmSchemaError.cs
- String.cs
- LogRecordSequence.cs
- CodeCommentStatement.cs
- SiteMapNodeCollection.cs
- SoundPlayer.cs
- DrawingAttributesDefaultValueFactory.cs
- DataGridItem.cs
- ClientConfigPaths.cs