Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: src/codec/SkBmpRLECodec.cpp

Issue 1457793003: Fix BMP RLE bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 kSuccess; 352 return y;
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698