Example #1
0
        private void CopyCommon(BitmapFrameDecode sourceBitmapFrameDecode)
        {
            _bitmapInit.BeginInit();
            _frameNumber           = sourceBitmapFrameDecode._frameNumber;
            _isThumbnailCached     = sourceBitmapFrameDecode._isThumbnailCached;
            _isMetadataCached      = sourceBitmapFrameDecode._isMetadataCached;
            _isColorContextCached  = sourceBitmapFrameDecode._isColorContextCached;
            _frameSource           = sourceBitmapFrameDecode._frameSource;
            _thumbnail             = sourceBitmapFrameDecode._thumbnail;
            _metadata              = sourceBitmapFrameDecode.InternalMetadata;
            _readOnlycolorContexts = sourceBitmapFrameDecode._readOnlycolorContexts;

            _decoder = sourceBitmapFrameDecode._decoder;
            if (_decoder != null && _decoder.IsDownloading)
            {
                // UpdateDecoder must be called when download completes and the real decoder
                // is created. Normally _decoder will call UpdateDecoder, but in this case the
                // decoder will not know about the cloned BitmapFrameDecode and will only call
                // UpdateDecoder on the original. The clone will need to listen to the original
                // BitmapFrameDecode for DownloadCompleted, then call UpdateDecoder on itself.
                // The weak event sink hooks up handlers on DownloadCompleted, DownloadFailed,
                // and DownloadProgress
                _weakBitmapFrameDecodeEventSink =
                    new WeakBitmapFrameDecodeEventSink(this, sourceBitmapFrameDecode);
            }

            _syncObject    = _decoder.SyncObject;
            _createOptions = sourceBitmapFrameDecode._createOptions;
            _cacheOption   = sourceBitmapFrameDecode._cacheOption;
            _bitmapInit.EndInit();
        }
Example #2
0
        private void CopyCommon(BitmapFrameDecode sourceBitmapFrameDecode)
        {
            _bitmapInit.BeginInit(); 
            _frameNumber = sourceBitmapFrameDecode._frameNumber;
            _isThumbnailCached = sourceBitmapFrameDecode._isThumbnailCached; 
            _isMetadataCached = sourceBitmapFrameDecode._isMetadataCached; 
            _isColorContextCached = sourceBitmapFrameDecode._isColorContextCached;
            _frameSource = sourceBitmapFrameDecode._frameSource; 
            _thumbnail = sourceBitmapFrameDecode._thumbnail;
            _metadata = sourceBitmapFrameDecode.InternalMetadata;
            _readOnlycolorContexts = sourceBitmapFrameDecode._readOnlycolorContexts;
 
            _decoder = sourceBitmapFrameDecode._decoder;
            if (_decoder != null && _decoder.IsDownloading) 
            { 
                // UpdateDecoder must be called when download completes and the real decoder
                // is created. Normally _decoder will call UpdateDecoder, but in this case the 
                // decoder will not know about the cloned BitmapFrameDecode and will only call
                // UpdateDecoder on the original. The clone will need to listen to the original
                // BitmapFrameDecode for DownloadCompleted, then call UpdateDecoder on itself.
                // The weak event sink hooks up handlers on DownloadCompleted, DownloadFailed, 
                // and DownloadProgress
                _weakBitmapFrameDecodeEventSink = 
                    new WeakBitmapFrameDecodeEventSink(this, sourceBitmapFrameDecode); 
            }
 
            _syncObject = _decoder.SyncObject;
            _createOptions = sourceBitmapFrameDecode._createOptions;
            _cacheOption = sourceBitmapFrameDecode._cacheOption;
            _bitmapInit.EndInit(); 
        }