| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2007 The Android Open Source Project | 3 * Copyright 2007 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "bmpdecoderhelper.h" | 10 #include "bmpdecoderhelper.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 SkTDArray<uint8_t> fRGB; | 90 SkTDArray<uint8_t> fRGB; |
| 91 int fWidth; | 91 int fWidth; |
| 92 int fHeight; | 92 int fHeight; |
| 93 bool fJustBounds; | 93 bool fJustBounds; |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 SkImageDecoder::Result SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* b
m, Mode mode) { | 96 SkImageDecoder::Result SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* b
m, Mode mode) { |
| 97 // First read the entire stream, so that all of the data can be passed to | 97 // First read the entire stream, so that all of the data can be passed to |
| 98 // the BmpDecoderHelper. | 98 // the BmpDecoderHelper. |
| 99 | 99 |
| 100 SkAutoTUnref<SkData> data(SkCopyStreamToData(stream)); | 100 auto data = SkCopyStreamToData(stream); |
| 101 if (!data) { | 101 if (!data) { |
| 102 return kFailure; | 102 return kFailure; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // Byte length of all of the data. | 105 // Byte length of all of the data. |
| 106 const size_t length = data->size(); | 106 const size_t length = data->size(); |
| 107 if (0 == length) { | 107 if (0 == length) { |
| 108 return kFailure; | 108 return kFailure; |
| 109 } | 109 } |
| 110 | 110 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 const int dstHeight = sampler.scaledHeight(); | 157 const int dstHeight = sampler.scaledHeight(); |
| 158 const uint8_t* srcRow = callback.rgb(); | 158 const uint8_t* srcRow = callback.rgb(); |
| 159 | 159 |
| 160 srcRow += sampler.srcY0() * srcRowBytes; | 160 srcRow += sampler.srcY0() * srcRowBytes; |
| 161 for (int y = 0; y < dstHeight; y++) { | 161 for (int y = 0; y < dstHeight; y++) { |
| 162 sampler.next(srcRow); | 162 sampler.next(srcRow); |
| 163 srcRow += sampler.srcDY() * srcRowBytes; | 163 srcRow += sampler.srcDY() * srcRowBytes; |
| 164 } | 164 } |
| 165 return kSuccess; | 165 return kSuccess; |
| 166 } | 166 } |
| OLD | NEW |