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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #ifndef GrBicubicTextureEffect_DEFINED
9 #define GrBicubicTextureEffect_DEFINED
10
11 #include "GrSingleTextureEffect.h"
12 #include "GrDrawEffect.h"
13 #include "gl/GrGLEffect.h"
14 #include "gl/GrGLEffectMatrix.h"
15 #include "GrTBackendEffectFactory.h"
16
17 class GrGLBicubicEffect;
18
19 class GrBicubicEffect : public GrSingleTextureEffect {
20 public:
21 virtual ~GrBicubicEffect();
22
23 static const char* Name() { return "Bicubic"; }
24 const float* coefficients() const { return fCoefficients; }
25
26 typedef GrGLBicubicEffect GLEffect;
27
28 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE;
29 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
30
31 static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16]) {
32 AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients))) ;
33 return CreateEffectRef(effect);
34 }
35
36 static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
37 const SkMatrix& matrix,
38 const GrTextureParams& p,
39 CoordsType coordsType = kLocal_CoordsType) {
40 AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, m atrix, p, coordsType)));
41 return CreateEffectRef(effect);
42 }
43
44 private:
45 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16]);
46 GrBicubicEffect(GrTexture*, const SkScalar coefficients[16],
47 const SkMatrix &matrix, const GrTextureParams &p, CoordsType coordsType);
48 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;
49 float fCoefficients[16];
50
51 GR_DECLARE_EFFECT_TEST;
52
53 typedef GrSingleTextureEffect INHERITED;
54 };
55
56 class GrGLBicubicEffect : public GrGLEffect {
bsalomon 2013/09/03 20:55:17 We can move this class defn to the header... no on
57 public:
58 GrGLBicubicEffect(const GrBackendEffectFactory& factory,
59 const GrDrawEffect&);
60 virtual void emitCode(GrGLShaderBuilder*,
61 const GrDrawEffect&,
62 EffectKey,
63 const char* outputColor,
64 const char* inputColor,
65 const TextureSamplerArray&) SK_OVERRIDE;
66
67 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&);
68
69 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE;
70
71 private:
72 typedef GrGLUniformManager::UniformHandle UniformHandle;
73
74 UniformHandle fCoefficientsUni;
75 UniformHandle fImageIncrementUni;
76
77 GrGLEffectMatrix fEffectMatrix;
78
79 typedef GrGLEffect INHERITED;
80 };
81
82 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698