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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 void* dst = bitmap.getAddr(0, 0); | 199 void* dst = bitmap.getAddr(0, 0); |
200 size_t rowBytes = bitmap.rowBytes(); | 200 size_t rowBytes = bitmap.rowBytes(); |
201 uint32_t height = decodeInfo.height(); | 201 uint32_t height = decodeInfo.height(); |
202 switch (codec->getScanlineOrder()) { | 202 switch (codec->getScanlineOrder()) { |
203 case SkCodec::kTopDown_SkScanlineOrder: | 203 case SkCodec::kTopDown_SkScanlineOrder: |
204 case SkCodec::kBottomUp_SkScanlineOrder: | 204 case SkCodec::kBottomUp_SkScanlineOrder: |
205 // We do not need to check the return value. On an incomple
te | 205 // We do not need to check the return value. On an incomple
te |
206 // image, memory will be filled with a default value. | 206 // image, memory will be filled with a default value. |
207 codec->getScanlines(dst, height, rowBytes); | 207 codec->getScanlines(dst, height, rowBytes); |
208 break; | 208 break; |
209 case SkCodec::kOutOfOrder_SkScanlineOrder: { | |
210 for (int y = 0; y < decodeInfo.height(); y++) { | |
211 int dstY = codec->outputScanline(y); | |
212 void* dstPtr = bitmap.getAddr(0, dstY); | |
213 // We complete the loop, even if this call begins to fai
l | |
214 // due to an incomplete image. This ensures any uniniti
alized | |
215 // memory will be filled with the proper value. | |
216 codec->getScanlines(dstPtr, 1, bitmap.rowBytes()); | |
217 } | |
218 break; | |
219 } | |
220 } | 209 } |
221 SkDebugf("[terminated] Success!\n"); | 210 SkDebugf("[terminated] Success!\n"); |
222 break; | 211 break; |
223 } | 212 } |
224 case 2: { //kStripe_Mode | 213 case 2: { //kStripe_Mode |
225 const int height = decodeInfo.height(); | 214 const int height = decodeInfo.height(); |
226 // This value is chosen arbitrarily. We exercise more cases by choo
sing a value that | 215 // This value is chosen arbitrarily. We exercise more cases by choo
sing a value that |
227 // does not align with image blocks. | 216 // does not align with image blocks. |
228 const int stripeHeight = 37; | 217 const int stripeHeight = 37; |
229 const int numStripes = (height + stripeHeight - 1) / stripeHeight; | 218 const int numStripes = (height + stripeHeight - 1) / stripeHeight; |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 if (min > max) { | 472 if (min > max) { |
484 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); | 473 SkDebugf("Check mins and maxes (%f, %f)\n", min, max); |
485 this->signalBoring(); | 474 this->signalBoring(); |
486 } | 475 } |
487 float f = std::abs(this->nextF()); | 476 float f = std::abs(this->nextF()); |
488 if (!std::isnormal(f) && f != 0.0) { | 477 if (!std::isnormal(f) && f != 0.0) { |
489 this->signalBoring(); | 478 this->signalBoring(); |
490 } | 479 } |
491 return min + fmod(f, (max - min + 1)); | 480 return min + fmod(f, (max - min + 1)); |
492 } | 481 } |
OLD | NEW |