2003/11/16 02:40:45
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:27 +0000 (07:41 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:41:27 +0000 (07:41 +0000)
darcs-hash:20040130074127-2ba56-2e3720161209c77ab4e6ebfc47392a1f6ca9a691.gz

src/org/xwt/plat/X11.java
src/org/xwt/translators/Freetype.java
src/org/xwt/util/Preprocessor.java

index 0347c54..094e14f 100644 (file)
@@ -201,7 +201,7 @@ public class X11 extends POSIX {
         public native void finalize();
 
         // FIXME: try to use os acceleration
-        public void fillJSTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
+        public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
             if (x1 == x3 && x2 == x4) {
                 fillRect(x1, y1, x4, y2, argb);
             } else for(int y=y1; y<y2; y++) {
index ed52857..0726fda 100644 (file)
@@ -43,6 +43,7 @@ public class Freetype {
         int height = 0;
         byte[] data = null;
         File cacheFile = null;
+        /*
         try {
             String key = glyph.font.res.getCacheKey() + ":" + glyph.c;
             key = new String(Base64.encode(key.getBytes()));
@@ -56,7 +57,7 @@ public class Freetype {
         } catch (Res.NotCacheableException e) {
             Log.log(Freetype.class, "note: glyph not cacheable");
         }
-
+        */
         if (cacheFile != null && cacheFile.exists()) {
             DataInputStream dis = new DataInputStream(new FileInputStream(cacheFile));
             width = dis.readInt();
@@ -69,7 +70,7 @@ public class Freetype {
             if (width != 0 && height != 0) dis.readFully(data);
             
         } else try {
-            System.out.println("cache miss!");
+            //System.out.println("cache miss!");
             if (loadedStream != glyph.font.res) loadFontByteStream(glyph.font.res);
             vm.setUserInfo(2, (int)glyph.c);
             vm.setUserInfo(3, (int)glyph.c);
@@ -87,17 +88,19 @@ public class Freetype {
             data = new byte[width * height];
             int addr = vm.getUserInfo(5);
             vm.copyin(addr,data,width*height);
-            File tmp = new File(cacheFile.getCanonicalPath() + ".tmp");
-            DataOutputStream dis = new DataOutputStream(new FileOutputStream(tmp));
-            dis.writeInt(width);
-            dis.writeInt(height);
-            dis.writeInt(glyph.font.max_ascent);
-            dis.writeInt(glyph.font.max_descent);
-            dis.writeInt(glyph.baseline);
-            dis.writeInt(glyph.advance);
-            if (width != 0 && height != 0) dis.write(data, 0, data.length);
-            dis.close();
-            tmp.renameTo(cacheFile);
+            if (cacheFile != null) {
+                File tmp = new File(cacheFile.getCanonicalPath() + ".tmp");
+                DataOutputStream dis = new DataOutputStream(new FileOutputStream(tmp));
+                dis.writeInt(width);
+                dis.writeInt(height);
+                dis.writeInt(glyph.font.max_ascent);
+                dis.writeInt(glyph.font.max_descent);
+                dis.writeInt(glyph.baseline);
+                dis.writeInt(glyph.advance);
+                if (width != 0 && height != 0) dis.write(data, 0, data.length);
+                dis.close();
+                tmp.renameTo(cacheFile);
+            }
 
         } catch (Exception e) {
             Log.log(this, e);
index 5cff2d0..cc6d34d 100644 (file)
@@ -122,7 +122,7 @@ PROCESS:
                 while(trimmed.charAt(trimmed.length() - 1) == '\\') {
                     String s2 = in.readLine().trim();
                     if (s2.startsWith("//")) s2 = s2.substring(2).trim();
-                    trimmed += s2;
+                    trimmed = trimmed.substring(0, trimmed.length() - 1) + " " + s2;
                     out.println();  // preserve line numbers
                 }
                 StringTokenizer st = new StringTokenizer(trimmed, " ");