OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBitmapController.h" | 9 #include "SkBitmapController.h" |
10 #include "SkBitmapProvider.h" | 10 #include "SkBitmapProvider.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (nullptr == fCurrMip->data()) { | 178 if (nullptr == fCurrMip->data()) { |
179 sk_throw(); | 179 sk_throw(); |
180 } | 180 } |
181 | 181 |
182 SkScalar levelScale = SkScalarInvert(invScale); | 182 SkScalar levelScale = SkScalarInvert(invScale); |
183 SkMipMap::Level level; | 183 SkMipMap::Level level; |
184 if (fCurrMip->extractLevel(levelScale, &level)) { | 184 if (fCurrMip->extractLevel(levelScale, &level)) { |
185 SkScalar invScaleFixup = level.fScale; | 185 SkScalar invScaleFixup = level.fScale; |
186 fInvMatrix.postScale(invScaleFixup, invScaleFixup); | 186 fInvMatrix.postScale(invScaleFixup, invScaleFixup); |
187 | 187 |
188 const SkImageInfo info = provider.info().makeWH(level.fWidth, level.
fHeight); | |
189 // todo: if we could wrap the fCurrMip in a pixelref, then we could
just install | 188 // todo: if we could wrap the fCurrMip in a pixelref, then we could
just install |
190 // that here, and not need to explicitly track it ourselves. | 189 // that here, and not need to explicitly track it ourselves. |
191 return fResultBitmap.installPixels(info, level.fPixels, level.fRowBy
tes); | 190 return fResultBitmap.installPixels(level.fPixmap); |
192 } else { | 191 } else { |
193 // failed to extract, so release the mipmap | 192 // failed to extract, so release the mipmap |
194 fCurrMip.reset(nullptr); | 193 fCurrMip.reset(nullptr); |
195 } | 194 } |
196 } | 195 } |
197 return false; | 196 return false; |
198 } | 197 } |
199 | 198 |
200 SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmapPro
vider& provider, | 199 SkDefaultBitmapControllerState::SkDefaultBitmapControllerState(const SkBitmapPro
vider& provider, |
201 const SkMatrix& i
nv, | 200 const SkMatrix& i
nv, |
(...skipping 16 matching lines...) Expand all Loading... |
218 fResultBitmap.getColorTable()); | 217 fResultBitmap.getColorTable()); |
219 } | 218 } |
220 | 219 |
221 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, | 220 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, |
222 const SkMa
trix& inverse, | 221 const SkMa
trix& inverse, |
223 SkFilterQu
ality quality, | 222 SkFilterQu
ality quality, |
224 void* stor
age, size_t size) { | 223 void* stor
age, size_t size) { |
225 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); | 224 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); |
226 } | 225 } |
227 | 226 |
OLD | NEW |