Exemplo n.º 1
0
        /// <summary>
        /// Add source of masks for drawing.
        /// </summary>
        public void AddSource(ICubismMaskTextureCommandSource source)
        {
            // Make sure isstance is valid.
            TryRevive();


            // Initialize container if necessary.
            if (Sources == null)
            {
                Sources = new List <SourcesItem>();
            }


            // Return early if source already exists.
            else if (Sources.FindIndex(i => i.Source == source) != -1)
            {
                return;
            }


            // Register source.
            var item = new SourcesItem
            {
                Source = source,
                Tiles  = TilePool.AcquireTiles(source.GetNecessaryTileCount())
            };


            Sources.Add(item);


            // Apply tiles to source.
            source.SetTiles(item.Tiles);
        }
Exemplo n.º 2
0
        private void ReinitializeSources()
        {
            // Reallocate tiles if sources exist.
            if (ContainsSources)
            {
                for (var i = 0; i < Sources.Count; ++i)
                {
                    var source = Sources[i];


                    source.Tiles = TilePool.AcquireTiles(source.Source.GetNecessaryTileCount());

                    source.Source.SetTiles(source.Tiles);


                    Sources[i] = source;
                }
            }
        }