| 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 | 154 |
| 155 // Our default return state is to downgrade the request to Low, w/ or w/o se
tting fBitmap | 155 // Our default return state is to downgrade the request to Low, w/ or w/o se
tting fBitmap |
| 156 // to a valid bitmap. | 156 // to a valid bitmap. |
| 157 fQuality = kLow_SkFilterQuality; | 157 fQuality = kLow_SkFilterQuality; |
| 158 | 158 |
| 159 SkSize invScaleSize; | 159 SkSize invScaleSize; |
| 160 if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) { | 160 if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) { |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 | 163 |
| 164 #ifdef SK_SUPPORT_LEGACY_ANISOTROPIC_MIPMAPS | |
| 165 SkScalar invScale = SkScalarSqrt(invScaleSize.width() * invScaleSize.height(
)); | |
| 166 #else | |
| 167 // Use the largest (non-inverse) scale, to ensure anisotropic consistency. | 164 // Use the largest (non-inverse) scale, to ensure anisotropic consistency. |
| 168 SkASSERT(invScaleSize.width() >= 0 && invScaleSize.height() >= 0); | 165 SkASSERT(invScaleSize.width() >= 0 && invScaleSize.height() >= 0); |
| 169 const SkScalar invScale = SkTMin(invScaleSize.width(), invScaleSize.height()
); | 166 const SkScalar invScale = SkTMin(invScaleSize.width(), invScaleSize.height()
); |
| 170 #endif | |
| 171 | 167 |
| 172 if (invScale > SK_Scalar1) { | 168 if (invScale > SK_Scalar1) { |
| 173 fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc())); | 169 fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc())); |
| 174 if (nullptr == fCurrMip.get()) { | 170 if (nullptr == fCurrMip.get()) { |
| 175 SkBitmap orig; | 171 SkBitmap orig; |
| 176 if (!provider.asBitmap(&orig)) { | 172 if (!provider.asBitmap(&orig)) { |
| 177 return false; | 173 return false; |
| 178 } | 174 } |
| 179 fCurrMip.reset(SkMipMapCache::AddAndRef(orig)); | 175 fCurrMip.reset(SkMipMapCache::AddAndRef(orig)); |
| 180 if (nullptr == fCurrMip.get()) { | 176 if (nullptr == fCurrMip.get()) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 fResultBitmap.getColorTable()); | 220 fResultBitmap.getColorTable()); |
| 225 } | 221 } |
| 226 | 222 |
| 227 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, | 223 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, |
| 228 const SkMa
trix& inverse, | 224 const SkMa
trix& inverse, |
| 229 SkFilterQu
ality quality, | 225 SkFilterQu
ality quality, |
| 230 void* stor
age, size_t size) { | 226 void* stor
age, size_t size) { |
| 231 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); | 227 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); |
| 232 } | 228 } |
| 233 | 229 |
| OLD | NEW |