@@ -640,19 +640,19 @@ static unsigned char *ReadImage(FILE * fd, int width, int height,
640640 {
641641 temp = image + (ypos * rowstride );
642642 for (xpos = 0 ; xpos < width ; ++ xpos ) {
643- px32 = ToL (& row_buf [xpos * 4 ]);
644- unsigned char red = * (temp ++ ) = ((px32 & masks [0 ].mask ) >> masks [0 ].shiftin ) * 255.0 / masks [0 ].max_value + 0.5 ;
645- unsigned char green = * (temp ++ ) = ((px32 & masks [1 ].mask ) >> masks [1 ].shiftin ) * 255.0 / masks [1 ].max_value + 0.5 ;
646- unsigned char blue = * (temp ++ ) = ((px32 & masks [2 ].mask ) >> masks [2 ].shiftin ) * 255.0 / masks [2 ].max_value + 0.5 ;
647- /* currently alpha channels are not supported by AutoTrace, thus simply ignored */
648- /*if (channels > 3)
649- *(temp++) = ((px32 & masks[3].mask) >> masks[3].shiftin) * 255.0 / masks[3].max_value + 0.5;*/
650- }
651-
652- if (ypos == 0 )
653- break ;
654-
655- -- ypos ; /* next line */
643+ px32 = ToL (& row_buf [xpos * 4 ]);
644+ unsigned char red = * (temp ++ ) = ((px32 & masks [0 ].mask ) >> masks [0 ].shiftin ) * 255.0 / masks [0 ].max_value + 0.5 ;
645+ unsigned char green = * (temp ++ ) = ((px32 & masks [1 ].mask ) >> masks [1 ].shiftin ) * 255.0 / masks [1 ].max_value + 0.5 ;
646+ unsigned char blue = * (temp ++ ) = ((px32 & masks [2 ].mask ) >> masks [2 ].shiftin ) * 255.0 / masks [2 ].max_value + 0.5 ;
647+ /* currently alpha channels are not supported by AutoTrace, thus simply ignored */
648+ /*if (channels > 3)
649+ *(temp++) = ((px32 & masks[3].mask) >> masks[3].shiftin) * 255.0 / masks[3].max_value + 0.5;*/
650+ }
651+
652+ if (ypos == 0 )
653+ break ;
654+
655+ -- ypos ; /* next line */
656656 }
657657 }
658658 break ;
@@ -667,7 +667,11 @@ static unsigned char *ReadImage(FILE * fd, int width, int height,
667667 * (temp ++ ) = row_buf [xpos * 3 + 1 ];
668668 * (temp ++ ) = row_buf [xpos * 3 ];
669669 }
670- -- ypos ; /* next line */
670+
671+ if (ypos == 0 )
672+ break ;
673+
674+ -- ypos ; /* next line */
671675 }
672676 }
673677 break ;
@@ -679,19 +683,19 @@ static unsigned char *ReadImage(FILE * fd, int width, int height,
679683 temp = image + (ypos * rowstride );
680684 for (xpos = 0 ; xpos < width ; ++ xpos )
681685 {
682- rgb = ToS (& row_buf [xpos * 2 ]);
683- * (temp ++ ) = ((rgb & masks [0 ].mask ) >> masks [0 ].shiftin ) * 255.0 / masks [0 ].max_value + 0.5 ;
684- * (temp ++ ) = ((rgb & masks [1 ].mask ) >> masks [1 ].shiftin ) * 255.0 / masks [1 ].max_value + 0.5 ;
685- * (temp ++ ) = ((rgb & masks [2 ].mask ) >> masks [2 ].shiftin ) * 255.0 / masks [2 ].max_value + 0.5 ;
686- /* currently alpha channels are not supported by AutoTrace, thus simply ignored */
687- /*if (channels > 3)
688- *(temp++) = ((rgb & masks[3].mask) >> masks[3].shiftin) * 255.0 / masks[3].max_value + 0.5;*/
689- }
690-
691- if (ypos == 0 )
692- break ;
693-
694- -- ypos ; /* next line */
686+ rgb = ToS (& row_buf [xpos * 2 ]);
687+ * (temp ++ ) = ((rgb & masks [0 ].mask ) >> masks [0 ].shiftin ) * 255.0 / masks [0 ].max_value + 0.5 ;
688+ * (temp ++ ) = ((rgb & masks [1 ].mask ) >> masks [1 ].shiftin ) * 255.0 / masks [1 ].max_value + 0.5 ;
689+ * (temp ++ ) = ((rgb & masks [2 ].mask ) >> masks [2 ].shiftin ) * 255.0 / masks [2 ].max_value + 0.5 ;
690+ /* currently alpha channels are not supported by AutoTrace, thus simply ignored */
691+ /*if (channels > 3)
692+ *(temp++) = ((rgb & masks[3].mask) >> masks[3].shiftin) * 255.0 / masks[3].max_value + 0.5;*/
693+ }
694+
695+ if (ypos == 0 )
696+ break ;
697+
698+ -- ypos ; /* next line */
695699 }
696700 }
697701 break ;
0 commit comments