public SpriteLease Borrow(SpriteKey key, int length, object caller) { lock (_syncRoot) { if (!_sprites.ContainsKey(key)) { _sprites[key] = new MultiSprite(key); } var entry = _sprites[key]; return(entry.Grow(length, caller)); } }
public SpriteLease Borrow(SpriteKey key, int length, object caller) { if (length <= 0) { throw new ArgumentOutOfRangeException(nameof(length)); } lock (_syncRoot) { if (!_sprites.ContainsKey(key)) { _sprites[key] = new MultiSprite(key); } var entry = _sprites[key]; return(entry.Grow(length, caller)); } }
public SpriteLease Borrow(SpriteKey key, int length, object caller) { if (length <= 0) { throw new ArgumentOutOfRangeException(nameof(length)); } lock (_syncRoot) { if (!_sprites.TryGetValue(key, out var entry)) { entry = new MultiSprite(key); Resolve <IEngine>()?.RegisterRenderable(entry); _sprites[key] = entry; } return(entry.Grow(length, caller)); } }
// Should only be created by MultiSprite internal SpriteLease(MultiSprite sprite, int @from, int to) { _sprite = sprite; From = @from; To = to; }
public WeakSpriteReference(MultiSprite multiSprite, SpriteLease lease, int offset) { _multiSprite = multiSprite; _lease = new WeakReference <SpriteLease>(lease); _offset = offset; }
public SpriteShaderKey(MultiSprite sprite) : this( sprite.Key.Texture.ArrayLayers > 1, !sprite.Key.Flags.HasFlag(SpriteKeyFlags.NoDepthTest), sprite.Key.Texture is EightBitTexture) { }