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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1187 textureFilterMode = GrTextureParams::kNone_FilterMode; |
1188 break; | 1188 break; |
1189 case SkPaint::kLow_FilterLevel: | 1189 case SkPaint::kLow_FilterLevel: |
1190 tileFilterPad = 1; | 1190 tileFilterPad = 1; |
1191 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1191 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
1192 break; | 1192 break; |
1193 case SkPaint::kMedium_FilterLevel: | 1193 case SkPaint::kMedium_FilterLevel: |
1194 tileFilterPad = 1; | 1194 tileFilterPad = 1; |
1195 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1195 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1196 break; | 1196 break; |
1197 case SkPaint::kHigh_FilterLevel: | 1197 case SkPaint::kHigh_FilterLevel: { |
1198 if (flags & SkCanvas::kBleed_DrawBitmapRectFlag) { | 1198 // Minification can look bad with the bicubic effect. |
| 1199 if (fContext->getMatrix().getMinStretch() >= SK_Scalar1 && |
| 1200 (flags & SkCanvas::kBleed_DrawBitmapRectFlag)) { |
1199 // We will install an effect that does the filtering in the shad
er. | 1201 // We will install an effect that does the filtering in the shad
er. |
1200 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1202 textureFilterMode = GrTextureParams::kNone_FilterMode; |
1201 tileFilterPad = GrBicubicEffect::kFilterTexelPad; | 1203 tileFilterPad = GrBicubicEffect::kFilterTexelPad; |
1202 doBicubic = true; | 1204 doBicubic = true; |
1203 } else { | 1205 } else { |
1204 // We don't yet support doing bicubic filtering with an interior
clamp. Fall back | 1206 // We don't yet support doing bicubic filtering with an interior
clamp. Fall back |
1205 // to MIPs | 1207 // to MIPs |
1206 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1208 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1207 tileFilterPad = 1; | 1209 tileFilterPad = 1; |
1208 } | 1210 } |
1209 break; | 1211 break; |
| 1212 } |
1210 default: | 1213 default: |
1211 SkErrorInternals::SetError( kInvalidPaint_SkError, | 1214 SkErrorInternals::SetError( kInvalidPaint_SkError, |
1212 "Sorry, I don't understand the filtering
" | 1215 "Sorry, I don't understand the filtering
" |
1213 "mode you asked for. Falling back to " | 1216 "mode you asked for. Falling back to " |
1214 "MIPMaps."); | 1217 "MIPMaps."); |
1215 tileFilterPad = 1; | 1218 tileFilterPad = 1; |
1216 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1219 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
1217 break; | 1220 break; |
1218 } | 1221 } |
1219 | 1222 |
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1895 GrTexture* texture, | 1898 GrTexture* texture, |
1896 bool needClear) | 1899 bool needClear) |
1897 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1900 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
1898 | 1901 |
1899 SkASSERT(texture && texture->asRenderTarget()); | 1902 SkASSERT(texture && texture->asRenderTarget()); |
1900 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1903 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
1901 // cache. We pass true for the third argument so that it will get unlocked. | 1904 // cache. We pass true for the third argument so that it will get unlocked. |
1902 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1905 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
1903 fNeedClear = needClear; | 1906 fNeedClear = needClear; |
1904 } | 1907 } |
OLD | NEW |