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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 if (!orig.requestLock(&src)) { | 114 if (!orig.requestLock(&src)) { |
115 return false; | 115 return false; |
116 } | 116 } |
117 if (!SkBitmapScaler::Resize(&fResultBitmap, src.pixmap(), kHQ_RESIZE_MET
HOD, | 117 if (!SkBitmapScaler::Resize(&fResultBitmap, src.pixmap(), kHQ_RESIZE_MET
HOD, |
118 dstW, dstH, SkResourceCache::GetAllocator())
) { | 118 dstW, dstH, SkResourceCache::GetAllocator())
) { |
119 return false; // we failed to create fScaledBitmap | 119 return false; // we failed to create fScaledBitmap |
120 } | 120 } |
121 | 121 |
122 SkASSERT(fResultBitmap.getPixels()); | 122 SkASSERT(fResultBitmap.getPixels()); |
123 fResultBitmap.setImmutable(); | 123 fResultBitmap.setImmutable(); |
124 if (SkBitmapCache::AddWH(desc, fResultBitmap)) { | 124 if (!provider.isVolatile()) { |
125 provider.notifyAddedToCache(); | 125 if (SkBitmapCache::AddWH(desc, fResultBitmap)) { |
| 126 provider.notifyAddedToCache(); |
| 127 } |
126 } | 128 } |
127 } | 129 } |
128 | 130 |
129 SkASSERT(fResultBitmap.getPixels()); | 131 SkASSERT(fResultBitmap.getPixels()); |
130 | 132 |
131 fInvMatrix.postScale(SkIntToScalar(dstW) / provider.width(), | 133 fInvMatrix.postScale(SkIntToScalar(dstW) / provider.width(), |
132 SkIntToScalar(dstH) / provider.height()); | 134 SkIntToScalar(dstH) / provider.height()); |
133 fQuality = kLow_SkFilterQuality; | 135 fQuality = kLow_SkFilterQuality; |
134 return true; | 136 return true; |
135 } | 137 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 fResultBitmap.getColorTable()); | 212 fResultBitmap.getColorTable()); |
211 } | 213 } |
212 | 214 |
213 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, | 215 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi
tmapProvider& bm, |
214 const SkMa
trix& inverse, | 216 const SkMa
trix& inverse, |
215 SkFilterQu
ality quality, | 217 SkFilterQu
ality quality, |
216 void* stor
age, size_t size) { | 218 void* stor
age, size_t size) { |
217 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); | 219 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm,
inverse, quality); |
218 } | 220 } |
219 | 221 |
OLD | NEW |