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

Side by Side Diff: src/core/SkBitmapController.cpp

Issue 1681953004: Use min scale when selecting mip level (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 // Our default return state is to downgrade the request to Low, w/ or w/o se tting fBitmap 164 // Our default return state is to downgrade the request to Low, w/ or w/o se tting fBitmap
165 // to a valid bitmap. 165 // to a valid bitmap.
166 fQuality = kLow_SkFilterQuality; 166 fQuality = kLow_SkFilterQuality;
167 167
168 SkSize invScaleSize; 168 SkSize invScaleSize;
169 if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) { 169 if (!fInvMatrix.decomposeScale(&invScaleSize, nullptr)) {
170 return false; 170 return false;
171 } 171 }
172 172
173 // Use the largest (non-inverse) scale, to ensure anisotropic consistency. 173 // Use the smallest (non-inverse) scale to match the GPU impl.
174 SkASSERT(invScaleSize.width() >= 0 && invScaleSize.height() >= 0); 174 SkASSERT(invScaleSize.width() >= 0 && invScaleSize.height() >= 0);
175 const SkScalar invScale = SkTMin(invScaleSize.width(), invScaleSize.height() ); 175 const SkScalar invScale = SkTMax(invScaleSize.width(), invScaleSize.height() );
176 176
177 if (invScale > SK_Scalar1) { 177 if (invScale > SK_Scalar1) {
178 fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc())); 178 fCurrMip.reset(SkMipMapCache::FindAndRef(provider.makeCacheDesc()));
179 if (nullptr == fCurrMip.get()) { 179 if (nullptr == fCurrMip.get()) {
180 SkBitmap orig; 180 SkBitmap orig;
181 if (!provider.asBitmap(&orig)) { 181 if (!provider.asBitmap(&orig)) {
182 return false; 182 return false;
183 } 183 }
184 fCurrMip.reset(SkMipMapCache::AddAndRef(orig)); 184 fCurrMip.reset(SkMipMapCache::AddAndRef(orig));
185 if (nullptr == fCurrMip.get()) { 185 if (nullptr == fCurrMip.get()) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 fResultBitmap.getColorTable()); 229 fResultBitmap.getColorTable());
230 } 230 }
231 231
232 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm, 232 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm,
233 const SkMa trix& inverse, 233 const SkMa trix& inverse,
234 SkFilterQu ality quality, 234 SkFilterQu ality quality,
235 void* stor age, size_t size) { 235 void* stor age, size_t size) {
236 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality); 236 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality);
237 } 237 }
238 238
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698