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 128 matching lines...) Loading... |
139 if (justBounds) { | 139 if (justBounds) { |
140 return true; | 140 return true; |
141 } | 141 } |
142 | 142 |
143 if (!this->allocPixelRef(bm, NULL)) { | 143 if (!this->allocPixelRef(bm, NULL)) { |
144 return false; | 144 return false; |
145 } | 145 } |
146 | 146 |
147 SkAutoLockPixels alp(*bm); | 147 SkAutoLockPixels alp(*bm); |
148 | 148 |
149 if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, getDitherImage())) { | 149 if (!sampler.begin(bm, SkScaledBitmapSampler::kRGB, *this)) { |
150 return false; | 150 return false; |
151 } | 151 } |
152 | 152 |
153 const int srcRowBytes = width * 3; | 153 const int srcRowBytes = width * 3; |
154 const int dstHeight = sampler.scaledHeight(); | 154 const int dstHeight = sampler.scaledHeight(); |
155 const uint8_t* srcRow = callback.rgb(); | 155 const uint8_t* srcRow = callback.rgb(); |
156 | 156 |
157 srcRow += sampler.srcY0() * srcRowBytes; | 157 srcRow += sampler.srcY0() * srcRowBytes; |
158 for (int y = 0; y < dstHeight; y++) { | 158 for (int y = 0; y < dstHeight; y++) { |
159 sampler.next(srcRow); | 159 sampler.next(srcRow); |
160 srcRow += sampler.srcDY() * srcRowBytes; | 160 srcRow += sampler.srcDY() * srcRowBytes; |
161 } | 161 } |
162 return true; | 162 return true; |
163 } | 163 } |
OLD | NEW |