コード例 #1
0
ファイル: pText.cs プロジェクト: notperry1234567890/osu
 internal override void Dispose(bool isDisposing)
 {
     if (aggressiveCleanup)
     {
         DynamicSpriteCache.Remove(this);
     }
     base.Dispose(isDisposing);
 }
コード例 #2
0
ファイル: pText.cs プロジェクト: notperry1234567890/osu
        protected virtual pTexture refreshTexture()
        {
            bool existed = false;

            pTexture old = localTexture;

            TextChanged = false;

            if (string.IsNullOrEmpty(Text) && TextBounds.X == 0)
            {
                lastMeasure = TextBounds;
                return(null);
            }

            renderingResolution = GameBase.WindowManager.Height;

            float   size   = (TextRenderSpecific ? (float)GameBase.WindowManager.Height / 768 : 1) * TextSize;
            Vector2 bounds = (TextRenderSpecific ? GameBase.WindowManager.Ratio : 1) * TextBounds;

            Vector4 corners = CornerBounds;
            Vector2 padding = Padding;

            if (corners != Vector4.Zero && TextRenderSpecific)
            {
                corners *= (float)GameBase.WindowManager.Height / 768;
            }

            if (Padding != Vector2.Zero)
            {
                padding *= (float)GameBase.WindowManager.Height / 768;
            }

            float borderWidth = BorderWidth;

            if (borderWidth > 0)
            {
                borderWidth *= (float)GameBase.WindowManager.Height / 768;
            }

            System.Drawing.RectangleF[] regions;
            localTexture = NativeText.CreateText(Text, size, bounds, TextColour, Shadow, TextBold, TextItalic, TextUnderline, TextAlignment,
                                                 TextAa, out lastMeasure, out regions, BackgroundColour, BorderColour, (int)Math.Round(borderWidth), false, false, fontFace, corners, padding, localTexture);

            if (old != null && localTexture != old)
            {
                old.Dispose();
            }

            if (aggressiveCleanup)
            {
                if (localTexture != null)
                {
                    localTexture.TrackAccessTime = true;
                }
                if (old != localTexture)
                {
                    DynamicSpriteCache.Load(this, true);
                }
            }

            DrawWidth  = (int)Math.Round(lastMeasure.X);
            DrawHeight = (int)Math.Round(lastMeasure.Y);

            UpdateTextureSize();
            UpdateTextureAlignment();

            if (OnRefreshTexture != null)
            {
                OnRefreshTexture(this, null);
            }

            return(localTexture);
        }
コード例 #3
0
 internal override void Dispose(bool isDisposing)
 {
     DynamicSpriteCache.Remove(this);
     base.Dispose(isDisposing);
 }