| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "core/fxcodec/codec/codec_int.h" | 7 #include "core/fxcodec/codec/codec_int.h" |
| 8 #include "core/fxcodec/include/fx_codec.h" | 8 #include "core/fxcodec/include/fx_codec.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 run_len2 += run; | 330 run_len2 += run; |
| 331 if (run < 64) { | 331 if (run < 64) { |
| 332 break; | 332 break; |
| 333 } | 333 } |
| 334 } | 334 } |
| 335 a2 = a1 + run_len2; | 335 a2 = a1 + run_len2; |
| 336 if (a0color) { | 336 if (a0color) { |
| 337 FaxFillBits(dest_buf, columns, a1, a2); | 337 FaxFillBits(dest_buf, columns, a1, a2); |
| 338 } | 338 } |
| 339 a0 = a2; | 339 a0 = a2; |
| 340 if (a0 < columns) { | 340 if (a0 < 0 && a0 >= columns) |
| 341 continue; | 341 return TRUE; |
| 342 } | 342 continue; |
| 343 return TRUE; | |
| 344 } else { | 343 } else { |
| 345 if (bitpos >= bitsize) { | 344 if (bitpos >= bitsize) { |
| 346 return FALSE; | 345 return FALSE; |
| 347 } | 346 } |
| 348 bit = NEXTBIT; | 347 bit = NEXTBIT; |
| 349 if (bit) { | 348 if (bit) { |
| 350 if (!a0color) { | 349 if (!a0color) { |
| 351 FaxFillBits(dest_buf, columns, a0, b2); | 350 FaxFillBits(dest_buf, columns, a0, b2); |
| 352 } | 351 } |
| 353 if (b2 >= columns) { | 352 a0 = b2; |
| 353 if (a0 < 0 || a0 >= columns) |
| 354 return TRUE; | 354 return TRUE; |
| 355 } | |
| 356 a0 = b2; | |
| 357 continue; | 355 continue; |
| 358 } else { | 356 } else { |
| 359 if (bitpos >= bitsize) { | 357 if (bitpos >= bitsize) { |
| 360 return FALSE; | 358 return FALSE; |
| 361 } | 359 } |
| 362 FX_BOOL next_bit1 = NEXTBIT; | 360 FX_BOOL next_bit1 = NEXTBIT; |
| 363 if (bitpos >= bitsize) { | 361 if (bitpos >= bitsize) { |
| 364 return FALSE; | 362 return FALSE; |
| 365 } | 363 } |
| 366 FX_BOOL next_bit2 = NEXTBIT; | 364 FX_BOOL next_bit2 = NEXTBIT; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 391 return TRUE; | 389 return TRUE; |
| 392 } | 390 } |
| 393 } | 391 } |
| 394 } | 392 } |
| 395 } | 393 } |
| 396 } | 394 } |
| 397 a1 = b1 + v_delta; | 395 a1 = b1 + v_delta; |
| 398 if (!a0color) { | 396 if (!a0color) { |
| 399 FaxFillBits(dest_buf, columns, a0, a1); | 397 FaxFillBits(dest_buf, columns, a0, a1); |
| 400 } | 398 } |
| 401 if (a1 >= columns) { | 399 a0 = a1; |
| 400 if (a0 < 0 || a0 >= columns) |
| 402 return TRUE; | 401 return TRUE; |
| 403 } | |
| 404 a0 = a1; | |
| 405 a0color = !a0color; | 402 a0color = !a0color; |
| 406 } | 403 } |
| 407 } | 404 } |
| 408 | 405 |
| 409 FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { | 406 FX_BOOL FaxSkipEOL(const uint8_t* src_buf, int bitsize, int& bitpos) { |
| 410 int startbit = bitpos; | 407 int startbit = bitpos; |
| 411 while (bitpos < bitsize) { | 408 while (bitpos < bitsize) { |
| 412 int bit = NEXTBIT; | 409 int bit = NEXTBIT; |
| 413 if (bit) { | 410 if (bit) { |
| 414 if (bitpos - startbit <= 11) { | 411 if (bitpos - startbit <= 11) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 int height, | 617 int height, |
| 621 int K, | 618 int K, |
| 622 FX_BOOL EndOfLine, | 619 FX_BOOL EndOfLine, |
| 623 FX_BOOL EncodedByteAlign, | 620 FX_BOOL EncodedByteAlign, |
| 624 FX_BOOL BlackIs1, | 621 FX_BOOL BlackIs1, |
| 625 int Columns, | 622 int Columns, |
| 626 int Rows) { | 623 int Rows) { |
| 627 return new CCodec_FaxDecoder(src_buf, src_size, width, height, K, EndOfLine, | 624 return new CCodec_FaxDecoder(src_buf, src_size, width, height, K, EndOfLine, |
| 628 EncodedByteAlign, BlackIs1, Columns, Rows); | 625 EncodedByteAlign, BlackIs1, Columns, Rows); |
| 629 } | 626 } |
| OLD | NEW |