| 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 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 | 40 |
| 41 char buffer[sizeof(kBmpMagic)]; | 41 char buffer[sizeof(kBmpMagic)]; |
| 42 | 42 |
| 43 return stream->read(buffer, sizeof(kBmpMagic)) == sizeof(kBmpMagic) && | 43 return stream->read(buffer, sizeof(kBmpMagic)) == sizeof(kBmpMagic) && |
| 44 !memcmp(buffer, kBmpMagic, sizeof(kBmpMagic)); | 44 !memcmp(buffer, kBmpMagic, sizeof(kBmpMagic)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 static SkImageDecoder* sk_libbmp_dfactory(SkStreamRewindable* stream) { | 47 static SkImageDecoder* sk_libbmp_dfactory(SkStreamRewindable* stream) { |
| 48 if (is_bmp(stream)) { | 48 if (is_bmp(stream)) { |
| 49 return SkNEW(SkBMPImageDecoder); | 49 return new SkBMPImageDecoder; |
| 50 } | 50 } |
| 51 return NULL; | 51 return NULL; |
| 52 } | 52 } |
| 53 | 53 |
| 54 static SkImageDecoder_DecodeReg gReg(sk_libbmp_dfactory); | 54 static SkImageDecoder_DecodeReg gReg(sk_libbmp_dfactory); |
| 55 | 55 |
| 56 static SkImageDecoder::Format get_format_bmp(SkStreamRewindable* stream) { | 56 static SkImageDecoder::Format get_format_bmp(SkStreamRewindable* stream) { |
| 57 if (is_bmp(stream)) { | 57 if (is_bmp(stream)) { |
| 58 return SkImageDecoder::kBMP_Format; | 58 return SkImageDecoder::kBMP_Format; |
| 59 } | 59 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const int dstHeight = sampler.scaledHeight(); | 153 const int dstHeight = sampler.scaledHeight(); |
| 154 const uint8_t* srcRow = callback.rgb(); | 154 const uint8_t* srcRow = callback.rgb(); |
| 155 | 155 |
| 156 srcRow += sampler.srcY0() * srcRowBytes; | 156 srcRow += sampler.srcY0() * srcRowBytes; |
| 157 for (int y = 0; y < dstHeight; y++) { | 157 for (int y = 0; y < dstHeight; y++) { |
| 158 sampler.next(srcRow); | 158 sampler.next(srcRow); |
| 159 srcRow += sampler.srcDY() * srcRowBytes; | 159 srcRow += sampler.srcDY() * srcRowBytes; |
| 160 } | 160 } |
| 161 return kSuccess; | 161 return kSuccess; |
| 162 } | 162 } |
| OLD | NEW |