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

Unified Diff: src/gpu/effects/GrBicubicEffect.h

Issue 23779003: first cut at HQ GPU scaling; refactored existing bicubic scaler (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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
Index: src/gpu/effects/GrBicubicEffect.h
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
new file mode 100644
index 0000000000000000000000000000000000000000..b3060786ae9b3134e66b5ffb9ebd4c8276ae5b6b
--- /dev/null
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef GrBicubicTextureEffect_DEFINED
+#define GrBicubicTextureEffect_DEFINED
+
+#include "GrSingleTextureEffect.h"
+#include "GrDrawEffect.h"
+#include "gl/GrGLEffect.h"
+#include "gl/GrGLEffectMatrix.h"
+#include "GrTBackendEffectFactory.h"
+
+class GrGLBicubicEffect;
+
+class GrBicubicEffect : public GrSingleTextureEffect {
+public:
+ virtual ~GrBicubicEffect();
+
+ static const char* Name() { return "Bicubic"; }
+ const float* coefficients() const { return fCoefficients; }
+
+ typedef GrGLBicubicEffect GLEffect;
+
+ virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
+ virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
+
+ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients)));
+ return CreateEffectRef(effect);
+ }
+
+ static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
+ const SkMatrix& matrix,
+ const GrTextureParams& p,
+ CoordsType coordsType = kLocal_CoordsType) {
+ AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, p, coordsType)));
+ return CreateEffectRef(effect);
+ }
+
+private:
+ GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]);
+ GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
+ const SkMatrix &matrix, const GrTextureParams &p, CoordsType coordsType);
+ virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
+ float fCoefficients[16];
+
+ GR_DECLARE_EFFECT_TEST;
+
+ typedef GrSingleTextureEffect INHERITED;
+};
+
+class GrGLBicubicEffect : public GrGLEffect {
bsalomon 2013/09/03 20:55:17 We can move this class defn to the header... no on
+public:
+ GrGLBicubicEffect(const GrBackendEffectFactory& factory,
+ const GrDrawEffect&);
+ virtual void emitCode(GrGLShaderBuilder*,
+ const GrDrawEffect&,
+ EffectKey,
+ const char* outputColor,
+ const char* inputColor,
+ const TextureSamplerArray&) SK_OVERRIDE;
+
+ static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
+
+ virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVERRIDE;
+
+private:
+ typedef GrGLUniformManager::UniformHandle UniformHandle;
+
+ UniformHandle fCoefficientsUni;
+ UniformHandle fImageIncrementUni;
+
+ GrGLEffectMatrix fEffectMatrix;
+
+ typedef GrGLEffect INHERITED;
+};
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698