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

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

Issue 1393553002: Insert clip fragment processor outside GrCMM (Closed) Base URL: https://skia.googlesource.com/skia.git@byebye
Patch Set: add class to friends Created 5 years, 2 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') | 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 /* 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&, 209 void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC aps&,
210 GrProcessorKeyBuilder* b) { 210 GrProcessorKeyBuilder* b) {
211 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain(); 211 const GrTextureDomain& domain = processor.cast<GrTextureDomainEffect>().text ureDomain();
212 b->add32(GrTextureDomain::GLDomain::DomainKey(domain)); 212 b->add32(GrTextureDomain::GLDomain::DomainKey(domain));
213 } 213 }
214 214
215 215
216 /////////////////////////////////////////////////////////////////////////////// 216 ///////////////////////////////////////////////////////////////////////////////
217 217
218 GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture, 218 const GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
219 const SkMatrix& matrix, 219 const SkMatrix& matrix,
220 const SkRect& domain, 220 const SkRect& domain,
221 GrTextureDomain::Mode mode, 221 GrTextureDomain::Mode m ode,
222 GrTextureParams::FilterMode f ilterMode, 222 GrTextureParams::Filter Mode filterMode,
223 GrCoordSet coordSet) { 223 GrCoordSet coordSet) {
224 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1}; 224 static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
225 if (GrTextureDomain::kIgnore_Mode == mode || 225 if (GrTextureDomain::kIgnore_Mode == mode ||
226 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) { 226 (GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
227 return GrSimpleTextureEffect::Create(texture, matrix, filterMode); 227 return GrSimpleTextureEffect::Create(texture, matrix, filterMode);
228 } else { 228 } else {
229 return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMo de, coordSet); 229 return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMo de, coordSet);
230 } 230 }
231 } 231 }
232 232
233 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture, 233 GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
234 const SkMatrix& matrix, 234 const SkMatrix& matrix,
235 const SkRect& domain, 235 const SkRect& domain,
236 GrTextureDomain::Mode mode, 236 GrTextureDomain::Mode mode,
237 GrTextureParams::FilterMode filterM ode, 237 GrTextureParams::FilterMode filterM ode,
238 GrCoordSet coordSet) 238 GrCoordSet coordSet)
239 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet) 239 : GrSingleTextureEffect(texture, matrix, filterMode, coordSet)
240 , fTextureDomain(domain, mode) { 240 , fTextureDomain(domain, mode) {
241 SkASSERT(mode != GrTextureDomain::kRepeat_Mode || 241 SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
242 filterMode == GrTextureParams::kNone_FilterMode); 242 filterMode == GrTextureParams::kNone_FilterMode);
243 this->initClassID<GrTextureDomainEffect>(); 243 this->initClassID<GrTextureDomainEffect>();
244 } 244 }
245 245
246 GrTextureDomainEffect::~GrTextureDomainEffect() { 246 GrTextureDomainEffect::~GrTextureDomainEffect() {}
247
248 }
249 247
250 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, 248 void GrTextureDomainEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
251 GrProcessorKeyBuilder* b) const { 249 GrProcessorKeyBuilder* b) const {
252 GrGLTextureDomainEffect::GenKey(*this, caps, b); 250 GrGLTextureDomainEffect::GenKey(*this, caps, b);
253 } 251 }
254 252
255 GrGLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const { 253 GrGLFragmentProcessor* GrTextureDomainEffect::onCreateGLInstance() const {
256 return new GrGLTextureDomainEffect(*this); 254 return new GrGLTextureDomainEffect(*this);
257 } 255 }
258 256
259 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 257 bool GrTextureDomainEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
260 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>(); 258 const GrTextureDomainEffect& s = sBase.cast<GrTextureDomainEffect>();
261 return this->fTextureDomain == s.fTextureDomain; 259 return this->fTextureDomain == s.fTextureDomain;
(...skipping 21 matching lines...) Expand all
283 SkRect domain; 281 SkRect domain;
284 domain.fLeft = d->fRandom->nextUScalar1(); 282 domain.fLeft = d->fRandom->nextUScalar1();
285 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); 283 domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1);
286 domain.fTop = d->fRandom->nextUScalar1(); 284 domain.fTop = d->fRandom->nextUScalar1();
287 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); 285 domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1);
288 GrTextureDomain::Mode mode = 286 GrTextureDomain::Mode mode =
289 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode Count); 287 (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kMode Count);
290 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); 288 const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
291 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; 289 bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
292 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet; 290 GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrC oordSet;
293 return GrTextureDomainEffect::Create(d->fTextures[texIdx], 291 return GrTextureDomainEffect::Create(
294 matrix, 292 d->fTextures[texIdx],
295 domain, 293 matrix,
296 mode, 294 domain,
297 bilerp ? GrTextureParams::kBilerp_Filte rMode : GrTextureParams::kNone_FilterMode, 295 mode,
298 coords); 296 bilerp ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_Fi lterMode,
297 coords);
299 } 298 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrTextureDomain.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698