OSDN Git Service

optimize GC performance while creating keys for the BitmapText cache
authorvoid65536@googlemail.com <void65536@googlemail.com@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Wed, 19 Oct 2011 01:10:49 +0000 (01:10 +0000)
committervoid65536@googlemail.com <void65536@googlemail.com@75d07b2b-3a1a-0410-a2c5-0572b91ccdca>
Wed, 19 Oct 2011 01:10:49 +0000 (01:10 +0000)
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@8459 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

engine/src/niftygui/com/jme3/niftygui/RenderDeviceJme.java

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