OLD | NEW |
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 "GrBitmapTextContext.h" | 10 #include "GrBitmapTextContext.h" |
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 | 1213 |
1214 // If there is no mask filter than it is OK to handle the src rect -> dst re
ct scaling using | 1214 // If there is no mask filter than it is OK to handle the src rect -> dst re
ct scaling using |
1215 // the view matrix rather than a local matrix. | 1215 // the view matrix rather than a local matrix. |
1216 SkMatrix m; | 1216 SkMatrix m; |
1217 m.setScale(dstSize.fWidth / srcRect.width(), | 1217 m.setScale(dstSize.fWidth / srcRect.width(), |
1218 dstSize.fHeight / srcRect.height()); | 1218 dstSize.fHeight / srcRect.height()); |
1219 SkMatrix viewM = *draw.fMatrix; | 1219 SkMatrix viewM = *draw.fMatrix; |
1220 viewM.preConcat(m); | 1220 viewM.preConcat(m); |
1221 | 1221 |
1222 GrTextureParams params; | 1222 GrTextureParams params; |
1223 SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel(); | 1223 SkFilterQuality paintFilterQuality = paint.getFilterQuality(); |
1224 GrTextureParams::FilterMode textureFilterMode; | 1224 GrTextureParams::FilterMode textureFilterMode; |
1225 | 1225 |
1226 bool doBicubic = false; | 1226 bool doBicubic = false; |
1227 | 1227 |
1228 switch(paintFilterLevel) { | 1228 switch(paintFilterQuality) { |
1229 case SkPaint::kNone_FilterLevel: | 1229 case kNone_SkFilterQuality: |
1230 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1230 textureFilterMode = GrTextureParams::kNone_FilterMode; |
1231 break; | 1231 break; |
1232 case SkPaint::kLow_FilterLevel: | 1232 case kLow_SkFilterQuality: |
1233 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1233 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
1234 break; | 1234 break; |
1235 case SkPaint::kMedium_FilterLevel: | 1235 case kMedium_SkFilterQuality: |
1236 if (viewM.getMinScale() < SK_Scalar1) { | 1236 if (viewM.getMinScale() < SK_Scalar1) { |
1237 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1237 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1238 } else { | 1238 } else { |
1239 // Don't trigger MIP level generation unnecessarily. | 1239 // Don't trigger MIP level generation unnecessarily. |
1240 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1240 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
1241 } | 1241 } |
1242 break; | 1242 break; |
1243 case SkPaint::kHigh_FilterLevel: | 1243 case kHigh_SkFilterQuality: |
1244 // Minification can look bad with the bicubic effect. | 1244 // Minification can look bad with the bicubic effect. |
1245 doBicubic = | 1245 doBicubic = |
1246 GrBicubicEffect::ShouldUseBicubic(viewM, &textureFilterMode); | 1246 GrBicubicEffect::ShouldUseBicubic(viewM, &textureFilterMode); |
1247 break; | 1247 break; |
1248 default: | 1248 default: |
1249 SkErrorInternals::SetError( kInvalidPaint_SkError, | 1249 SkErrorInternals::SetError( kInvalidPaint_SkError, |
1250 "Sorry, I don't understand the filtering
" | 1250 "Sorry, I don't understand the filtering
" |
1251 "mode you asked for. Falling back to " | 1251 "mode you asked for. Falling back to " |
1252 "MIPMaps."); | 1252 "MIPMaps."); |
1253 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1253 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1965 #endif | 1965 #endif |
1966 } | 1966 } |
1967 | 1967 |
1968 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { | 1968 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { |
1969 // We always return a transient cache, so it is freed after each | 1969 // We always return a transient cache, so it is freed after each |
1970 // filter traversal. | 1970 // filter traversal. |
1971 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); | 1971 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); |
1972 } | 1972 } |
1973 | 1973 |
1974 #endif | 1974 #endif |
OLD | NEW |