Ejemplo n.º 1
0
 public BitmapCacheItem this[Fragment f]
 {
     get {
         if (IsCached(f)) {
             return fragmentsWithCache[f];
         } else {
             return null;
         }
     }
 }
Ejemplo n.º 2
0
        public void ExtendRoot()
        {
            Fragment newRoot = new Fragment(root.Depth - 1);
            newRoot.MakeChilds();
            newRoot.ChildLT.ChildRB = Root.ChildLT;
            newRoot.ChildRT.ChildLB = Root.ChildRT;
            newRoot.ChildLB.ChildRT = Root.ChildLB;
            newRoot.ChildRB.ChildLT = Root.ChildRB;

            root = newRoot;
            size *= 2;
        }
Ejemplo n.º 3
0
        public BitmapCacheItem AllocateCache(Fragment f)
        {
            if (IsCached(f)) {
                return fragmentsWithCache[f];
            } else {
                // Take item from head and put it at tail
                BitmapCacheItem item = caches.First.Value;
                caches.RemoveFirst();
                caches.AddLast(item);

                // Allocate the item to freagment
                if (item.Owner != null) {
                    ReleaseCache(item.Owner);
                }
                item.Owner = f;
                fragmentsWithCache[f] = item;

                return item;
            }
        }
Ejemplo n.º 4
0
 BitmapCacheItem UpdateBitmap(Fragment f)
 {
     if (bitmapCache.IsCached(f)) {
         return bitmapCache[f];
     } else {
         BitmapCacheItem c = bitmapCache.AllocateCache(f);
         UpdateTexture(c.Texture, c.X, c.Y, f.MakeImage(fractal.ColorMap));
         return c;
     }
 }
Ejemplo n.º 5
0
 public void MakeChilds()
 {
     if (!HasAllChilds) {
         childLT = new Fragment(depth + 1);
         childRT = new Fragment(depth + 1);
         childLB = new Fragment(depth + 1);
         childRB = new Fragment(depth + 1);
     }
 }
Ejemplo n.º 6
0
 public void ReleaseCache(Fragment f)
 {
     if (IsCached(f)) {
         fragmentsWithCache[f].Owner = null;
         fragmentsWithCache.Remove(f);
     }
 }
Ejemplo n.º 7
0
 public bool IsCached(Fragment f)
 {
     return fragmentsWithCache.ContainsKey(f);
 }