WP2LaTeX sources.
Revision | b88b9cb7ec7bd8f275fbe2881286cd0422eeb249 (tree) |
---|---|
Zeit | 2023-01-16 05:09:51 |
Autor | Fojtik |
Commiter | Fojtik |
Fixed bug in WPG RLE encoder.
@@ -5666,7 +5666,6 @@ | ||
5666 | 5666 | { |
5667 | 5667 | FILE *f; |
5668 | 5668 | WORD i, j; |
5669 | -DWORD pix; | |
5670 | 5669 | const Image *CurrImg; |
5671 | 5670 | APalette *pPalette; |
5672 | 5671 | RGBQuad RGB; |
@@ -6783,11 +6782,10 @@ | ||
6783 | 6782 | { |
6784 | 6783 | if(fread(&bbuf,1,1,f)!=1) |
6785 | 6784 | { |
6786 | - Raster->Erase(); | |
6787 | 6785 | return(-2); |
6788 | 6786 | } |
6789 | 6787 | |
6790 | - RunCount=bbuf & 0x7F; | |
6788 | + RunCount = bbuf & 0x7F; | |
6791 | 6789 | if(bbuf & 0x80) |
6792 | 6790 | { |
6793 | 6791 | if(RunCount) // repeat next byte runcount * |
@@ -6800,7 +6798,8 @@ | ||
6800 | 6798 | for(i=0;i<RunCount;i++) InsertByte(0xFF); |
6801 | 6799 | } |
6802 | 6800 | } |
6803 | - else { | |
6801 | + else | |
6802 | + { | |
6804 | 6803 | if(RunCount) // next runcount byte are readed directly |
6805 | 6804 | { |
6806 | 6805 | for(i=0;i<RunCount;i++) |
@@ -7395,9 +7394,14 @@ | ||
7395 | 7394 | count++; |
7396 | 7395 | } |
7397 | 7396 | |
7398 | - if(pos>=254) | |
7397 | + if(pos-count>0x7E) // We have uncompressible block with size 0x7F. | |
7399 | 7398 | { |
7400 | - Flush(F,0x7F); | |
7399 | + Flush(F, 0x7F); | |
7400 | + return; | |
7401 | + } | |
7402 | + if(pos>0x7E && count>=1) | |
7403 | + { | |
7404 | + Flush(F, pos-1-count); | |
7401 | 7405 | return; |
7402 | 7406 | } |
7403 | 7407 | } |
@@ -3,7 +3,7 @@ | ||
3 | 3 | * Purpose: Prototypes for general manipulation n dimensional matrices * |
4 | 4 | * Modul: raster.cc * |
5 | 5 | * Licency: GPL or LGPL * |
6 | - * Copyright: (c) 1998-2022 Jaroslav Fojtik * | |
6 | + * Copyright: (c) 1998-2023 Jaroslav Fojtik * | |
7 | 7 | ***************************************************************************/ |
8 | 8 | #ifndef __Rasters_h |
9 | 9 | #define __Rasters_h |