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

Side by Side Diff: src/gpu/effects/GrBicubicEffect.cpp

Issue 37003005: use the supplied matrix instead of the texture w/h div for the bicubic GPU effect (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add option to clippedbitmap to demonstrate bug this fixes Created 7 years, 1 month 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
« no previous file with comments | « gm/clippedbitmapshaders.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "GrBicubicEffect.h" 1 #include "GrBicubicEffect.h"
2 2
3 #define DS(x) SkDoubleToScalar(x) 3 #define DS(x) SkDoubleToScalar(x)
4 4
5 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = { 5 const SkScalar GrBicubicEffect::gMitchellCoefficients[16] = {
6 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0), 6 DS( 1.0 / 18.0), DS(-9.0 / 18.0), DS( 15.0 / 18.0), DS( -7.0 / 18.0),
7 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0), 7 DS(16.0 / 18.0), DS( 0.0 / 18.0), DS(-36.0 / 18.0), DS( 21.0 / 18.0),
8 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0), 8 DS( 1.0 / 18.0), DS( 9.0 / 18.0), DS( 27.0 / 18.0), DS(-21.0 / 18.0),
9 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0), 9 DS( 0.0 / 18.0), DS( 0.0 / 18.0), DS( -6.0 / 18.0), DS( 7.0 / 18.0),
10 }; 10 };
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 } 109 }
110 } 110 }
111 this->setWillNotUseInputColor(); 111 this->setWillNotUseInputColor();
112 } 112 }
113 113
114 GrBicubicEffect::GrBicubicEffect(GrTexture* texture, 114 GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
115 const SkScalar coefficients[16], 115 const SkScalar coefficients[16],
116 const SkMatrix &matrix, 116 const SkMatrix &matrix,
117 const GrTextureParams &params, 117 const GrTextureParams &params,
118 GrCoordSet coordSet) 118 GrCoordSet coordSet)
119 : INHERITED(texture, MakeDivByTextureWHMatrix(texture), params, coordSet) { 119 : INHERITED(texture, matrix, params, coordSet) {
120 for (int y = 0; y < 4; y++) { 120 for (int y = 0; y < 4; y++) {
121 for (int x = 0; x < 4; x++) { 121 for (int x = 0; x < 4; x++) {
122 // Convert from row-major scalars to column-major floats. 122 // Convert from row-major scalars to column-major floats.
123 fCoefficients[x * 4 + y] = SkScalarToFloat(coefficients[y * 4 + x]); 123 fCoefficients[x * 4 + y] = SkScalarToFloat(coefficients[y * 4 + x]);
124 } 124 }
125 } 125 }
126 this->setWillNotUseInputColor(); 126 this->setWillNotUseInputColor();
127 } 127 }
128 128
129 GrBicubicEffect::~GrBicubicEffect() { 129 GrBicubicEffect::~GrBicubicEffect() {
(...skipping 22 matching lines...) Expand all
152 const GrDrawTargetCaps&, 152 const GrDrawTargetCaps&,
153 GrTexture* textures[]) { 153 GrTexture* textures[]) {
154 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : 154 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
155 GrEffectUnitTest::kAlphaTextureIdx; 155 GrEffectUnitTest::kAlphaTextureIdx;
156 SkScalar coefficients[16]; 156 SkScalar coefficients[16];
157 for (int i = 0; i < 16; i++) { 157 for (int i = 0; i < 16; i++) {
158 coefficients[i] = random->nextSScalar1(); 158 coefficients[i] = random->nextSScalar1();
159 } 159 }
160 return GrBicubicEffect::Create(textures[texIdx], coefficients); 160 return GrBicubicEffect::Create(textures[texIdx], coefficients);
161 } 161 }
OLDNEW
« no previous file with comments | « gm/clippedbitmapshaders.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698