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

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

Issue 845793005: choose better mip level (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: suppress known (better) gm changes Created 5 years, 11 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 | « expectations/gm/ignored-tests.txt ('k') | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkMipMap.h" 8 #include "SkMipMap.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const { 245 bool SkMipMap::extractLevel(SkScalar scale, Level* levelPtr) const {
246 if (NULL == fLevels) { 246 if (NULL == fLevels) {
247 return false; 247 return false;
248 } 248 }
249 249
250 if (scale >= SK_Scalar1) { 250 if (scale >= SK_Scalar1) {
251 return false; 251 return false;
252 } 252 }
253 253
254 int level = compute_level(scale) >> 16; 254 int level = SkFixedRoundToInt(compute_level(scale));
255 SkASSERT(level >= 0); 255 SkASSERT(level >= 0);
256 if (level <= 0) { 256 if (level <= 0) {
257 return false; 257 return false;
258 } 258 }
259 259
260 if (level > fCount) { 260 if (level > fCount) {
261 level = fCount; 261 level = fCount;
262 } 262 }
263 if (levelPtr) { 263 if (levelPtr) {
264 *levelPtr = fLevels[level - 1]; 264 *levelPtr = fLevels[level - 1];
265 } 265 }
266 return true; 266 return true;
267 } 267 }
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698