GraphicsMagick: coders/tga.c: The linescan order must be reverte...

GraphicsMagick Commits <[email protected]> Sat, 24 Feb 2024 09:55:32 -0600
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.13917.1708790190.16032.graphicsmagick-commit@lists.sourceforge.net>
changeset 31b35b51cf7f in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=31b35b51cf7f
summary: coders/tga.c: The linescan order must be reverted because of "orientation" is propagated.

diffstat:

 ChangeLog    |   1 +
 coders/tga.c |  10 +++++-----
 2 files changed, 6 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 2c67f9ac494e -r 31b35b51cf7f ChangeLog
--- a/ChangeLog	Sat Feb 24 08:15:57 2024 -0600
+++ b/ChangeLog	Sat Feb 24 16:54:17 2024 +0100
@@ -5,6 +5,7 @@
 2024-02-24  Fojtik Jaroslav  <[email protected]>
 
 	* coders/tga.c: Propagate orientation in TGA writer.
+	The linescan order must be reverted.
 
 2024-02-23  Fojtik Jaroslav  <[email protected]>
 
diff -r 2c67f9ac494e -r 31b35b51cf7f coders/tga.c
--- a/coders/tga.c	Sat Feb 24 08:15:57 2024 -0600
+++ b/coders/tga.c	Sat Feb 24 16:54:17 2024 +0100
@@ -1195,10 +1195,10 @@
 
       switch(image->orientation)
       {
-        case BottomLeftOrientation:  break;
-        case BottomRightOrientation: tga_info.attributes|=0x10; break;
-        case TopLeftOrientation:     tga_info.attributes|=0x20; break;
-        case TopRightOrientation:    tga_info.attributes|=0x30; break;
+        case BottomLeftOrientation:  break;				/* 01 Bottom left */
+        case BottomRightOrientation: tga_info.attributes|=0x10; break;	/* 01 Bottom right */
+        case TopLeftOrientation:     tga_info.attributes|=0x20; break;	/* 10 Top left */
+        case TopRightOrientation:    tga_info.attributes|=0x30; break;	/* 11 TopRight */
         default: break;
       }
 
@@ -1256,7 +1256,7 @@
       tga_pixels = MagickAllocateResourceLimitedMemory(unsigned char *,count);
       if (tga_pixels == (unsigned char *) NULL)
         ThrowWriterException(ResourceLimitError,MemoryAllocationFailed,image);
-      for (y=(long)(image->rows-1); y>=0; y--)
+      for (y=0; y<(long)(image->rows); y++)
         {
           p = AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
           if (p == (const PixelPacket *) NULL)