Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: src/core/SkBitmapController.cpp

Issue 1686563002: Relocate anisotropic mipmap logic to SkMipMap::extractLevel() (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/showmiplevels.cpp ('k') | src/core/SkMipMap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapController.cpp
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index b21c0f27915502b5c21f3e9061525b633a7844b9..055594743172e564f1ba8e331a57294ef5982e0d 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -165,11 +165,7 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
return false;
}
- // Use the smallest (non-inverse) scale to match the GPU impl.
- SkASSERT(invScaleSize.width() >= 0 && invScaleSize.height() >= 0);
- const SkScalar invScale = SkTMax(invScaleSize.width(), invScaleSize.height());
-
- if (invScale > SK_Scalar1) {
+ if (invScaleSize.width() > SK_Scalar1 || invScaleSize.height() > SK_Scalar1) {
fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc()));
if (nullptr == fCurrMip.get()) {
SkBitmap orig;
@@ -186,9 +182,10 @@ bool SkDefaultBitmapControllerState::processMediumRequest(const SkBitmapProvider
sk_throw();
}
- SkScalar levelScale = SkScalarInvert(invScale);
+ const SkSize scale = SkSize::Make(SkScalarInvert(invScaleSize.width()),
+ SkScalarInvert(invScaleSize.height()));
SkMipMap::Level level;
- if (fCurrMip->extractLevel(levelScale, &level)) {
+ if (fCurrMip->extractLevel(scale, &level)) {
const SkSize& invScaleFixup = level.fScale;
fInvMatrix.postScale(invScaleFixup.width(), invScaleFixup.height());
« no previous file with comments | « gm/showmiplevels.cpp ('k') | src/core/SkMipMap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698