Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Core / System / Windows / Media / Imaging / UnmanagedBitmapWrapper.cs / 1 / 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 : System.Windows.Media.Imaging.BitmapSource { ////// Critical - calls critical code method BitmapSource.UpdateCachedSettings /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] public UnmanagedBitmapWrapper(BitmapSourceSafeMILHandle bitmapSource) : base(true) { _bitmapInit.BeginInit(); bitmapSource.CalculateSize(); 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(); } } ////// Critical - calls critical code method BitmapSource.UpdateCachedSettings /// TreatAsSafe - all inputs are checked /// [SecurityCritical, SecurityTreatAsSafe] internal void UpdateBitmapSource(BitmapSource bitmapSource, DUCE.Channel channel) { WicSourceHandle = bitmapSource.WicSourceHandle; UpdateCachedSettings(); _needsUpdate = true; UpdateResource(channel, true /* skip "on channel" check - we already know that we're on channel */ ); } ////// 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
- XmlAttributeAttribute.cs
- OdbcError.cs
- DebugView.cs
- SubMenuStyle.cs
- NativeMethods.cs
- DataTemplate.cs
- DataSourceHelper.cs
- XMLDiffLoader.cs
- PropertyIdentifier.cs
- EvidenceTypeDescriptor.cs
- CrossSiteScriptingValidation.cs
- XmlStringTable.cs
- ScriptReference.cs
- xsdvalidator.cs
- HashAlgorithm.cs
- LinkedResourceCollection.cs
- UInt16Converter.cs
- ColumnTypeConverter.cs
- FlowSwitchLink.cs
- DataGridCommandEventArgs.cs
- SystemException.cs
- EntityModelSchemaGenerator.cs
- DataChangedEventManager.cs
- BuiltInExpr.cs
- NullReferenceException.cs
- CacheSection.cs
- SqlParameterCollection.cs
- iisPickupDirectory.cs
- Misc.cs
- CapacityStreamGeometryContext.cs
- CustomAttribute.cs
- ScaleTransform.cs
- CodeLinePragma.cs
- MessageBox.cs
- DocumentApplicationJournalEntry.cs
- SystemWebExtensionsSectionGroup.cs
- FreezableCollection.cs
- TakeOrSkipWhileQueryOperator.cs
- HorizontalAlignConverter.cs
- SizeChangedEventArgs.cs
- XmlSchemaAny.cs
- SerializationSectionGroup.cs
- EncryptedPackage.cs
- ColorTranslator.cs
- ObjectListSelectEventArgs.cs
- OrderedDictionary.cs
- UnsupportedPolicyOptionsException.cs
- DataGridrowEditEndingEventArgs.cs
- DesignerTextBoxAdapter.cs
- RadioButtonPopupAdapter.cs
- ToolStripContentPanelRenderEventArgs.cs
- CrossContextChannel.cs
- AsymmetricSignatureFormatter.cs
- WebPartConnectVerb.cs
- SymLanguageType.cs
- XmlTextReaderImplHelpers.cs
- OracleRowUpdatedEventArgs.cs
- Vector3DValueSerializer.cs
- WaitHandle.cs
- UpdatePanelControlTrigger.cs
- OciHandle.cs
- Keyboard.cs
- RootBuilder.cs
- EncodingTable.cs
- CategoryNameCollection.cs
- SimpleBitVector32.cs
- PowerModeChangedEventArgs.cs
- KnowledgeBase.cs
- securestring.cs
- ValidationError.cs
- OdbcTransaction.cs
- InitializerFacet.cs
- HtmlTableRow.cs
- XhtmlBasicCommandAdapter.cs
- SoapCodeExporter.cs
- HttpEncoderUtility.cs
- OverflowException.cs
- InputLanguage.cs
- DbConnectionClosed.cs
- ResXResourceWriter.cs
- ChangeProcessor.cs
- ContentElementAutomationPeer.cs
- SchemaElementDecl.cs
- EtwProvider.cs
- SizeConverter.cs
- PersonalizationAdministration.cs
- SocketInformation.cs
- BlobPersonalizationState.cs
- DataControlPagerLinkButton.cs
- SessionStateSection.cs
- ConfigurationSettings.cs
- ClassHandlersStore.cs
- MetroSerializationManager.cs
- XmlRawWriter.cs
- WebPartUtil.cs
- ConfigXmlWhitespace.cs
- HttpConfigurationSystem.cs
- DesignerAutoFormat.cs
- IndependentAnimationStorage.cs
- ScopeCompiler.cs