void AssertSaneDrawTilingAmount(int min, int max, float spriteSize, ControlBorderSpriteType side) { const string errmsg = "Too many draw calls being made to draw the ControlBorder `{0}` on side `{1}` - performance will suffer." + " Either use a larger sprite, or use ControlBorderDrawStyle.Stretch instead of ControlBorderDrawStyle.Tile." + " This may also be an indication that you are using ControlBorderDrawStyle.Tile unintentionally."; var drawCalls = (int)((max - min) / spriteSize); if (drawCalls <= _maxDrawCallsBeforeDebugWarning) { return; } if (log.IsWarnEnabled) { log.WarnFormat(errmsg, this, side); } Debug.Fail(string.Format(errmsg, this, side)); }
/// <summary> /// Gets the <see cref="ISprite"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <param name="value">The <see cref="ISprite"/> to assign to the <paramref name="spriteType"/>.</param> public void SetSprite(ControlBorderSpriteType spriteType, ISprite value) { _sprites[(int)spriteType] = value; UpdateCanDraw(); }
/// <summary> /// Gets the <see cref="ISprite"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <param name="value">The <see cref="ControlBorderDrawStyle"/> to assign to the <paramref name="spriteType"/>.</param> public void SetDrawStyle(ControlBorderSpriteType spriteType, ControlBorderDrawStyle value) { _drawStyles[(int)spriteType] = value; UpdateCanDraw(); }
/// <summary> /// Gets the <see cref="ISprite"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <returns>The <see cref="ISprite"/> for the <paramref name="spriteType"/>.</returns> public ISprite GetSprite(ControlBorderSpriteType spriteType) { return(_sprites[(int)spriteType]); }
/// <summary> /// Gets the <see cref="ControlBorderDrawStyle"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <returns>The <see cref="ControlBorderDrawStyle"/> for the <paramref name="spriteType"/>.</returns> public ControlBorderDrawStyle GetDrawStyle(ControlBorderSpriteType spriteType) { return(_drawStyles[(int)spriteType]); }
/// <summary> /// Gets the <see cref="ISprite"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <returns>The <see cref="ISprite"/> for the <paramref name="spriteType"/>.</returns> public ISprite GetSprite(ControlBorderSpriteType spriteType) { return _sprites[(int)spriteType]; }
/// <summary> /// Gets the <see cref="ControlBorderDrawStyle"/> for the given <see cref="ControlBorderSpriteType"/>. /// </summary> /// <param name="spriteType">The type of <see cref="ControlBorderSpriteType"/>.</param> /// <returns>The <see cref="ControlBorderDrawStyle"/> for the <paramref name="spriteType"/>.</returns> public ControlBorderDrawStyle GetDrawStyle(ControlBorderSpriteType spriteType) { return _drawStyles[(int)spriteType]; }
void AssertSaneDrawTilingAmount(int min, int max, float spriteSize, ControlBorderSpriteType side) { const string errmsg = "Too many draw calls being made to draw the ControlBorder `{0}` on side `{1}` - performance will suffer." + " Either use a larger sprite, or use ControlBorderDrawStyle.Stretch instead of ControlBorderDrawStyle.Tile." + " This may also be an indication that you are using ControlBorderDrawStyle.Tile unintentionally."; var drawCalls = (int)((max - min) / spriteSize); if (drawCalls <= _maxDrawCallsBeforeDebugWarning) return; if (log.IsWarnEnabled) log.WarnFormat(errmsg, this, side); Debug.Fail(string.Format(errmsg, this, side)); }