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 "effects/GrBicubicEffect.h" | 10 #include "effects/GrBicubicEffect.h" |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1177 case SkPaint::kNone_FilterLevel: | 1177 case SkPaint::kNone_FilterLevel: |
1178 tileFilterPad = 0; | 1178 tileFilterPad = 0; |
1179 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1179 textureFilterMode = GrTextureParams::kNone_FilterMode; |
1180 break; | 1180 break; |
1181 case SkPaint::kLow_FilterLevel: | 1181 case SkPaint::kLow_FilterLevel: |
1182 tileFilterPad = 1; | 1182 tileFilterPad = 1; |
1183 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1183 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
1184 break; | 1184 break; |
1185 case SkPaint::kMedium_FilterLevel: | 1185 case SkPaint::kMedium_FilterLevel: |
1186 tileFilterPad = 1; | 1186 tileFilterPad = 1; |
1187 if (fContext->getMatrix().getMinStretch() < SK_Scalar1) { | 1187 if (fContext->getMatrix().getMinScale() < SK_Scalar1) { |
1188 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1188 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1189 } else { | 1189 } else { |
1190 // Don't trigger MIP level generation unnecessarily. | 1190 // Don't trigger MIP level generation unnecessarily. |
1191 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1191 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
1192 } | 1192 } |
1193 break; | 1193 break; |
1194 case SkPaint::kHigh_FilterLevel: | 1194 case SkPaint::kHigh_FilterLevel: |
1195 // Minification can look bad with the bicubic effect. | 1195 // Minification can look bad with the bicubic effect. |
1196 if (fContext->getMatrix().getMinStretch() >= SK_Scalar1) { | 1196 if (fContext->getMatrix().getMinScale() >= SK_Scalar1) { |
1197 // We will install an effect that does the filtering in the shad
er. | 1197 // We will install an effect that does the filtering in the shad
er. |
1198 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1198 textureFilterMode = GrTextureParams::kNone_FilterMode; |
1199 tileFilterPad = GrBicubicEffect::kFilterTexelPad; | 1199 tileFilterPad = GrBicubicEffect::kFilterTexelPad; |
1200 doBicubic = true; | 1200 doBicubic = true; |
1201 } else { | 1201 } else { |
1202 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1202 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1203 tileFilterPad = 1; | 1203 tileFilterPad = 1; |
1204 } | 1204 } |
1205 break; | 1205 break; |
1206 default: | 1206 default: |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1990 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); | 1990 GrCachedLayer* layer = fContext->getLayerCache()->findLayerOrCreate(pict
ure, i); |
1991 | 1991 |
1992 if (NULL != layer->getTexture()) { | 1992 if (NULL != layer->getTexture()) { |
1993 fContext->unlockScratchTexture(layer->getTexture()); | 1993 fContext->unlockScratchTexture(layer->getTexture()); |
1994 layer->setTexture(NULL); | 1994 layer->setTexture(NULL); |
1995 } | 1995 } |
1996 } | 1996 } |
1997 | 1997 |
1998 return true; | 1998 return true; |
1999 } | 1999 } |
OLD | NEW |