| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "Fuzz.h" | 8 #include "Fuzz.h" |
| 9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 SkDebugf("[terminated] Could not start scanline decoder\n"); | 180 SkDebugf("[terminated] Could not start scanline decoder\n"); |
| 181 return 7; | 181 return 7; |
| 182 } | 182 } |
| 183 | 183 |
| 184 void* dst = bitmap.getAddr(0, 0); | 184 void* dst = bitmap.getAddr(0, 0); |
| 185 size_t rowBytes = bitmap.rowBytes(); | 185 size_t rowBytes = bitmap.rowBytes(); |
| 186 uint32_t height = decodeInfo.height(); | 186 uint32_t height = decodeInfo.height(); |
| 187 switch (codec->getScanlineOrder()) { | 187 switch (codec->getScanlineOrder()) { |
| 188 case SkCodec::kTopDown_SkScanlineOrder: | 188 case SkCodec::kTopDown_SkScanlineOrder: |
| 189 case SkCodec::kBottomUp_SkScanlineOrder: | 189 case SkCodec::kBottomUp_SkScanlineOrder: |
| 190 case SkCodec::kNone_SkScanlineOrder: |
| 190 // We do not need to check the return value. On an incomple
te | 191 // We do not need to check the return value. On an incomple
te |
| 191 // image, memory will be filled with a default value. | 192 // image, memory will be filled with a default value. |
| 192 codec->getScanlines(dst, height, rowBytes); | 193 codec->getScanlines(dst, height, rowBytes); |
| 193 break; | 194 break; |
| 194 case SkCodec::kOutOfOrder_SkScanlineOrder: { | 195 case SkCodec::kOutOfOrder_SkScanlineOrder: { |
| 195 for (int y = 0; y < decodeInfo.height(); y++) { | 196 for (int y = 0; y < decodeInfo.height(); y++) { |
| 196 int dstY = codec->outputScanline(y); | 197 int dstY = codec->outputScanline(y); |
| 197 void* dstPtr = bitmap.getAddr(0, dstY); | 198 void* dstPtr = bitmap.getAddr(0, dstY); |
| 198 // We complete the loop, even if this call begins to fai
l | 199 // We complete the loop, even if this call begins to fai
l |
| 199 // due to an incomplete image. This ensures any uniniti
alized | 200 // due to an incomplete image. This ensures any uniniti
alized |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 if (min > max) { | 417 if (min > max) { |
| 417 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); | 418 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); |
| 418 this->signalBoring(); | 419 this->signalBoring(); |
| 419 } | 420 } |
| 420 float f = std::abs(this->nextF()); | 421 float f = std::abs(this->nextF()); |
| 421 if (!std::isnormal(f) && f != 0.0) { | 422 if (!std::isnormal(f) && f != 0.0) { |
| 422 this->signalBoring(); | 423 this->signalBoring(); |
| 423 } | 424 } |
| 424 return min + fmod(f, (max - min + 1)); | 425 return min + fmod(f, (max - min + 1)); |
| 425 } | 426 } |
| OLD | NEW |