Chromium Code Reviews| Index: src/core/SkBitmapProcShader.cpp |
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
| index 0e7ac6a27758b348ce549daa482055750bc4c392..24d3909542f0fa5d43da16d0ea7691c8d9b2457e 100644 |
| --- a/src/core/SkBitmapProcShader.cpp |
| +++ b/src/core/SkBitmapProcShader.cpp |
| @@ -11,6 +11,10 @@ |
| #include "SkPixelRef.h" |
| #include "SkErrorInternals.h" |
| +#include "../effects/SkBicubicImageFilter.h" |
|
reed1
2013/09/03 20:57:37
do we need the path to scope where these headers a
humper
2013/09/03 21:45:53
Probably not -- this one picks out a file from src
bsalomon
2013/09/04 13:06:15
I think we actually shouldn't have core depend on
|
| +#include "effects/GrSimpleTextureEffect.h" |
| +#include "effects/GrBicubicEffect.h" |
| + |
| bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) { |
| switch (bm.config()) { |
| case SkBitmap::kA8_Config: |
| @@ -367,11 +371,9 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
| textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| break; |
| case SkPaint::kHigh_FilterLevel: |
| - SkErrorInternals::SetError( kInvalidPaint_SkError, |
| - "Sorry, I don't yet support high quality " |
| - "filtering on the GPU; falling back to " |
| - "MIPMaps."); |
| - textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| + // fall back to no filtering here; we will install another |
| + // shader that will do the HQ filtering. |
| + textureFilterMode = GrTextureParams::kNone_FilterMode; |
| break; |
| default: |
| SkErrorInternals::SetError( kInvalidPaint_SkError, |
| @@ -386,11 +388,17 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
| GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, ¶ms); |
| if (NULL == texture) { |
| - SkDebugf("Couldn't convert bitmap to texture.\n"); |
| + SkErrorInternals::SetError( kInternalError_SkError, |
| + "Couldn't convert bitmap to texture."); |
| return NULL; |
| } |
| - GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| + GrEffectRef* effect = NULL; |
| + if (paintFilterLevel == SkPaint::kHigh_FilterLevel) { |
| + effect = GrBicubicEffect::Create(texture, SkBicubicImageFilter::fMitchellCoefficients, matrix, params); |
| + } else { |
| + effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| + } |
| GrUnlockAndUnrefCachedBitmapTexture(texture); |
| return effect; |
| } |