瀏覽代碼

Nifty RenderDeviceJme Bugfix: When we cache BitmapText instances to speed up text rendering we need to make sure that we take the font and the color into account as well! When we cache BitmapText instances only using the actual "text" it is possible that the exact same text - when it is rendered in different fonts - will be used from the cache (and then using the wrong font!) This has now been fixed.

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

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

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