summaryrefslogtreecommitdiffstats
path: root/backend_mitsu9550.c
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-06-19 09:04:17 -0400
committerSolomon Peachy <pizza@shaftnet.org>2018-06-19 09:04:17 -0400
commitebf9b8a74f59981cc106601d8120a79ba5d97529 (patch)
tree29657cf0a38e9b1de3932825eaefa11974a3e51a /backend_mitsu9550.c
parent087ed57d8b84aab5ae66c2741476b26955556932 (diff)
downloadselphy_print-ebf9b8a74f59981cc106601d8120a79ba5d97529.tar.gz
selphy_print-ebf9b8a74f59981cc106601d8120a79ba5d97529.tar.bz2
selphy_print-ebf9b8a74f59981cc106601d8120a79ba5d97529.zip
mitsu: 70x and 98xx families perform the image processing in test modes.
This fixes a functional regression.
Diffstat (limited to 'backend_mitsu9550.c')
-rw-r--r--backend_mitsu9550.c160
1 files changed, 86 insertions, 74 deletions
diff --git a/backend_mitsu9550.c b/backend_mitsu9550.c
index 6f29df2..55673e5 100644
--- a/backend_mitsu9550.c
+++ b/backend_mitsu9550.c
@@ -231,6 +231,8 @@ struct mitsu9550_status2 {
uint8_t unkb[4]; /* 0a 00 00 01 */
} __attribute__((packed));
+static int mitsu9550_main_loop(void *vctx, const void *vjob);
+
#define CMDBUF_LEN 64
#define READBACK_LEN 128
@@ -882,6 +884,10 @@ hdr_done:
}
job->copies = copies;
+ /* All further work is in main loop */
+ if (test_mode >= TEST_MODE_NOPRINT)
+ mitsu9550_main_loop(ctx, job);
+
*vjob = job;
return CUPS_BACKEND_OK;
@@ -1177,84 +1183,90 @@ static int mitsu9550_main_loop(void *vctx, const void *vjob) {
#endif
/* Do the 98xx processing here */
- if (ctx->is_98xx && !job->is_raw) {
- uint8_t *newbuf;
- uint32_t newlen = 0;
- struct mitsu98xx_data *table;
- int i, remain, planelen;
-
- planelen = job->rows * job->cols * 2;
- remain = (job->hdr1.matte ? 3 : 4) * (planelen + sizeof(struct mitsu9550_plane)) + sizeof(struct mitsu9550_cmd);
- newbuf = malloc(remain);
- if (!newbuf) {
- ERROR("Memory allocation Failure!\n");
- return CUPS_BACKEND_RETRY_CURRENT;
- }
- switch (job->hdr2.mode) {
- case 0x80:
- table = &ctx->m98xxdata->superfine;
- break;
- case 0x11:
- table = &ctx->m98xxdata->fine_hg;
- job->hdr2.mode = 0x10;
- break;
- case 0x10:
- default:
- table = &ctx->m98xxdata->fine_std;
- break;
- }
-
- DEBUG("Applying 8bpp->12bpp Gamma Correction\n");
- /* For B/Y plane */
- memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
- newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
- newlen += sizeof(struct mitsu9550_plane);
- mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
- (uint16_t*) (newbuf + newlen),
- 0,
- table->GNMby,
- planelen / 2);
- newlen += planelen;
-
- /* For G/M plane */
- memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
- newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
- newlen += sizeof(struct mitsu9550_plane);
- mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
- (uint16_t*) (newbuf + newlen),
- 1,
- table->GNMgm,
- planelen / 2);
- newlen += planelen;
-
- /* For R/C plane */
- memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
- newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
- newlen += sizeof(struct mitsu9550_plane);
- mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
- (uint16_t*) (newbuf + newlen),
- 2,
- table->GNMrc,
- planelen / 2);
- newlen += planelen;
-
- /* And finally, the job footer. */
- memcpy(newbuf + newlen, job->databuf + sizeof(struct mitsu9550_plane) + planelen * 3, sizeof(struct mitsu9550_cmd));
- newlen += sizeof(struct mitsu9550_cmd);
-
- /* Clean up */
- free(job->databuf);
- job->databuf = newbuf;
- job->datalen = newlen;
+ if (!ctx->is_98xx || job->is_raw)
+ goto bypass;
+
+ uint8_t *newbuf;
+ uint32_t newlen = 0;
+ struct mitsu98xx_data *table;
+ int i, remain, planelen;
+
+ planelen = job->rows * job->cols * 2;
+ remain = (job->hdr1.matte ? 3 : 4) * (planelen + sizeof(struct mitsu9550_plane)) + sizeof(struct mitsu9550_cmd);
+ newbuf = malloc(remain);
+ if (!newbuf) {
+ ERROR("Memory allocation Failure!\n");
+ return CUPS_BACKEND_RETRY_CURRENT;
+ }
+ switch (job->hdr2.mode) {
+ case 0x80:
+ table = &ctx->m98xxdata->superfine;
+ break;
+ case 0x11:
+ table = &ctx->m98xxdata->fine_hg;
+ job->hdr2.mode = 0x10;
+ break;
+ case 0x10:
+ default:
+ table = &ctx->m98xxdata->fine_std;
+ break;
+ }
- /* Now handle the matte plane generation */
- if (job->hdr1.matte) {
- if ((i = mitsu98xx_fillmatte(job))) {
- return i;
- }
+ DEBUG("Applying 8bpp->12bpp Gamma Correction\n");
+ /* For B/Y plane */
+ memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
+ newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
+ newlen += sizeof(struct mitsu9550_plane);
+ mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
+ (uint16_t*) (newbuf + newlen),
+ 0,
+ table->GNMby,
+ planelen / 2);
+ newlen += planelen;
+
+ /* For G/M plane */
+ memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
+ newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
+ newlen += sizeof(struct mitsu9550_plane);
+ mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
+ (uint16_t*) (newbuf + newlen),
+ 1,
+ table->GNMgm,
+ planelen / 2);
+ newlen += planelen;
+
+ /* For R/C plane */
+ memcpy(newbuf + newlen, job->databuf, sizeof(struct mitsu9550_plane));
+ newbuf[newlen + 3] = 0x10; /* ie 16bpp data */
+ newlen += sizeof(struct mitsu9550_plane);
+ mitsu98xx_dogamma(job->databuf + sizeof(struct mitsu9550_plane),
+ (uint16_t*) (newbuf + newlen),
+ 2,
+ table->GNMrc,
+ planelen / 2);
+ newlen += planelen;
+
+ /* And finally, the job footer. */
+ memcpy(newbuf + newlen, job->databuf + sizeof(struct mitsu9550_plane) + planelen * 3, sizeof(struct mitsu9550_cmd));
+ newlen += sizeof(struct mitsu9550_cmd);
+
+ /* Clean up */
+ free(job->databuf);
+ job->databuf = newbuf;
+ job->datalen = newlen;
+
+ /* Now handle the matte plane generation */
+ if (job->hdr1.matte) {
+ if ((i = mitsu98xx_fillmatte(job))) {
+ return i;
}
}
+bypass:
+ /* Bypass */
+ if (test_mode >= TEST_MODE_NOPRINT)
+ return CUPS_BACKEND_OK;
+
top:
if (ctx->is_s) {
int num;