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

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

Issue 1510673002: Cap filtering to kMedium_SkFilterQuality when downsampling (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: OR Created 5 years 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 SkSize scale; 93 SkSize scale;
94 if (!fInvMatrix.decomposeScale(&scale)) { 94 if (!fInvMatrix.decomposeScale(&scale)) {
95 return false; 95 return false;
96 } 96 }
97 invScaleX = scale.width(); 97 invScaleX = scale.width();
98 invScaleY = scale.height(); 98 invScaleY = scale.height();
99 } 99 }
100 if (SkScalarNearlyEqual(invScaleX, 1) && SkScalarNearlyEqual(invScaleY, 1)) { 100 if (SkScalarNearlyEqual(invScaleX, 1) && SkScalarNearlyEqual(invScaleY, 1)) {
101 return false; // no need for HQ 101 return false; // no need for HQ
102 } 102 }
103
104 #ifndef SK_SUPPORT_LEGACY_HQ_DOWNSAMPLING
105 if (invScaleX > 1 || invScaleY > 1) {
106 return false; // only use HQ when upsampling
107 }
108 #endif
103 109
104 const int dstW = SkScalarRoundToScalar(provider.width() / invScaleX); 110 const int dstW = SkScalarRoundToScalar(provider.width() / invScaleX);
105 const int dstH = SkScalarRoundToScalar(provider.height() / invScaleY); 111 const int dstH = SkScalarRoundToScalar(provider.height() / invScaleY);
106 const SkBitmapCacheDesc desc = provider.makeCacheDesc(dstW, dstH); 112 const SkBitmapCacheDesc desc = provider.makeCacheDesc(dstW, dstH);
107 113
108 if (!SkBitmapCache::FindWH(desc, &fResultBitmap)) { 114 if (!SkBitmapCache::FindWH(desc, &fResultBitmap)) {
109 SkBitmap orig; 115 SkBitmap orig;
110 if (!provider.asBitmap(&orig)) { 116 if (!provider.asBitmap(&orig)) {
111 return false; 117 return false;
112 } 118 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 fResultBitmap.getColorTable()); 218 fResultBitmap.getColorTable());
213 } 219 }
214 220
215 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm, 221 SkBitmapController::State* SkDefaultBitmapController::onRequestBitmap(const SkBi tmapProvider& bm,
216 const SkMa trix& inverse, 222 const SkMa trix& inverse,
217 SkFilterQu ality quality, 223 SkFilterQu ality quality,
218 void* stor age, size_t size) { 224 void* stor age, size_t size) {
219 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality); 225 return SkInPlaceNewCheck<SkDefaultBitmapControllerState>(storage, size, bm, inverse, quality);
220 } 226 }
221 227
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