added a constant

This commit is contained in:
Denis Molony 2020-03-29 17:21:30 +10:00
parent 32d1b5d07e
commit 1119ab40e5
2 changed files with 4 additions and 6 deletions

View File

@ -20,6 +20,7 @@ public abstract class HiResImage extends AbstractFile
"Super Hi-Res Image (Apple Preferred Format)", "Packed QuickDraw II PICT File",
"Packed Super Hi-Res 3200 color image" };
static final int COLOR_TABLE_SIZE = 32;
static final int COLOR_TABLE_OFFSET = 32000;
public static final int FADDEN_AUX = 0x8066;
// ---- ---- ------ -------------------------------------- ------------------------
@ -463,10 +464,6 @@ public abstract class HiResImage extends AbstractFile
int type = (buffer[ptr] & 0xC0) >>> 6; // 0-3
int count = (buffer[ptr++] & 0x3F) + 1; // 1-64
// if (ptr >= buffer.length) // needed for NAGELxx
// break;
// System.out.printf ("%3d %d %d %d%n", ptr, type, count, newPtr);
switch (type)
{
case 0:

View File

@ -171,11 +171,12 @@ public class SHRPictureFile2 extends HiResImage
failureReason = "Buffer should be 38,400 bytes";
return;
}
int maxTables = (buffer.length - 32000) / COLOR_TABLE_SIZE;
int maxTables = (buffer.length - COLOR_TABLE_OFFSET) / COLOR_TABLE_SIZE;
colorTables = new ColorTable[maxTables];
for (int i = 0; i < colorTables.length; i++)
{
colorTables[i] = new ColorTable (i, buffer, 32000 + i * COLOR_TABLE_SIZE);
colorTables[i] =
new ColorTable (i, buffer, COLOR_TABLE_OFFSET + i * COLOR_TABLE_SIZE);
colorTables[i].reverse ();
}
break;