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

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

Issue 1225923010: Refugee from Dead Machine 4: MDB Monster Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Last update from dead machine Created 4 years, 7 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
« no previous file with comments | « src/gpu/effects/GrBicubicEffect.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrBicubicEffect.h" 8 #include "GrBicubicEffect.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "glsl/GrGLSLFragmentShaderBuilder.h" 10 #include "glsl/GrGLSLFragmentShaderBuilder.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 for (int y = 0; y < 4; y++) { 124 for (int y = 0; y < 4; y++) {
125 for (int x = 0; x < 4; x++) { 125 for (int x = 0; x < 4; x++) {
126 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]); 126 dst[x * 4 + y] = SkScalarToFloat(src[y * 4 + x]);
127 } 127 }
128 } 128 }
129 } 129 }
130 130
131 GrBicubicEffect::GrBicubicEffect(GrTexture* texture, 131 GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
132 const SkScalar coefficients[16], 132 const SkScalar coefficients[16],
133 const SkMatrix &matrix, 133 const SkMatrix &matrix,
134 const SkShader::TileMode tileModes[2]) 134 const SkShader::TileMode tileModes[2], GrRender Target* dst)
135 : INHERITED(texture, matrix, GrTextureParams(tileModes, GrTextureParams::kNone _FilterMode)) 135 : INHERITED(texture, matrix,
136 GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode), kLo cal_GrCoordSet, dst)
136 , fDomain(GrTextureDomain::IgnoredDomain()) { 137 , fDomain(GrTextureDomain::IgnoredDomain()) {
137 this->initClassID<GrBicubicEffect>(); 138 this->initClassID<GrBicubicEffect>();
138 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi cients); 139 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi cients);
139 } 140 }
140 141
141 GrBicubicEffect::GrBicubicEffect(GrTexture* texture, 142 GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
142 const SkScalar coefficients[16], 143 const SkScalar coefficients[16],
143 const SkMatrix &matrix, 144 const SkMatrix &matrix,
144 const SkRect& domain) 145 const SkRect& domain, GrRenderTarget* dst)
145 : INHERITED(texture, matrix, 146 : INHERITED(texture, matrix,
146 GrTextureParams(SkShader::kClamp_TileMode, GrTextureParams::kNone_ FilterMode)) 147 GrTextureParams(SkShader::kClamp_TileMode, GrTextureParams::kNone_ FilterMode), kLocal_GrCoordSet, dst)
147 , fDomain(domain, GrTextureDomain::kClamp_Mode) { 148 , fDomain(domain, GrTextureDomain::kClamp_Mode) {
148 this->initClassID<GrBicubicEffect>(); 149 this->initClassID<GrBicubicEffect>();
149 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi cients); 150 convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coeffi cients);
150 } 151 }
151 152
152 GrBicubicEffect::~GrBicubicEffect() { 153 GrBicubicEffect::~GrBicubicEffect() {
153 } 154 }
154 155
155 void GrBicubicEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 156 void GrBicubicEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
156 GrProcessorKeyBuilder* b) const { 157 GrProcessorKeyBuilder* b) const {
(...skipping 17 matching lines...) Expand all
174 175
175 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); 176 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect);
176 177
177 const GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) { 178 const GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
178 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : 179 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
179 GrProcessorUnitTest::kAlphaTextureIdx; 180 GrProcessorUnitTest::kAlphaTextureIdx;
180 SkScalar coefficients[16]; 181 SkScalar coefficients[16];
181 for (int i = 0; i < 16; i++) { 182 for (int i = 0; i < 16; i++) {
182 coefficients[i] = d->fRandom->nextSScalar1(); 183 coefficients[i] = d->fRandom->nextSScalar1();
183 } 184 }
184 return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients); 185 return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients, NULL, NUL L);
185 } 186 }
186 187
187 ////////////////////////////////////////////////////////////////////////////// 188 //////////////////////////////////////////////////////////////////////////////
188 189
189 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, 190 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix,
190 GrTextureParams::FilterMode* filterMode) { 191 GrTextureParams::FilterMode* filterMode) {
191 if (matrix.isIdentity()) { 192 if (matrix.isIdentity()) {
192 *filterMode = GrTextureParams::kNone_FilterMode; 193 *filterMode = GrTextureParams::kNone_FilterMode;
193 return false; 194 return false;
194 } 195 }
(...skipping 14 matching lines...) Expand all
209 // Use bilerp to handle rotation or fractional translation. 210 // Use bilerp to handle rotation or fractional translation.
210 *filterMode = GrTextureParams::kBilerp_FilterMode; 211 *filterMode = GrTextureParams::kBilerp_FilterMode;
211 } 212 }
212 return false; 213 return false;
213 } 214 }
214 // When we use the bicubic filtering effect each sample is read from the tex ture using 215 // When we use the bicubic filtering effect each sample is read from the tex ture using
215 // nearest neighbor sampling. 216 // nearest neighbor sampling.
216 *filterMode = GrTextureParams::kNone_FilterMode; 217 *filterMode = GrTextureParams::kNone_FilterMode;
217 return true; 218 return true;
218 } 219 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrBicubicEffect.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698