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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 if (fJustBounds) { | 61 if (fJustBounds) { |
62 return NULL; | 62 return NULL; |
63 } | 63 } |
64 | 64 |
65 fRGB.setCount(width * height * 3); // 3 == r, g, b | 65 fRGB.setCount(width * height * 3); // 3 == r, g, b |
66 return fRGB.begin(); | 66 return fRGB.begin(); |
67 } | 67 } |
68 | 68 |
69 int width() const { return fWidth; } | 69 int width() const { return fWidth; } |
70 int height() const { return fHeight; } | 70 int height() const { return fHeight; } |
71 uint8_t* rgb() const { return fRGB.begin(); } | 71 const uint8_t* rgb() const { return fRGB.begin(); } |
72 | 72 |
73 private: | 73 private: |
74 SkTDArray<uint8_t> fRGB; | 74 SkTDArray<uint8_t> fRGB; |
75 int fWidth; | 75 int fWidth; |
76 int fHeight; | 76 int fHeight; |
77 bool fJustBounds; | 77 bool fJustBounds; |
78 }; | 78 }; |
79 | 79 |
80 bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { | 80 bool SkBMPImageDecoder::onDecode(SkStream* stream, SkBitmap* bm, Mode mode) { |
81 | 81 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 const int dstHeight = sampler.scaledHeight(); | 135 const int dstHeight = sampler.scaledHeight(); |
136 const uint8_t* srcRow = callback.rgb(); | 136 const uint8_t* srcRow = callback.rgb(); |
137 | 137 |
138 srcRow += sampler.srcY0() * srcRowBytes; | 138 srcRow += sampler.srcY0() * srcRowBytes; |
139 for (int y = 0; y < dstHeight; y++) { | 139 for (int y = 0; y < dstHeight; y++) { |
140 sampler.next(srcRow); | 140 sampler.next(srcRow); |
141 srcRow += sampler.srcDY() * srcRowBytes; | 141 srcRow += sampler.srcDY() * srcRowBytes; |
142 } | 142 } |
143 return true; | 143 return true; |
144 } | 144 } |
OLD | NEW |