hiti: Theoretically support job combining with 2x6 strips

This commit is contained in:
Solomon Peachy 2024-08-21 13:20:26 -04:00
parent 95607d4cf8
commit 9190a17433

View file

@ -280,6 +280,9 @@ struct hiti_jc_qjc {
#define PRINT_TYPE_6x4_2UP 9
#define PRINT_TYPE_6x2 10
#define PRINT_TYPE_5x7_2UP 11
#define PRINT_TYPE_6x4_3UP 16 // ("4x6-split_3up")
#define PRINT_TYPE_6x9_4UP 17 // ("6x9-2up2split")
#define PRINT_TYPE_6x9_6UP 24 // ("6x9-2up3split")
#define PRINT_TYPE_6x5 20
#define PRINT_TYPE_6x6 21
@ -2134,6 +2137,7 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
case RIBBON_TYPE_4x6:
if (job->hdr.code != PRINT_TYPE_6x4 &&
job->hdr.code != PRINT_TYPE_6x4_2UP &&
job->hdr.code != PRINT_TYPE_6x4_3UP &&
job->hdr.code != PRINT_TYPE_6x2) {
ERROR("Invalid ribbon type vs job (%02x/%02x)\n",
ctx->ribbon.type, job->hdr.code);
@ -2156,11 +2160,14 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
case RIBBON_TYPE_6x8:
if (job->hdr.code != PRINT_TYPE_6x4 &&
job->hdr.code != PRINT_TYPE_6x4_2UP &&
job->hdr.code != PRINT_TYPE_6x4_3UP &&
job->hdr.code != PRINT_TYPE_6x5 &&
job->hdr.code != PRINT_TYPE_6x6 &&
job->hdr.code != PRINT_TYPE_6x8 &&
job->hdr.code != PRINT_TYPE_6x2 &&
job->hdr.code != PRINT_TYPE_6x9_2UP) {
job->hdr.code != PRINT_TYPE_6x9_2UP &&
job->hdr.code != PRINT_TYPE_6x9_4UP &&
job->hdr.code != PRINT_TYPE_6x9_6UP) {
ERROR("Invalid ribbon type vs job (%02x/%02x)\n",
ctx->ribbon.type, job->hdr.code);
hiti_cleanup_job(job);
@ -2172,18 +2179,24 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
case RIBBON_TYPE_6x9:
if (job->hdr.code != PRINT_TYPE_6x4 &&
job->hdr.code != PRINT_TYPE_6x4_2UP &&
job->hdr.code != PRINT_TYPE_6x4_3UP &&
job->hdr.code != PRINT_TYPE_6x5 &&
job->hdr.code != PRINT_TYPE_6x6 &&
job->hdr.code != PRINT_TYPE_6x8 &&
job->hdr.code != PRINT_TYPE_6x2 &&
job->hdr.code != PRINT_TYPE_6x9 &&
job->hdr.code != PRINT_TYPE_6x9_2UP) {
job->hdr.code != PRINT_TYPE_6x9_2UP &&
job->hdr.code != PRINT_TYPE_6x9_4UP &&
job->hdr.code != PRINT_TYPE_6x9_6UP) {
ERROR("Invalid ribbon type vs job (%02x/%02x)\n",
ctx->ribbon.type, job->hdr.code);
hiti_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
if (job->hdr.code == PRINT_TYPE_6x4)
if (job->hdr.code == PRINT_TYPE_6x4 ||
job->hdr.code == PRINT_TYPE_6x4_2UP ||
job->hdr.code == PRINT_TYPE_6x4_3UP ||
job->hdr.code == PRINT_TYPE_5x3_5 )
job->common.can_combine = 1;
break;
default:
@ -3389,15 +3402,24 @@ static void *hiti_combine_jobs(const void *vjob1,
JOB_EQUIV(hdr.payload_len);
if (job1->hdr.cols == 1548 && job1->hdr.rows == 1072) {
/* 2x 3.5x5" -> 1x 5x7" cut */
/* 2x 3.5x5" -> 1x 5x7-div2 */
newrows = 2152;
newpad = 8;
newmode = PRINT_TYPE_5x7_2UP;
} else if (job1->hdr.cols == 1844 && job1->hdr.rows == 1240) {
/* 2x 4x6 -> 1x 8x6" cut */
/* 2x 4x6 -> 1x 8x6-div2 */
newrows = 2492;
newpad = 12;
newmode = PRINT_TYPE_6x9_2UP;
} else if (job1->hdr.cols == 1844 && job1->hdr.rows == 1248) {
/* 2x 4x6-div2 -> 1x 8x6-div4 */
/* 2x 4x6-div3 -> 1x 8x6-div6 */
newrows = 2492;
newpad = -4; // XXX better handle this?
if (job1->hdr.code == PRINT_TYPE_6x4_3UP)
newmode = PRINT_TYPE_6x9_6UP;
else
newmode = PRINT_TYPE_6x9_4UP;
} else {
goto done;
}
@ -3444,7 +3466,7 @@ static void *hiti_combine_jobs(const void *vjob1,
memcpy(newjob->databuf + newjob->datalen, job1->databuf, planelen);
newjob->datalen += planelen;
memset(newjob->databuf + newjob->datalen, 0, newpad);
newjob->datalen += newpad;;
newjob->datalen += newpad;
memcpy(newjob->databuf + newjob->datalen, job2->databuf, planelen);
newjob->datalen += planelen;
@ -3452,7 +3474,7 @@ static void *hiti_combine_jobs(const void *vjob1,
memcpy(newjob->databuf + newjob->datalen, job1->databuf + planelen, planelen);
newjob->datalen += planelen;
memset(newjob->databuf + newjob->datalen, 0, newpad);
newjob->datalen += newpad;;
newjob->datalen += newpad;
memcpy(newjob->databuf + newjob->datalen, job2->databuf + planelen, planelen);
newjob->datalen += planelen;
@ -3460,7 +3482,7 @@ static void *hiti_combine_jobs(const void *vjob1,
memcpy(newjob->databuf + newjob->datalen, job1->databuf + planelen + planelen, planelen);
newjob->datalen += planelen;
memset(newjob->databuf + newjob->datalen, 0, newpad);
newjob->datalen += newpad;;
newjob->datalen += newpad;
memcpy(newjob->databuf + newjob->datalen, job2->databuf + planelen + planelen, planelen);
newjob->datalen += planelen;
@ -3533,10 +3555,7 @@ const struct dyesub_backend hiti_backend = {
/* TODO:
- Figure out 5x5 prints
- Test job/copy combining
- Notably 2x6*2 (8x6-div4 doesn't exist?)
- Figure out "region 0x1" on P52x/U826
- Validate rewind support on U826
- Confirm 6x2" print dimensions (windows?)
- Job control (QJC, RSJ) -- and canceling?
- Set highlight adjustment & H/V alignment from cmdline