Use a 4 bit buffer
parent
6f8a7b0534
commit
ebce52ea13
|
|
@ -10,6 +10,36 @@ var endPerfLog = () => {};
|
||||||
var printPerfLog = () => print("Deactivated");
|
var printPerfLog = () => print("Deactivated");
|
||||||
var resetPerfLog = () => {performanceLog = {};};
|
var resetPerfLog = () => {performanceLog = {};};
|
||||||
|
|
||||||
|
var colormap={
|
||||||
|
"#000":0,
|
||||||
|
"#00f":1,
|
||||||
|
"#0f0":2,
|
||||||
|
"#0ff":3,
|
||||||
|
"#f00":4,
|
||||||
|
"#f0f":5,
|
||||||
|
"#ff0":6,
|
||||||
|
"#fff":7
|
||||||
|
};
|
||||||
|
|
||||||
|
var palette = new Uint16Array([
|
||||||
|
0x0000, //black #000
|
||||||
|
0x001f, //blue #00f
|
||||||
|
0x07e0, //green #0f0
|
||||||
|
0x07ff, //cyan #0ff
|
||||||
|
0xf800, //red #f00
|
||||||
|
0xf81f, //magenta #f0f
|
||||||
|
0xffe0, //yellow #ff0
|
||||||
|
0xffff, //white #fff
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
0xffff, //white
|
||||||
|
])
|
||||||
|
|
||||||
var p0 = g;
|
var p0 = g;
|
||||||
var p1;
|
var p1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -621,7 +621,7 @@
|
||||||
var lastSetColor;
|
var lastSetColor;
|
||||||
var lastSetBgColor;
|
var lastSetBgColor;
|
||||||
|
|
||||||
if (plane != 0) code += "if (!p" + plane + ") p" + plane + " = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),16,{msb:true});\n";
|
if (plane != 0) code += "if (!p" + plane + ") p" + plane + " = Graphics.createArrayBuffer(g.getWidth(),g.getHeight(),4,{msb:true});\n";
|
||||||
|
|
||||||
if (properties.Redraw && properties.Redraw.Clear){
|
if (properties.Redraw && properties.Redraw.Clear){
|
||||||
if (wrapInTimeouts && plane != 0){
|
if (wrapInTimeouts && plane != 0){
|
||||||
|
|
@ -646,7 +646,7 @@
|
||||||
|
|
||||||
if (addDebug()) code += 'print("Copying of plane ' + previousPlane + ' to display");'+"\n";
|
if (addDebug()) code += 'print("Copying of plane ' + previousPlane + ' to display");'+"\n";
|
||||||
//code += "g.drawImage(p" + i + ".asImage());";
|
//code += "g.drawImage(p" + i + ".asImage());";
|
||||||
code += "p0.drawImage({width: p" + previousPlane + ".getWidth(), height: p" + previousPlane + ".getHeight(), bpp: p" + previousPlane + ".getBPP(), buffer: p" + previousPlane + ".buffer});\n";
|
code += "p0.drawImage({width: p" + previousPlane + ".getWidth(), height: p" + previousPlane + ".getHeight(), bpp: p" + previousPlane + ".getBPP(), buffer: p" + previousPlane + ".buffer, palette: palette});\n";
|
||||||
|
|
||||||
|
|
||||||
code += "drawingTime += Date.now() - ct;\n";
|
code += "drawingTime += Date.now() - ct;\n";
|
||||||
|
|
@ -716,10 +716,16 @@
|
||||||
var colorsetting = "";
|
var colorsetting = "";
|
||||||
if (c.value.ForegroundColor && lastSetColor != c.value.ForegroundColor){
|
if (c.value.ForegroundColor && lastSetColor != c.value.ForegroundColor){
|
||||||
lastSetColor = c.value.ForegroundColor;
|
lastSetColor = c.value.ForegroundColor;
|
||||||
|
if (plane > 0)
|
||||||
|
colorsetting += planeName + ".setColor(colormap[\"" + c.value.ForegroundColor + "\"]);\n";
|
||||||
|
else
|
||||||
colorsetting += planeName + ".setColor(\"" + c.value.ForegroundColor + "\");\n";
|
colorsetting += planeName + ".setColor(\"" + c.value.ForegroundColor + "\");\n";
|
||||||
}
|
}
|
||||||
if (c.value.BackgroundColor && lastSetBgColor != c.value.BackgroundColor){
|
if (c.value.BackgroundColor && lastSetBgColor != c.value.BackgroundColor){
|
||||||
lastSetBgColor = c.value.BackgroundColor;
|
lastSetBgColor = c.value.BackgroundColor;
|
||||||
|
if (plane > 0)
|
||||||
|
colorsetting += planeName + ".setBgColor(colormap[\"" + c.value.BackgroundColor + "\"]);\n";
|
||||||
|
else
|
||||||
colorsetting += planeName + ".setBgColor(\"" + c.value.BackgroundColor + "\");\n";
|
colorsetting += planeName + ".setBgColor(\"" + c.value.BackgroundColor + "\");\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue