瀏覽代碼

optimize GC performance while creating keys for the BitmapText cache

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8459 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
voi..om 14 年之前
父節點
當前提交
a824f45efb
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java

+ 3 - 2
engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java

@@ -195,13 +195,14 @@ public class RenderDeviceJme implements RenderDevice {
 
         RenderFontJme jmeFont = (RenderFontJme) font;
         
-        BitmapText text = textCacheLastFrame.get(font+str+color);
+        String key = font+str+color.getColorString();
+        BitmapText text = textCacheLastFrame.get(key);
         if (text == null) {
             text = jmeFont.createText();
             text.setText(str);
             text.updateLogicalState(0);
         }
-        textCacheCurrentFrame.put(font+str+color, text);
+        textCacheCurrentFrame.put(key, text);
 
         niftyMat.setColor("Color", convertColor(color, tempColor));
         niftyMat.setBoolean("UseTex", true);