hiti: No need to hardcode head width; the printer supplies this already
This commit is contained in:
parent
e026593c58
commit
cf1d9da634
|
@ -606,7 +606,6 @@ struct hiti_ctx {
|
|||
|
||||
int sheet;
|
||||
int heattable_type;
|
||||
int head_width; /* Number of pixels in each data row */
|
||||
|
||||
char serno[32];
|
||||
|
||||
|
@ -1319,11 +1318,6 @@ static int hiti_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid
|
|||
ctx->sheet = 1;
|
||||
}
|
||||
|
||||
if (ctx->sheet)
|
||||
ctx->head_width = 1280;
|
||||
else
|
||||
ctx->head_width = 1844;
|
||||
|
||||
switch(ctx->conn->type) {
|
||||
case P_HITI_461:
|
||||
case P_HITI_320:
|
||||
|
@ -1424,10 +1418,14 @@ static int hiti_attach(void *vctx, struct dyesub_connection *conn, uint8_t jobid
|
|||
}
|
||||
// do real stuff
|
||||
} else {
|
||||
if (ctx->sheet)
|
||||
if (ctx->sheet) {
|
||||
ctx->paper.type = PAPER_TYPE_X4INCH;
|
||||
else
|
||||
ctx->erdc_rs.cols = 1280;
|
||||
} else {
|
||||
ctx->paper.type = PAPER_TYPE_6INCH;
|
||||
ctx->erdc_rs.cols = 1844;
|
||||
}
|
||||
|
||||
ctx->ribbon.type = RIBBON_TYPE_4x6;
|
||||
ctx->ribbonvendor = 0x1005; /* CHC, type 2 */
|
||||
if (getenv("MEDIA_CODE") && strlen(getenv("MEDIA_CODE"))) {
|
||||
|
@ -2050,7 +2048,7 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
|
|||
// XXX P461 is 1280
|
||||
// XXX P320/P310 ???
|
||||
// XXX P11x is ???
|
||||
if (job->hdr.cols != 1280) {
|
||||
if (job->hdr.cols != ctx->erdc_rs.cols) {
|
||||
ERROR("Illegal job on 4x6-inch paper!\n");
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
@ -2062,7 +2060,7 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
|
|||
break;
|
||||
/* Intentional fallthrough */
|
||||
case PAPER_TYPE_6INCH:
|
||||
if (job->hdr.cols != 1844) {
|
||||
if (job->hdr.cols != ctx->erdc_rs.cols) {
|
||||
ERROR("Illegal job on %d-inch paper!\n", ctx->paper.type == PAPER_TYPE_5INCH ? 5 : 6);
|
||||
hiti_cleanup_job(job);
|
||||
return CUPS_BACKEND_CANCEL;
|
||||
|
@ -2156,10 +2154,10 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
|
|||
|
||||
/* Printer expects FULL WIDTH data, even for 5" prints */
|
||||
int pad1, pad2;
|
||||
pad1 = (ctx->head_width - job->hdr.cols) / 2;
|
||||
pad2 = ctx->head_width - job->hdr.cols - pad1;
|
||||
pad1 = (ctx->erdc_rs.cols - job->hdr.cols) / 2;
|
||||
pad2 = ctx->erdc_rs.cols - job->hdr.cols - pad1;
|
||||
|
||||
uint8_t *ymcbuf = malloc(job->hdr.rows * ctx->head_width * 3);
|
||||
uint8_t *ymcbuf = malloc(job->hdr.rows * ctx->erdc_rs.cols * 3);
|
||||
uint32_t i, j;
|
||||
|
||||
if (!ymcbuf) {
|
||||
|
@ -2169,9 +2167,9 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
|
|||
}
|
||||
|
||||
for (i = 0 ; i < job->hdr.rows ; i++) {
|
||||
uint8_t *rowY = ymcbuf + ctx->head_width * i;
|
||||
uint8_t *rowM = ymcbuf + ctx->head_width * (job->hdr.rows + i);
|
||||
uint8_t *rowC = ymcbuf + ctx->head_width * (job->hdr.rows * 2 + i);
|
||||
uint8_t *rowY = ymcbuf + ctx->erdc_rs.cols * i;
|
||||
uint8_t *rowM = ymcbuf + ctx->erdc_rs.cols * (job->hdr.rows + i);
|
||||
uint8_t *rowC = ymcbuf + ctx->erdc_rs.cols * (job->hdr.rows * 2 + i);
|
||||
|
||||
/* Simple optimization */
|
||||
uint8_t oldrgb[3] = { 255, 255, 255 };
|
||||
|
@ -2231,8 +2229,8 @@ static int hiti_read_parse(void *vctx, const void **vjob, int data_fd, int copie
|
|||
/* Nuke the old BGR buffer and replace it with YMC buffer */
|
||||
free(job->databuf);
|
||||
job->databuf = ymcbuf;
|
||||
job->datalen = ctx->head_width * 3 * job->hdr.cols;
|
||||
job->hdr.cols = ctx->head_width;
|
||||
job->datalen = ctx->erdc_rs.cols * 3 * job->hdr.cols;
|
||||
job->hdr.cols = ctx->erdc_rs.cols;
|
||||
|
||||
if (corrdata)
|
||||
free(corrdata);
|
||||
|
@ -3440,7 +3438,7 @@ static const struct device_id hiti_devices[] = {
|
|||
|
||||
const struct dyesub_backend hiti_backend = {
|
||||
.name = "HiTi Photo Printers",
|
||||
.version = "0.73",
|
||||
.version = "0.74",
|
||||
.uri_prefixes = hiti_prefixes,
|
||||
.cmdline_usage = hiti_cmdline,
|
||||
.cmdline_arg = hiti_cmdline_arg,
|
||||
|
|
|
@ -107,9 +107,9 @@ Naming convention:
|
|||
C = 5
|
||||
CL = 6 (Second most common) ("CLASSICAL")
|
||||
SO = ?? (Seen on P51x)
|
||||
M = ?? (Seen on P52x)
|
||||
H = ?? (Seen on P52x)
|
||||
T = ?? (Seen on P52x)
|
||||
M = ?? (Seen on P52x, ro)
|
||||
H = ?? (Seen on P52x. ro)
|
||||
T = ?? (Seen on P52x, ro)
|
||||
B = 0xf1 (Card models)
|
||||
Ze = 0xf2 (Card models)
|
||||
Fa = 0xf3 (Card models)
|
||||
|
@ -132,8 +132,8 @@ Naming convention:
|
|||
Unhandled in the code currently:
|
||||
|
||||
Card series: All
|
||||
P51x: RCMP*, CCPSO*
|
||||
P52x: CCPH*, CCPM*, CCPT*,
|
||||
P51x : RCMP*, CCPSO*
|
||||
P52x/ro : CCPH*, CCPM*, CCPT*
|
||||
|
||||
*** Heat Table files
|
||||
|
||||
|
@ -146,6 +146,7 @@ Naming convention:
|
|||
- media version, 0..n (or 't')
|
||||
--- always 'hea'
|
||||
|
||||
|
||||
Unknown/Unhandled: (all 'p' quality codes)
|
||||
|
||||
hea5pcri1.bin heatpcri1.bin heatpcsn.bin
|
||||
|
@ -153,6 +154,7 @@ Unknown/Unhandled: (all 'p' quality codes)
|
|||
heatpcrd.bin heatpcrk.bin heatphra.bin
|
||||
heatpcrh.bin heatpcsl.bin heatphrd.bin
|
||||
heatmcri*, heatrcri*
|
||||
heabh*ro*, heabm*ro*, heabt*ro*
|
||||
|
||||
Heat table types (Unknown formats):
|
||||
|
||||
|
|
Loading…
Reference in a new issue