| 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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1173 textureFilterMode = GrTextureParams::kNone_FilterMode; |
| 1174 break; | 1174 break; |
| 1175 case SkPaint::kLow_FilterLevel: | 1175 case SkPaint::kLow_FilterLevel: |
| 1176 tileFilterPad = 1; | 1176 tileFilterPad = 1; |
| 1177 textureFilterMode = GrTextureParams::kBilerp_FilterMode; | 1177 textureFilterMode = GrTextureParams::kBilerp_FilterMode; |
| 1178 break; | 1178 break; |
| 1179 case SkPaint::kMedium_FilterLevel: | 1179 case SkPaint::kMedium_FilterLevel: |
| 1180 tileFilterPad = 1; | 1180 tileFilterPad = 1; |
| 1181 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1181 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 1182 break; | 1182 break; |
| 1183 case SkPaint::kHigh_FilterLevel: | 1183 case SkPaint::kHigh_FilterLevel: { |
| 1184 if (flags & SkCanvas::kBleed_DrawBitmapRectFlag) { | 1184 // Minification can look bad with the bicubic effect. |
| 1185 if (fContext->getMatrix().getMinStretch() >= SK_Scalar1 && |
| 1186 (flags & SkCanvas::kBleed_DrawBitmapRectFlag)) { |
| 1185 // We will install an effect that does the filtering in the shad
er. | 1187 // We will install an effect that does the filtering in the shad
er. |
| 1186 textureFilterMode = GrTextureParams::kNone_FilterMode; | 1188 textureFilterMode = GrTextureParams::kNone_FilterMode; |
| 1187 tileFilterPad = GrBicubicEffect::kFilterTexelPad; | 1189 tileFilterPad = GrBicubicEffect::kFilterTexelPad; |
| 1188 doBicubic = true; | 1190 doBicubic = true; |
| 1189 } else { | 1191 } else { |
| 1190 // We don't yet support doing bicubic filtering with an interior
clamp. Fall back | 1192 // We don't yet support doing bicubic filtering with an interior
clamp. Fall back |
| 1191 // to MIPs | 1193 // to MIPs |
| 1192 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1194 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 1193 tileFilterPad = 1; | 1195 tileFilterPad = 1; |
| 1194 } | 1196 } |
| 1195 break; | 1197 break; |
| 1198 } |
| 1196 default: | 1199 default: |
| 1197 SkErrorInternals::SetError( kInvalidPaint_SkError, | 1200 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 1198 "Sorry, I don't understand the filtering
" | 1201 "Sorry, I don't understand the filtering
" |
| 1199 "mode you asked for. Falling back to " | 1202 "mode you asked for. Falling back to " |
| 1200 "MIPMaps."); | 1203 "MIPMaps."); |
| 1201 tileFilterPad = 1; | 1204 tileFilterPad = 1; |
| 1202 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 1205 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 1203 break; | 1206 break; |
| 1204 } | 1207 } |
| 1205 | 1208 |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 GrTexture* texture, | 1884 GrTexture* texture, |
| 1882 bool needClear) | 1885 bool needClear) |
| 1883 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { | 1886 : SkBitmapDevice(make_bitmap(context, texture->asRenderTarget())) { |
| 1884 | 1887 |
| 1885 SkASSERT(texture && texture->asRenderTarget()); | 1888 SkASSERT(texture && texture->asRenderTarget()); |
| 1886 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture | 1889 // This constructor is called from onCreateCompatibleDevice. It has locked t
he RT in the texture |
| 1887 // cache. We pass true for the third argument so that it will get unlocked. | 1890 // cache. We pass true for the third argument so that it will get unlocked. |
| 1888 this->initFromRenderTarget(context, texture->asRenderTarget(), true); | 1891 this->initFromRenderTarget(context, texture->asRenderTarget(), true); |
| 1889 fNeedClear = needClear; | 1892 fNeedClear = needClear; |
| 1890 } | 1893 } |
| OLD | NEW |