if (g.p == null) {
glyphsToBeRendered.prepend(g);
encounteredUnrenderedGlyph = true;
- } else {
+ } else if (!encounteredUnrenderedGlyph) {
if (pb != null && g.p != null)
pb.drawPictureAlphaOnly(g.p, x + width, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor);
width += g.advance;
}
callback.perform();
}});
- if (!latinCharsPreloaded) for(int i=32; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ if (!latinCharsPreloaded) {
+ for(int i=48; i<57; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ for(int i=32; i<47; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ for(int i=57; i<128; i++) glyphsToBeRendered.append(glyphs[i] = new Glyph((char)i, this));
+ }
if (!latinCharsPreloaded || encounteredUnrenderedGlyph) Scheduler.add(glyphRenderingTask);
latinCharsPreloaded = true;
return ((((long)width) << 32) | (long)(height & 0xffffffffL));
Picture.fromRes((Res)Main.builtin.get("org/xwt/builtin/scar.png"),
new Scheduler.Task() { public void perform() {
scarImage = scarHolder.picture;
- Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new BoxTree(), xwt);
+ Template.getTemplate(((Res)final_rr.get(initialTemplate))).apply(new Box(), xwt);
} });
new Thread() { public void run() { Scheduler.init(); } }.start();
// Disable 2d hardware acceleration on Jaguar
if (os_name.equals("Mac OS X") && os_version.startsWith("10.2")) System.setProperty("com.apple.hwaccel", "false");
*/
+ System.setProperty("com.apple.hwaccel", "true");
if (platform_class != null) {
platform = (Platform)Class.forName("org.xwt.plat." + platform_class).newInstance();
PerInstantiationJSScope pis = new PerInstantiationJSScope(b, xwt, parentPis, staticJSScope);
for (int i=0; children != null && i<children.size(); i++) {
- Box kid = new BoxTree();
+ Box kid = new Box();
((Template)children.elementAt(i)).apply(kid, xwt, pis);
b.putAndTriggerJSTraps(JS.N(b.numchildren), kid);
}
case "string": return xwtString;
case "date": return METHOD;
case "origin": return Main.origin;
- case "box": return new BoxTree();
+ case "box": return new Box();
case "log": return new Sub("log");
case "ui": return new Sub("ui");
case "thread": return new Sub("thread");
private static int[] ibank = null;
private static byte[] bbank = null;
private static int bank_start = 0;
+ private WritableRaster raster = null;
+ private SampleModel sm = null;
+ private DataBuffer buf = null;
+
+ public void drawPictureAlphaOnly(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+ AWTPicture src = (AWTPicture)source;
+ Graphics2D g2 = (Graphics2D)i.getGraphics();
+ g2.setComposite(AlphaComposite.DstOut);
+ g2.setClip(cx1, cy1, cx2 - cx1, cy2 - cy1);
+ g2.drawImage(src.i, dx, dy, null);
+ g2.setComposite(AlphaComposite.DstOver);
+ g2.setColor(new Color((rgb & 0x00FF0000) >> 16, (rgb & 0x0000FF00) >> 8, (rgb & 0x000000FF)));
+ g2.fillRect(dx, dy, cx2 - dx, cy2 - dy);
+ g2.drawImage(i, 0, 0, null);
+ g2.setClip(0, 0, i.getWidth(null), i.getHeight(null));
+ }
public Java2PixelBuffer(int w, int h) {
- SampleModel sm = cm.createCompatibleSampleModel(w, h);
+ sm = cm.createCompatibleSampleModel(w, h);
int numSamples = w * h * sm.getNumDataElements();
- DataBuffer buf = null;
if (sm.getDataType() == DataBuffer.TYPE_USHORT) {
if (sbank == null || numSamples > 512 * 512 / 3) {
buf = new DataBufferUShort(numSamples);
bank_start += numSamples;
}
}
- i = new BufferedImage(cm, Raster.createWritableRaster(sm, buf, null), false, emptyHashtable);
+ raster = Raster.createWritableRaster(sm, buf, null);
+ i = new BufferedImage(cm, raster, false, emptyHashtable);
g = i.getGraphics();
}
}