shithub: jbig2

Download patch

ref: 45a5c57347f7b7569808933207bb03c8edf30315
parent: 9d9c7e26944b07cda1c81242b66aea7bbdfc1150
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Wed Jul 27 20:59:59 EDT 2005

Warning cleanup. Implement an unoptimized version of the REPLACE image
composition operator.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@421 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -90,8 +90,9 @@
 	    image->data = jbig2_realloc(ctx->allocator,
                 image->data, image->stride*height);
             if (image->data == NULL) {
-                return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1,
+                jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1,
                     "could not resize image buffer!");
+		return NULL;
             }
 	    if (height > image->height) {
 		memset(image->data + image->height*image->stride,
@@ -105,7 +106,7 @@
 		"jbig2_image_resize called with a different width (NYI)");
 	}
 
-	return 0;
+	return NULL;
 }
 
 /* composite one jbig2_image onto another
@@ -163,6 +164,14 @@
 		}
     	    }
 	    break;
+	case JBIG2_COMPOSE_REPLACE:
+	    for (j = 0; j < sh; j++) {
+		for (i = 0; i < sw; i++) {
+		    jbig2_image_set_pixel(dst, i+x, j+y,
+			jbig2_image_get_pixel(src, i+sx, j+sy));
+		}
+    	    }
+	    break;
     }
 
     return 0;
@@ -290,7 +299,7 @@
 {
   const int w = image->width;
   const int h = image->height;
-  int i, scratch, mask;
+  int scratch, mask;
   int bit, byte;
 
   if ((x < 0) || (x >= w)) return 0;