OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkBmpRLECodec.h" | 8 #include "SkBmpRLECodec.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
342 const uint8_t task = fStreamBuffer.get()[fCurrRLEByte++]; | 342 const uint8_t task = fStreamBuffer.get()[fCurrRLEByte++]; |
343 | 343 |
344 // Perform decoding | 344 // Perform decoding |
345 if (RLE_ESCAPE == flag) { | 345 if (RLE_ESCAPE == flag) { |
346 switch (task) { | 346 switch (task) { |
347 case RLE_EOL: | 347 case RLE_EOL: |
348 x = 0; | 348 x = 0; |
349 y++; | 349 y++; |
350 break; | 350 break; |
351 case RLE_EOF: | 351 case RLE_EOF: |
352 return y; | 352 return height; |
msarett
2015/11/19 15:16:56
We will often hit the EOF marker when x=width, y=h
scroggo
2015/11/19 15:55:51
Maybe file a bug and/or add a FIXME? It seems unfo
msarett
2015/11/19 16:23:29
Will file a bug.
| |
353 case RLE_DELTA: { | 353 case RLE_DELTA: { |
354 // Two bytes are needed to specify delta | 354 // Two bytes are needed to specify delta |
355 if ((int) fRLEBytes - fCurrRLEByte < 2) { | 355 if ((int) fRLEBytes - fCurrRLEByte < 2) { |
356 SkCodecPrintf("Warning: might be incomplete RLE input.\n "); | 356 SkCodecPrintf("Warning: might be incomplete RLE input.\n "); |
357 if (this->checkForMoreData() < 2) { | 357 if (this->checkForMoreData() < 2) { |
358 return y; | 358 return y; |
359 } | 359 } |
360 } | 360 } |
361 // Modify x and y | 361 // Modify x and y |
362 const uint8_t dx = fStreamBuffer.get()[fCurrRLEByte++]; | 362 const uint8_t dx = fStreamBuffer.get()[fCurrRLEByte++]; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 fSampler.reset(new SkBmpRLESampler(this)); | 505 fSampler.reset(new SkBmpRLESampler(this)); |
506 } | 506 } |
507 | 507 |
508 return fSampler; | 508 return fSampler; |
509 } | 509 } |
510 | 510 |
511 int SkBmpRLECodec::setSampleX(int sampleX){ | 511 int SkBmpRLECodec::setSampleX(int sampleX){ |
512 fSampleX = sampleX; | 512 fSampleX = sampleX; |
513 return get_scaled_dimension(this->getInfo().width(), sampleX); | 513 return get_scaled_dimension(this->getInfo().width(), sampleX); |
514 } | 514 } |
OLD | NEW |