Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: src/core/SkBitmapProcShader.cpp

Issue 23779003: first cut at HQ GPU scaling; refactored existing bicubic scaler (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: final version for trybots Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkError.h ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapProcShader.cpp
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp
index 0e7ac6a27758b348ce549daa482055750bc4c392..70b5212b95df2fcbd0796b8e2459abc42a468a92 100644
--- a/src/core/SkBitmapProcShader.cpp
+++ b/src/core/SkBitmapProcShader.cpp
@@ -5,11 +5,14 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "SkBitmapProcShader.h"
#include "SkColorPriv.h"
#include "SkFlattenableBuffers.h"
#include "SkPixelRef.h"
#include "SkErrorInternals.h"
+#include "SkBitmapProcShader.h"
+
+#include "effects/GrSimpleTextureEffect.h"
+#include "effects/GrBicubicEffect.h"
bool SkBitmapProcShader::CanDo(const SkBitmap& bm, TileMode tx, TileMode ty) {
switch (bm.config()) {
@@ -367,11 +370,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 +387,17 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint&
GrTexture* texture = GrLockAndRefCachedBitmapTexture(context, fRawBitmap, &params);
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, matrix, params);
+ } else {
+ effect = GrSimpleTextureEffect::Create(texture, matrix, params);
+ }
GrUnlockAndUnrefCachedBitmapTexture(texture);
return effect;
}
« no previous file with comments | « include/core/SkError.h ('k') | src/effects/SkBicubicImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698