This commit is contained in:
Denis Molony 2020-03-30 19:18:31 +10:00
parent 20055db2d5
commit 538ef50d45

View File

@ -37,21 +37,16 @@ public class DoubleHiResImage extends HiResImage
{ {
packedBuffer = buffer; packedBuffer = buffer;
doubleScrunch = new DoubleScrunch (buffer); doubleScrunch = new DoubleScrunch (buffer);
// doubleScrunch.unscrunch (buffer);
auxBuffer = doubleScrunch.memory[0]; auxBuffer = doubleScrunch.memory[0];
this.buffer = doubleScrunch.memory[1]; this.buffer = doubleScrunch.memory[1];
} }
else //if (name.endsWith (".A2FC") || auxType == 0x2000) else
{ {
auxBuffer = new byte[0x2000]; auxBuffer = new byte[0x2000];
this.buffer = new byte[0x2000]; this.buffer = new byte[0x2000];
System.arraycopy (buffer, 0, auxBuffer, 0, 0x2000); System.arraycopy (buffer, 0, auxBuffer, 0, 0x2000);
System.arraycopy (buffer, 0x2000, this.buffer, 0, 0x2000); System.arraycopy (buffer, 0x2000, this.buffer, 0, 0x2000);
} }
// else
// {
// auxBuffer = null;
// }
createImage (); createImage ();
} }
@ -62,7 +57,10 @@ public class DoubleHiResImage extends HiResImage
// ---------------------------------------------------------------------------------// // ---------------------------------------------------------------------------------//
{ {
// image will be doubled vertically // image will be doubled vertically
image = new BufferedImage (560, 192 * 2, BufferedImage.TYPE_BYTE_GRAY); int WIDTH = 280 * 2;
int HEIGHT = 192 * 2;
image = new BufferedImage (WIDTH, HEIGHT, BufferedImage.TYPE_BYTE_GRAY);
DataBuffer dataBuffer = image.getRaster ().getDataBuffer (); DataBuffer dataBuffer = image.getRaster ().getDataBuffer ();
int ndx = 0; int ndx = 0;
@ -81,11 +79,11 @@ public class DoubleHiResImage extends HiResImage
int val = (value >> px) & 0x01; int val = (value >> px) & 0x01;
int pixel = val == 0 ? 0 : 255; int pixel = val == 0 ? 0 : 255;
dataBuffer.setElem (ndx, pixel); dataBuffer.setElem (ndx, pixel);
dataBuffer.setElem (ndx + 560, pixel); // repeat pixel one line on dataBuffer.setElem (ndx + WIDTH, pixel); // repeat pixel one line on
++ndx; ++ndx;
} }
} }
ndx += 560; // skip past repeated line ndx += WIDTH; // skip past repeated line
} }
} }
@ -116,7 +114,7 @@ public class DoubleHiResImage extends HiResImage
| ((auxBuffer[ptr + 1] & 0x7F) << 14) | ((buffer[ptr + 1] & 0x7F) << 21); | ((auxBuffer[ptr + 1] & 0x7F) << 14) | ((buffer[ptr + 1] & 0x7F) << 21);
for (int px = 0; px < 28; px += 4) for (int px = 0; px < 28; px += 4)
{ {
int val = (value >> px) & 0x0F; int val = (value >>> px) & 0x0F;
int val2 = swap[val]; int val2 = swap[val];
dataBuffer.setElem (ndx++, colours[val2]); dataBuffer.setElem (ndx++, colours[val2]);
dataBuffer.setElem (ndx++, colours[val2]); // repeat pixel dataBuffer.setElem (ndx++, colours[val2]); // repeat pixel