public DefaultGlyph(org.xwt.Font f, char c) { super(f, c); }
public Picture getPicture() {
if (p == null && isLoaded) {
- p = createPicture(null);
+ Picture p = createPicture(null);
p.data = new int[data.length];
for(int i=0; i<data.length; i++) p.data[i] = (data[i] & 0xff) << 24;
- data = null;
+ this.data = null;
p.width = this.width;
p.height = this.height;
+ p.isLoaded = true;
+ this.p = p;
}
return p;
}
protected static Queue runnable = new Queue(50);
public void defaultRun() {
- while(true) {
+ try {while(true) {
currentTask = (Task)runnable.remove(true);
try {
synchronized(this) {
Log.info(Scheduler.class, e);
}
// if an Error is thrown it will cause the engine to quit
+} } catch (Throwable t) {
+ t.printStackTrace();
}
}
}
import gnu.gcj.RawData;
import org.xwt.util.*;
+import org.xwt.js.*;
import org.xwt.*;
import java.util.*;
else
return /*new QZCarbonSufrace(b,framed)*/ null;
}
- protected Picture _createPicture() {
+ protected Picture _createPicture(JS r) {
if(openGL != null)
- return openGL._createPicture(true);
+ return openGL._createPicture(r, true);
else
return /*new QZCarbonPicture(data,w,h);*/ null;
}
package org.xwt.plat;
import org.xwt.*;
+import org.xwt.js.*;
import org.xwt.util.*;
abstract class OpenGL {
return oglp.realPicture;
}
- public Picture _createPicture(boolean alphaOnly) { return new OpenGLPicture(alphaOnly); }
+ public Picture _createPicture(JS r, boolean alphaOnly) { return new OpenGLPicture(r, alphaOnly); }
public static class OpenGLPicture extends Picture {
- public OpenGLPicture(boolean a) { alphaOnly = a; }
+ public OpenGLPicture(JS r, boolean a) { super(r); alphaOnly = a; }
boolean alphaOnly;
GLPicture realPicture = null;
}
public OpenGLGlyph(org.xwt.Font f, char c) { super(f, c); }
Picture getPicture() {
if (p == null && isLoaded) {
- p = new OpenGLPicture(true);
+ p = new OpenGLPicture(null, true);
p.data = new int[data.length];
for(int i=0; i<data.length; i++) p.data[i] = (data[i] & 0xff) << 24;
data = null;
import org.xwt.*;
import org.xwt.util.*;
import java.util.*;
+import org.xwt.js.*;
import java.io.*;
/** Platform specific code for GCJ-compiled Win32 binaries */
protected String getDescriptiveName() { return "GCJ Win32 Binary"; }
protected Surface _createSurface(Box b, boolean framed) { return new Win32Surface(b, framed); }
protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { return new Win32PixelBuffer(w, h, (Win32Surface)owner); }
- protected Picture _createPicture() { return new Win32Picture(); }
+ protected Picture _createPicture(JS r) { return new Win32Picture(r); }
protected native int _getScreenWidth();
protected native int _getScreenHeight();
protected boolean _supressDirtyOnResize() { return false; }
public static class Win32Picture extends Picture {
int w = 0, h = 0;
- int[] data = null;
/** the Win32 bitmap version of this Picture */
int hbitmap = -1;
/** dc of the mask */
int maskdc = -1;
+ public Win32Picture(JS r) { super(r); }
public int getWidth() { return w; };
public int getHeight() { return h; };
public int[] getData() { return data; }
int source_green = (sourcepixel & 0x0000FF00) >> 8;
int source_blue = (sourcepixel & 0x000000FF);
int red = 0, blue = 0, green = 0;
-
+ int targetpixel;
if (alpha == 0x00) continue;
if (alpha != 0xFF) {
- int targetpixel;
switch (xi->bits_per_pixel) {
case 8: targetpixel = (int)(*current_pixel); break;
+ case 15:
case 16: targetpixel = (int)(*((uint16_t*)current_pixel)); break;
- case 24: targetpixel = (((int)*current_pixel) << 16) | (((int)*(current_pixel + 1)) << 8) | (((int)*(current_pixel + 2))); break;
+
+ // FIXME assumes endianness...
+ case 24: targetpixel =
+ (((int)*current_pixel) << 16) |
+ (((int)*(current_pixel + 1)) << 8) |
+ (((int)*(current_pixel + 2))); break;
case 32: targetpixel = *((int*)current_pixel); break;
default: org::xwt::Platform::criticalAbort(JvNewStringLatin1("ERROR: bpp not a multiple of 8!"));
}
-
targetpixel -= colormap_info->base_pixel;
-
+
// if you're on some wierd display that isn't either RGB or BGR, that's your problem, not mine
if (colormap_info->red_mult > colormap_info->green_mult && colormap_info->green_mult > colormap_info->blue_mult) {
red = targetpixel / colormap_info->red_mult;
green = (targetpixel - red * colormap_info->red_mult) / colormap_info->green_mult;
- blue = (targetpixel - red * colormap_info->red_mult - green * colormap_info->green_mult) / colormap_info->blue_mult;
+ blue = (targetpixel-red * colormap_info->red_mult-green * colormap_info->green_mult)/colormap_info->blue_mult;
} else {
blue = targetpixel / colormap_info->blue_mult;
green = (targetpixel - blue * colormap_info->blue_mult) / colormap_info->green_mult;
- red = (targetpixel - blue * colormap_info->blue_mult - green * colormap_info->green_mult) / colormap_info->red_mult;
+ red = (targetpixel-blue * colormap_info->blue_mult-green * colormap_info->green_mult)/colormap_info->red_mult;
}
}
-
- red = ((source_red * colormap_info->red_max * alpha) + (red * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
- green = ((source_green * colormap_info->green_max * alpha) + (green * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
- blue = ((source_blue * colormap_info->blue_max * alpha) + (blue * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
- uint32_t destpixel = red * colormap_info->red_mult + green * colormap_info->green_mult +
- blue * colormap_info->blue_mult + colormap_info->base_pixel;
-
+ red = ((source_red * (colormap_info->red_max) * alpha) + (red * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
+ green = ((source_green * (colormap_info->green_max) * alpha)+(green * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
+ blue = ((source_blue * (colormap_info->blue_max) * alpha) + (blue * 0xFF * (0xFF - alpha))) / (0xFF * 0xFF);
+ uint32_t destpixel =
+ (red * colormap_info->red_mult) +
+ (green * colormap_info->green_mult) +
+ (blue * colormap_info->blue_mult) +
+ colormap_info->base_pixel;
switch (xi->bits_per_pixel) {
case 8: *current_pixel = (char)(destpixel & 0xFF); break;
case 16: *((uint16_t*)current_pixel) = (uint16_t)destpixel; break;
import java.lang.reflect.*;
import java.io.*;
import java.util.*;
+import org.xwt.js.*;
import org.xwt.util.*;
import org.xwt.*;
protected String _getAltKeyName() { return System.getProperty("os.name", "").indexOf("SunOS") != -1 ? "Meta" : "Alt"; }
- protected Picture _createPicture() { return new X11Picture(); }
+ protected Picture _createPicture(JS r) { return new X11Picture(r); }
protected PixelBuffer _createPixelBuffer(int w, int h, Surface owner) { return new X11PixelBuffer(w, h); }
protected Surface _createSurface(Box b, boolean framed) { return new X11Surface(b, framed); }
protected boolean _needsAutoClick() { return true; }
*/
public static class X11Picture extends Picture {
- int width;
- int height;
- int[] data = null;
public X11PixelBuffer doublebuf = null;
public int getWidth() { return width; }
public int getHeight() { return height; }
boolean initialized = false;
+ public X11Picture(JS r) { super(r); }
public void init() {
if (initialized) return;
initialized = true;
cx2 = Math.min(dx + source.width, cx2);
cy2 = Math.min(dy + source.height, cy2);
if (cx1 >= cx2 || cy1 >= cy2) return;
- slowDrawPicture(((Platform.DefaultGlyph)source).getPicture(), dx, dy, cx1, cy1, cx2, cy2, rgb, true);
+ X11Picture pic = (X11Picture)((Platform.DefaultGlyph)source).getPicture();
+ pic.init();
+ slowDrawPicture(pic, dx, dy, cx1, cy1, cx2, cy2, rgb, true);
}
public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
cx1 = Math.max(dx, cx1);
glyph.data = new byte[glyph.width * glyph.height];
int addr = vm.getUserInfo(5);
vm.copyin(addr, glyph.data, glyph.width * glyph.height);
+ glyph.isLoaded = true;
} catch (Exception e) {
Log.info(this, e);