mitsud90: Major bugfixes for panorama support.

master
Solomon Peachy 2 years ago
parent 94c4b86108
commit ae7806a827
  1. 60
      backend_mitsud90.c
  2. 2
      backend_shinkos6245.c
  3. 2
      backend_sinfonia.h
  4. 2
      regression-gp.csv

@ -764,12 +764,12 @@ static int mitsud90_panorama_splitjob(struct mitsud90_printjob *injob, struct mi
ERROR("Memory allocation failure");
return CUPS_BACKEND_RETRY_CURRENT;
}
panels[i] = malloc(cols * panel_rows[i] * 3);
panels[i] = malloc(cols * panel_rows[i] * 3) + sizeof(struct mitsud90_plane_hdr);
if (!panels[i]) {
ERROR("Memory allocation failure");
return CUPS_BACKEND_RETRY_CURRENT;
}
/* Fill in header differences */
/* Fill in job header differences */
memcpy(newjobs[i], injob, sizeof(struct mitsud90_printjob));
newjobs[i]->databuf = panels[i];
newjobs[i]->hdr.rows = cpu_to_be16(panel_rows[i]);
@ -781,7 +781,18 @@ static int mitsud90_panorama_splitjob(struct mitsud90_printjob *injob, struct mi
newjobs[i]->hdr.pano.overlap = cpu_to_be16(overlap_rows);
newjobs[i]->hdr.pano.unk[1] = 0x0c;
newjobs[i]->hdr.pano.unk[3] = 0x06;
newjobs[i]->has_footer = 0;
/* Fill in plane header differences */
memcpy(newjobs[i]->databuf, injob->databuf, sizeof(struct mitsud90_plane_hdr));
struct mitsud90_plane_hdr *phdr = (struct mitsud90_plane_hdr*)panels[i];
phdr->rows = cpu_to_be16(panel_rows[i]);
if (phdr->lamrows)
phdr->lamrows = cpu_to_be16(panel_rows[i] + 12);
panels[i] += sizeof(struct mitsud90_plane_hdr);
}
/* Last panel gets the footer, if any */
newjobs[numpanels - 1]->has_footer = injob->has_footer;
dyesub_pano_split_rgb8(injob->databuf, cols, inrows,
numpanels, overlap_rows, max_rows,
@ -811,29 +822,19 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
job->jobsize = sizeof(*job);
job->copies = copies;
/* Just allocate a worst-case buffer */
job->datalen = 0;
job->databuf = malloc(sizeof(struct mitsud90_job_hdr) +
sizeof(struct mitsud90_plane_hdr) +
1852*2729*3 + 1024);
if (!job->databuf) {
ERROR("Memory allocation failure!\n");
mitsud90_cleanup_job(job);
return CUPS_BACKEND_RETRY_CURRENT;
}
/* Read in header */
uint8_t *hptr = (uint8_t*) &job->hdr;
uint16_t hremain = sizeof(struct mitsud90_job_hdr);
/* Make sure there's no holdover */
if (ctx->holdover_on) {
memcpy(job->databuf, &ctx->holdover, sizeof(ctx->holdover));
job->datalen += sizeof(ctx->holdover);
memcpy(hptr, &ctx->holdover, sizeof(ctx->holdover));
hremain -= sizeof(ctx->holdover);
ctx->holdover_on = 0;
}
/* Read in first header. */
remain = sizeof(struct mitsud90_job_hdr) - job->datalen;
while (remain) {
i = read(data_fd, (job->databuf + job->datalen), remain);
/* Read the rest */
while (hremain) {
i = read(data_fd, hptr, hremain);
if (i == 0) {
mitsud90_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
@ -842,11 +843,20 @@ static int mitsud90_read_parse(void *vctx, const void **vjob, int data_fd, int c
mitsud90_cleanup_job(job);
return CUPS_BACKEND_CANCEL;
}
remain -= i;
job->datalen += i;
hremain -= i;
hptr += i;
}
/* Move over to its final resting place, and reset */
memcpy(&job->hdr, job->databuf, sizeof(job->hdr));
/* Allocate ourselves a payload buffer */
job->datalen = 0;
job->databuf = malloc(sizeof(struct mitsud90_plane_hdr) + 1024 +
be16_to_cpu(job->hdr.cols) * be16_to_cpu(job->hdr.rows) * 3);
if (!job->databuf) {
ERROR("Memory allocation failure!\n");
mitsud90_cleanup_job(job);
return CUPS_BACKEND_RETRY_CURRENT;
}
job->datalen = 0;
/* Sanity check header */
@ -1995,7 +2005,7 @@ static const char *mitsud90_prefixes[] = {
/* Exported */
const struct dyesub_backend mitsud90_backend = {
.name = "Mitsubishi CP-D90/CP-M1",
.version = "0.35" " (lib " LIBMITSU_VER ")",
.version = "0.36" " (lib " LIBMITSU_VER ")",
.uri_prefixes = mitsud90_prefixes,
.cmdline_arg = mitsud90_cmdline_arg,
.cmdline_usage = mitsud90_cmdline,

@ -1468,7 +1468,7 @@ static const char *shinkos6245_prefixes[] = {
const struct dyesub_backend shinkos6245_backend = {
.name = "Sinfonia CHC-S6245 / Kodak 8810",
.version = "0.40" " (lib " LIBSINFONIA_VER ")",
.version = "0.41" " (lib " LIBSINFONIA_VER ")",
.uri_prefixes = shinkos6245_prefixes,
.cmdline_usage = shinkos6245_cmdline,
.cmdline_arg = shinkos6245_cmdline_arg,

@ -24,7 +24,7 @@
*
*/
#define LIBSINFONIA_VER "0.17"
#define LIBSINFONIA_VER "0.18"
#define SINFONIA_HDR1_LEN 0x10
#define SINFONIA_HDR2_LEN 0x64

@ -358,6 +358,8 @@ mitsubishi-d90dw,0x06d3,0x3b60,0x5,PageSize=w432h648-div4
mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=B7
mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=w360h360
mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=w360h504
mitsubishi-d90dw,0x06d3,0x3b60,0x5,PageSize=w432h1008
mitsubishi-d90dw,0x06d3,0x3b60,0x5,PageSize=w432h1440
#
mitsubishi-cpm1,0x06d3,0x3b80,0xf,PageSize=w144h432
mitsubishi-cpm1,0x06d3,0x3b80,0xf,PageSize=w288h432

1 #gp_printername,vid,pid,type,gp_options[,pano_options]
358 mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=B7
359 mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=w360h360
360 mitsubishi-d90dw,0x06d3,0x3b60,0x4,PageSize=w360h504
361 mitsubishi-d90dw,0x06d3,0x3b60,0x5,PageSize=w432h1008
362 mitsubishi-d90dw,0x06d3,0x3b60,0x5,PageSize=w432h1440
363 #
364 mitsubishi-cpm1,0x06d3,0x3b80,0xf,PageSize=w144h432
365 mitsubishi-cpm1,0x06d3,0x3b80,0xf,PageSize=w288h432
Loading…
Cancel
Save