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

Side by Side Diff: src/gpu/effects/GrTextureDomain.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/GrTextureDomain.h ('k') | src/gpu/effects/GrTextureStripAtlas.cpp » ('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 2012 Google Inc. 2 * Copyright 2012 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 "GrTextureDomain.h" 8 #include "GrTextureDomain.h"
9 #include "GrInvariantOutput.h" 9 #include "GrInvariantOutput.h"
10 #include "GrSimpleTextureEffect.h" 10 #include "GrSimpleTextureEffect.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&, 212 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
213 GrProcessorKeyBuilder* b) { 213 GrProcessorKeyBuilder* b) {
214 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain(); 214 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain();
215 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); 215 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
216 } 216 }
217 217
218 218
219 /////////////////////////////////////////////////////////////////////////////// 219 ///////////////////////////////////////////////////////////////////////////////
220 220
221 const GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture, 221 const GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
222 const SkMatrix& matrix, 222 const SkMatrix& matrix,
223 const SkRect& domain, 223 const SkRect& domain,
224 GrTextureDomain::Mode m ode, 224 GrTextureDomain::Mode mode,
225 GrTextureParams::Filter Mode filterMode, 225 GrTextureParams::FilterMode f ilterMode,
226 GrCoordSet coordSet) { 226 GrCoordSet coordSet, GrRender Target* dst) {
227 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; 227 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
228 if (GrTextureDomain::kIgnore_Mode == mode || 228 if (GrTextureDomain::kIgnore_Mode == mode ||
229 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) { 229 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
230 return GrSimpleTextureEffect::Create(texture, matrix, filterMode); 230 return GrSimpleTextureEffect::Create(texture, matrix, filterMode, kLocal _GrCoordSet, dst);
231 } else { 231 } else {
232 return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMo de, coordSet); 232 return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMo de, coordSet, dst);
233 } 233 }
234 } 234 }
235 235
236 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, 236 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
237 const SkMatrix& matrix, 237 const SkMatrix& matrix,
238 const SkRect& domain, 238 const SkRect& domain,
239 GrTextureDomain::Mode mode, 239 GrTextureDomain::Mode mode,
240 GrTextureParams::FilterMode filterM ode, 240 GrTextureParams::FilterMode filterM ode,
241 GrCoordSet coordSet) 241 GrCoordSet coordSet,
242 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) 242 GrRenderTarget* dst)
243 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet, dst)
243 , fTextureDomain(domain, mode) { 244 , fTextureDomain(domain, mode) {
244 SkASSERT(mode != GrTextureDomain::kRepeat_Mode || 245 SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
245 filterMode == GrTextureParams::kNone_FilterMode); 246 filterMode == GrTextureParams::kNone_FilterMode);
246 this->initClassID<GrTextureDomainEffect>(); 247 this->initClassID<GrTextureDomainEffect>();
247 } 248 }
248 249
249 GrTextureDomainEffect::~GrTextureDomainEffect() {} 250 GrTextureDomainEffect::~GrTextureDomainEffect() {}
250 251
251 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 252 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
252 GrProcessorKeyBuilder* b) const { 253 GrProcessorKeyBuilder* b) const {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 SkRect domain; 285 SkRect domain;
285 domain.fLeft = d->fRandom->nextUScalar1(); 286 domain.fLeft = d->fRandom->nextUScalar1();
286 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); 287 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1);
287 domain.fTop = d->fRandom->nextUScalar1(); 288 domain.fTop = d->fRandom->nextUScalar1();
288 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); 289 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1);
289 GrTextureDomain::Mode mode = 290 GrTextureDomain::Mode mode =
290 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode Count); 291 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode Count);
291 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); 292 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
292 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 293 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
293 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 294 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
294 return GrTextureDomainEffect::Create( 295 return GrTextureDomainEffect::Create(d->fTextures[texIdx],
295 d->fTextures[texIdx], 296 matrix,
296 matrix, 297 domain,
297 domain, 298 mode,
298 mode, 299 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode,
299 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode, 300 coords, NULL);
300 coords);
301 } 301 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | src/gpu/effects/GrTextureStripAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698