コード例 #1
0
ファイル: PtsContext.cs プロジェクト: JianwenSun/cc
        internal PtsContext(bool isOptimalParagraphEnabled, TextFormattingMode textFormattingMode)
        {
            _pages = new ArrayList(1);
            _pageBreakRecords = new ArrayList(1);
            _unmanagedHandles = new HandleIndex[_defaultHandlesCapacity]; // Limit initial size
            _isOptimalParagraphEnabled = isOptimalParagraphEnabled;

            BuildFreeList(1); // 1 is the first free index in UnmanagedHandles array

            // Acquire PTS Context
            _ptsHost = PtsCache.AcquireContext(this, textFormattingMode);
        }
コード例 #2
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <remarks>
        /// The array of entries initially can store up to 16 entries. Upon
        /// adding elements the capacity increased in multiples of two as
        /// required. The first element always contains index to the next
        /// free entry. All free entries are forming a linked list.
        /// </remarks>
        internal PtsContext(bool isOptimalParagraphEnabled, TextFormattingMode textFormattingMode)
        {
            _pages                     = new ArrayList(1);
            _pageBreakRecords          = new ArrayList(1);
            _unmanagedHandles          = new HandleIndex[_defaultHandlesCapacity]; // Limit initial size
            _isOptimalParagraphEnabled = isOptimalParagraphEnabled;

            BuildFreeList(1); // 1 is the first free index in UnmanagedHandles array

            // Acquire PTS Context
            _ptsHost = PtsCache.AcquireContext(this, textFormattingMode);
        }
コード例 #3
0
        /// <summary>
        /// Increases the capacity of the handle array.
        ///      new size = current size * 2
        /// </summary>
        private void Resize()
        {
            int freeIndex = _unmanagedHandles.Length;

            // Allocate new array and copy all existing entries into it
            HandleIndex[] newItems = new HandleIndex[_unmanagedHandles.Length * 2];
            Array.Copy(_unmanagedHandles, newItems, _unmanagedHandles.Length);
            _unmanagedHandles = newItems;

            // Build list of free entries
            BuildFreeList(freeIndex);
        }
コード例 #4
0
ファイル: PtsContext.cs プロジェクト: JianwenSun/cc
        /// <summary>
        /// Increases the capacity of the handle array.
        ///      new size = current size * 2
        /// </summary>
        private void Resize()
        {
            int freeIndex = _unmanagedHandles.Length;

            // Allocate new array and copy all existing entries into it
            HandleIndex[] newItems = new HandleIndex[_unmanagedHandles.Length * 2];
            Array.Copy(_unmanagedHandles, newItems, _unmanagedHandles.Length);
            _unmanagedHandles = newItems;

            // Build list of free entries
            BuildFreeList(freeIndex);
        }