shithub: jbig2

Download patch

ref: fd7cb7fa6152573ab11ebfbce45582fa1652f117
parent: dcf0bd8c4288ff30d152b3741bc78c9fa055e49c
author: Ralph Giles <giles@ghostscript.com>
date: Mon Nov 16 06:17:51 EST 2009

Correct bitmap offsets when setting transposed text.

Previously, the code was switching width and height, not just S and T
coordinates. We now properly decode the 042_19.jb2 test file.

Thanks to Drugo Pedrouvene for pointing out the issue. Bug 690923.

--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -354,7 +354,7 @@
 
 	    /* (3c.viii) */
 	    if (!params->TRANSPOSED) {
-		switch (params->REFCORNER) {  /* FIXME: double check offsets */
+		switch (params->REFCORNER) {
 		case JBIG2_CORNER_TOPLEFT: x = S; y = T; break;
 		case JBIG2_CORNER_TOPRIGHT: x = S - IB->width + 1; y = T; break;
 		case JBIG2_CORNER_BOTTOMLEFT: x = S; y = T - IB->height + 1; break;
@@ -362,10 +362,10 @@
 		}
 	    } else { /* TRANSPOSED */
 		switch (params->REFCORNER) {
-		case JBIG2_CORNER_TOPLEFT: y = S; x = T; break;
-		case JBIG2_CORNER_TOPRIGHT: y = S - IB->width + 1; x = T; break;
-		case JBIG2_CORNER_BOTTOMLEFT: y = S; x = T - IB->height + 1; break;
-		case JBIG2_CORNER_BOTTOMRIGHT: y = S - IB->width + 1; x = T - IB->height + 1; break;
+		case JBIG2_CORNER_TOPLEFT: x = T; y = S; break;
+		case JBIG2_CORNER_TOPRIGHT: x = T - IB->width + 1; y = S; break;
+		case JBIG2_CORNER_BOTTOMLEFT: x = T; y = S - IB->height + 1; break;
+		case JBIG2_CORNER_BOTTOMRIGHT: x = T - IB->width + 1; y = S - IB->height + 1; break;
 		}
 	    }