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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 103913012: Tweaks in how to apply bitmap filter levels in GPU. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: upload again, rietveld diff failed. Created 7 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 | Annotate | Revision Log
OLDNEW
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 "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "effects/GrBicubicEffect.h" 10 #include "effects/GrBicubicEffect.h"
(...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 case SkPaint::kNone_FilterLevel: 1197 case SkPaint::kNone_FilterLevel:
1198 tileFilterPad = 0; 1198 tileFilterPad = 0;
1199 textureFilterMode = GrTextureParams::kNone_FilterMode; 1199 textureFilterMode = GrTextureParams::kNone_FilterMode;
1200 break; 1200 break;
1201 case SkPaint::kLow_FilterLevel: 1201 case SkPaint::kLow_FilterLevel:
1202 tileFilterPad = 1; 1202 tileFilterPad = 1;
1203 textureFilterMode = GrTextureParams::kBilerp_FilterMode; 1203 textureFilterMode = GrTextureParams::kBilerp_FilterMode;
1204 break; 1204 break;
1205 case SkPaint::kMedium_FilterLevel: 1205 case SkPaint::kMedium_FilterLevel:
1206 tileFilterPad = 1; 1206 tileFilterPad = 1;
1207 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 1207 if (fContext->getMatrix().getMinStretch() < SK_Scalar1) {
1208 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
1209 } else {
1210 // Don't trigger MIP level generation unnecessarily.
1211 textureFilterMode = GrTextureParams::kBilerp_FilterMode;
1212 }
1208 break; 1213 break;
1209 case SkPaint::kHigh_FilterLevel: { 1214 case SkPaint::kHigh_FilterLevel:
1210 // Minification can look bad with the bicubic effect. 1215 // Minification can look bad with the bicubic effect.
1211 if (fContext->getMatrix().getMinStretch() >= SK_Scalar1) { 1216 if (fContext->getMatrix().getMinStretch() >= SK_Scalar1) {
1212 // We will install an effect that does the filtering in the shad er. 1217 // We will install an effect that does the filtering in the shad er.
1213 textureFilterMode = GrTextureParams::kNone_FilterMode; 1218 textureFilterMode = GrTextureParams::kNone_FilterMode;
1214 tileFilterPad = GrBicubicEffect::kFilterTexelPad; 1219 tileFilterPad = GrBicubicEffect::kFilterTexelPad;
1215 doBicubic = true; 1220 doBicubic = true;
1216 } else { 1221 } else {
1217 // We don't yet support doing bicubic filtering with an interior clamp. Fall back
1218 // to MIPs
1219 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 1222 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
1220 tileFilterPad = 1; 1223 tileFilterPad = 1;
1221 } 1224 }
1222 break; 1225 break;
1223 }
1224 default: 1226 default:
1225 SkErrorInternals::SetError( kInvalidPaint_SkError, 1227 SkErrorInternals::SetError( kInvalidPaint_SkError,
1226 "Sorry, I don't understand the filtering " 1228 "Sorry, I don't understand the filtering "
1227 "mode you asked for. Falling back to " 1229 "mode you asked for. Falling back to "
1228 "MIPMaps."); 1230 "MIPMaps.");
1229 tileFilterPad = 1; 1231 tileFilterPad = 1;
1230 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 1232 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
1231 break; 1233 break;
1232 } 1234 }
1233 1235
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1912 GrTexture* texture, 1914 GrTexture* texture,
1913 bool needClear) 1915 bool needClear)
1914 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { 1916 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) {
1915 1917
1916 SkASSERT(texture && texture->asRenderTarget()); 1918 SkASSERT(texture && texture->asRenderTarget());
1917 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture 1919 // This constructor is called from onCreateCompatibleDevice. It has locked t he RT in the texture
1918 // cache. We pass true for the third argument so that it will get unlocked. 1920 // cache. We pass true for the third argument so that it will get unlocked.
1919 this->initFromRenderTarget(context, texture->asRenderTarget(), true); 1921 this->initFromRenderTarget(context, texture->asRenderTarget(), true);
1920 fNeedClear = needClear; 1922 fNeedClear = needClear;
1921 } 1923 }
OLDNEW
« src/core/SkBitmapProcShader.cpp ('K') | « src/core/SkBitmapProcShader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698