| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
| 9 #include "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 SkMipMapCache::Add(fOrigBitmap, fCurrMip); | 267 SkMipMapCache::Add(fOrigBitmap, fCurrMip); |
| 268 } | 268 } |
| 269 | 269 |
| 270 SkScalar levelScale = SkScalarInvert(SkScalarSqrt(scaleSqd)); | 270 SkScalar levelScale = SkScalarInvert(SkScalarSqrt(scaleSqd)); |
| 271 SkMipMap::Level level; | 271 SkMipMap::Level level; |
| 272 if (fCurrMip->extractLevel(levelScale, &level)) { | 272 if (fCurrMip->extractLevel(levelScale, &level)) { |
| 273 SkScalar invScaleFixup = level.fScale; | 273 SkScalar invScaleFixup = level.fScale; |
| 274 fInvMatrix.postScale(invScaleFixup, invScaleFixup); | 274 fInvMatrix.postScale(invScaleFixup, invScaleFixup); |
| 275 | 275 |
| 276 SkImageInfo info = fOrigBitmap.info(); | 276 const SkImageInfo info = fOrigBitmap.info().makeWH(level.fWidth, lev
el.fHeight); |
| 277 info.fWidth = level.fWidth; | |
| 278 info.fHeight = level.fHeight; | |
| 279 // todo: if we could wrap the fCurrMip in a pixelref, then we could
just install | 277 // todo: if we could wrap the fCurrMip in a pixelref, then we could
just install |
| 280 // that here, and not need to explicitly track it ourselves. | 278 // that here, and not need to explicitly track it ourselves. |
| 281 fScaledBitmap.installPixels(info, level.fPixels, level.fRowBytes); | 279 fScaledBitmap.installPixels(info, level.fPixels, level.fRowBytes); |
| 282 fBitmap = &fScaledBitmap; | 280 fBitmap = &fScaledBitmap; |
| 283 fFilterLevel = SkPaint::kLow_FilterLevel; | 281 fFilterLevel = SkPaint::kLow_FilterLevel; |
| 284 return true; | 282 return true; |
| 285 } | 283 } |
| 286 } | 284 } |
| 287 | 285 |
| 288 return false; | 286 return false; |
| (...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 } else { | 1006 } else { |
| 1009 size >>= 2; | 1007 size >>= 2; |
| 1010 } | 1008 } |
| 1011 | 1009 |
| 1012 if (fFilterLevel != SkPaint::kNone_FilterLevel) { | 1010 if (fFilterLevel != SkPaint::kNone_FilterLevel) { |
| 1013 size >>= 1; | 1011 size >>= 1; |
| 1014 } | 1012 } |
| 1015 | 1013 |
| 1016 return size; | 1014 return size; |
| 1017 } | 1015 } |
| OLD | NEW |