From 6957609aeac7933cdfeee9e41b447ed0b054236f Mon Sep 17 00:00:00 2001
From: David Maciejak <david.maciejak@gmail.com>
Date: Wed, 21 May 2014 11:38:50 +0700
Subject: [PATCH] wrlib: RRotateImage function not fully implemented

when the rotation angle value passed to RRotateImage is a modulo of 90,
the function is working well but in other cases the rotateImage()
function is called. That last function is half implemented but
the half already implemented part is also segfaulting (use the testrot.c
to replay the crash).
So the patch is moving the 'not implemented' msg to disable the whole
rotateImage() function and comment it out.
---
 wrlib/rotate.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/wrlib/rotate.c b/wrlib/rotate.c
index fead8ae..a882b7f 100644
--- a/wrlib/rotate.c
+++ b/wrlib/rotate.c
@@ -212,7 +212,7 @@ RImage *RRotateImage(RImage * image, float angle)
  * 		increment pixel location from source
  *
  */
-
+/*
 static void
 copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *dst, unsigned char **src)
 {
@@ -241,7 +241,7 @@ copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *
 		p = dpr - dx;
 
 		while (dx-- >= 0) {
-			/* fetch and draw the pixel */
+			// fetch and draw the pixel
 			offset = (x1 + y1 * nwidth) << 2;
 			dst[offset++] = *s++;
 			dst[offset++] = *s++;
@@ -251,7 +251,7 @@ copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *
 			else
 				dst[offset++] = 255;
 
-			/* calc next step */
+			// calc next step
 			if (p > 0) {
 				x1 += xi;
 				y1 += yi;
@@ -268,7 +268,7 @@ copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *
 		p = dpr - dy;
 
 		while (dy-- >= 0) {
-			/* fetch and draw the pixel */
+			// fetch and draw the pixel
 			offset = (x1 + y1 * nwidth) << 2;
 			dst[offset++] = *s++;
 			dst[offset++] = *s++;
@@ -278,7 +278,7 @@ copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *
 			else
 				dst[offset++] = 255;
 
-			/* calc next step */
+			// calc next step
 			if (p > 0) {
 				x1 += xi;
 				y1 += yi;
@@ -292,9 +292,14 @@ copyLine(int x1, int y1, int x2, int y2, int nwidth, int format, unsigned char *
 
 	*src = s;
 }
+*/
 
 static RImage *rotateImage(RImage * image, float angle)
 {
+	(void) angle;
+	puts("NOT FULLY IMPLEMENTED");
+	return RCloneImage(image);
+/*
 	RImage *img;
 	int nwidth, nheight;
 	int x1, y1;
@@ -305,7 +310,7 @@ static RImage *rotateImage(RImage * image, float angle)
 	unsigned char *src, *dst;
 	int dpr, dpru, p;
 
-	/* only 180o for now */
+	// only 180o for now
 	if (angle > 180.0)
 		angle -= 180.0;
 
@@ -356,7 +361,7 @@ static RImage *rotateImage(RImage * image, float angle)
 
 			copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src);
 
-			/* calc next step */
+			// calc next step
 
 			if (p > 0) {
 				x1 += xi;
@@ -371,8 +376,6 @@ static RImage *rotateImage(RImage * image, float angle)
 			}
 		}
 	} else {
-		puts("NOT IMPLEMTENED");
-		return img;
 		dpr = dx << 1;
 		dpru = dpr - (dy << 1);
 		p = dpr - dy;
@@ -383,7 +386,7 @@ static RImage *rotateImage(RImage * image, float angle)
 
 			copyLine(x1, y1, xx, yy, nwidth, image->format, dst, &src);
 
-			/* calc next step */
+			// calc next step
 			if (p > 0) {
 				x1 += xi;
 				y1 += yi;
@@ -396,4 +399,5 @@ static RImage *rotateImage(RImage * image, float angle)
 	}
 
 	return img;
+*/
 }
-- 
1.8.3.2

