aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkBitmapProcShader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkBitmapProcShader.cpp')
-rw-r--r--src/core/SkBitmapProcShader.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 76ccb512b4..7fff799c11 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -9,6 +9,7 @@
#include "SkColorPriv.h"
#include "SkFlattenableBuffers.h"
#include "SkPixelRef.h"
+#include "SkErrorInternals.h"
bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
switch (bm.config()) {
@@ -353,7 +354,27 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
};
// Must set wrap and filter on the sampler before requesting a texture.
- GrTextureParams params(tm, paint.isFilterBitmap());
+ SkPaint::FilterLevel paintFilterLevel = paint.getFilterLevel();
+ GrTextureParams::FilterMode textureFilterMode;
+ switch(paintFilterLevel) {
+ case SkPaint::kNone_FilterLevel:
+ textureFilterMode = GrTextureParams::kNone_FilterMode;
+ break;
+ case SkPaint::kLow_FilterLevel:
+ textureFilterMode = GrTextureParams::kBilerp_FilterMode;
+ break;
+ case SkPaint::kMedium_FilterLevel:
+ 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;
+ break;
+ }
+ GrTextureParams params(tm, textureFilterMode);
GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &params);
if (NULL == texture) {