예제 #1
0
        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));
        }
예제 #2
0
        /// <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();
        }
예제 #3
0
        /// <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();
        }
예제 #4
0
 /// <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]);
 }
예제 #5
0
 /// <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]);
 }
예제 #6
0
        /// <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();
        }
예제 #7
0
        /// <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();
        }
예제 #8
0
 /// <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];
 }
예제 #9
0
 /// <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];
 }
예제 #10
0
        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));
        }