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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 fDomain == s.fDomain; 172 fDomain == s.fDomain;
173 } 173 }
174 174
175 void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { 175 void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
176 // FIXME: Perhaps we can do better. 176 // FIXME: Perhaps we can do better.
177 inout->mulByUnknownSingleComponent(); 177 inout->mulByUnknownSingleComponent();
178 } 178 }
179 179
180 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); 180 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect);
181 181
182 const GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) { 182 sk_sp<GrFragmentProcessor> GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
183 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : 183 int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
184 GrProcessorUnitTest::kAlphaTextureIdx; 184 GrProcessorUnitTest::kAlphaTextureIdx;
185 SkScalar coefficients[16]; 185 SkScalar coefficients[16];
186 for (int i = 0; i < 16; i++) { 186 for (int i = 0; i < 16; i++) {
187 coefficients[i] = d->fRandom->nextSScalar1(); 187 coefficients[i] = d->fRandom->nextSScalar1();
188 } 188 }
189 return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients); 189 return GrBicubicEffect::Make(d->fTextures[texIdx], coefficients);
190 } 190 }
191 191
192 ////////////////////////////////////////////////////////////////////////////// 192 //////////////////////////////////////////////////////////////////////////////
193 193
194 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix, 194 bool GrBicubicEffect::ShouldUseBicubic(const SkMatrix& matrix,
195 GrTextureParams::FilterMode* filterMode) { 195 GrTextureParams::FilterMode* filterMode) {
196 if (matrix.isIdentity()) { 196 if (matrix.isIdentity()) {
197 *filterMode = GrTextureParams::kNone_FilterMode; 197 *filterMode = GrTextureParams::kNone_FilterMode;
198 return false; 198 return false;
199 } 199 }
(...skipping 14 matching lines...) Expand all
214 // Use bilerp to handle rotation or fractional translation. 214 // Use bilerp to handle rotation or fractional translation.
215 *filterMode = GrTextureParams::kBilerp_FilterMode; 215 *filterMode = GrTextureParams::kBilerp_FilterMode;
216 } 216 }
217 return false; 217 return false;
218 } 218 }
219 // When we use the bicubic filtering effect each sample is read from the tex ture using 219 // When we use the bicubic filtering effect each sample is read from the tex ture using
220 // nearest neighbor sampling. 220 // nearest neighbor sampling.
221 *filterMode = GrTextureParams::kNone_FilterMode; 221 *filterMode = GrTextureParams::kNone_FilterMode;
222 return true; 222 return true;
223 } 223 }
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