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

Side by Side Diff: src/gpu/GrDrawState.h

Issue 372053003: Revert of Make GrDrawState and GrPaint take GrEffect* instead of GrEffectRef*. (Closed) Base URL: https://skia.googlesource.com/skia.git@no_ref
Patch Set: Created 6 years, 5 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/effects/gradients/SkTwoPointRadialGradient.cpp ('k') | src/gpu/GrEffect.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 2011 Google Inc. 2 * Copyright 2011 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 #ifndef GrDrawState_DEFINED 8 #ifndef GrDrawState_DEFINED
9 #define GrDrawState_DEFINED 9 #define GrDrawState_DEFINED
10 10
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 /// pixel coverage rather than as input to the src/dst color blend step. 333 /// pixel coverage rather than as input to the src/dst color blend step.
334 /// 334 ///
335 /// The input color to the first color-stage is either the constant color or interpolated 335 /// The input color to the first color-stage is either the constant color or interpolated
336 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage 336 /// per-vertex colors. The input to the first coverage stage is either a con stant coverage
337 /// (usually full-coverage) or interpolated per-vertex coverage. 337 /// (usually full-coverage) or interpolated per-vertex coverage.
338 /// 338 ///
339 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the 339 /// See the documentation of kCoverageDrawing_StateBit for information about disabling the
340 /// the color / coverage distinction. 340 /// the color / coverage distinction.
341 //// 341 ////
342 342
343 const GrEffect* addColorEffect(const GrEffect* effect, int attr0 = -1, int a ttr1 = -1) { 343 const GrEffectRef* addColorEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
344 SkASSERT(NULL != effect); 344 SkASSERT(NULL != effect);
345 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att r1)); 345 SkNEW_APPEND_TO_TARRAY(&fColorStages, GrEffectStage, (effect, attr0, att r1));
346 return effect; 346 return effect;
347 } 347 }
348 348
349 const GrEffect* addCoverageEffect(const GrEffect* effect, int attr0 = -1, in t attr1 = -1) { 349 const GrEffectRef* addCoverageEffect(const GrEffectRef* effect, int attr0 = -1, int attr1 = -1) {
350 SkASSERT(NULL != effect); 350 SkASSERT(NULL != effect);
351 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1)); 351 SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrEffectStage, (effect, attr0, attr1));
352 return effect; 352 return effect;
353 } 353 }
354 354
355 /** 355 /**
356 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates. 356 * Creates a GrSimpleTextureEffect that uses local coords as texture coordin ates.
357 */ 357 */
358 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) { 358 void addColorTextureEffect(GrTexture* texture, const SkMatrix& matrix) {
359 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix))->un ref(); 359 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix);
360 this->addColorEffect(effect)->unref();
360 } 361 }
361 362
362 void addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix) { 363 void addCoverageTextureEffect(GrTexture* texture, const SkMatrix& matrix) {
363 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix))- >unref(); 364 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix);
365 this->addCoverageEffect(effect)->unref();
364 } 366 }
365 367
366 void addColorTextureEffect(GrTexture* texture, 368 void addColorTextureEffect(GrTexture* texture,
367 const SkMatrix& matrix, 369 const SkMatrix& matrix,
368 const GrTextureParams& params) { 370 const GrTextureParams& params) {
369 this->addColorEffect(GrSimpleTextureEffect::Create(texture, matrix, para ms))->unref(); 371 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams);
372 this->addColorEffect(effect)->unref();
370 } 373 }
371 374
372 void addCoverageTextureEffect(GrTexture* texture, 375 void addCoverageTextureEffect(GrTexture* texture,
373 const SkMatrix& matrix, 376 const SkMatrix& matrix,
374 const GrTextureParams& params) { 377 const GrTextureParams& params) {
375 this->addCoverageEffect(GrSimpleTextureEffect::Create(texture, matrix, p arams))->unref(); 378 GrEffectRef* effect = GrSimpleTextureEffect::Create(texture, matrix, par ams);
379 this->addCoverageEffect(effect)->unref();
376 } 380 }
377 381
378 /** 382 /**
379 * When this object is destroyed it will remove any effects from the draw st ate that were added 383 * When this object is destroyed it will remove any effects from the draw st ate that were added
380 * after its constructor. 384 * after its constructor.
381 */ 385 */
382 class AutoRestoreEffects : public ::SkNoncopyable { 386 class AutoRestoreEffects : public ::SkNoncopyable {
383 public: 387 public:
384 AutoRestoreEffects() : fDrawState(NULL), fColorEffectCnt(0), fCoverageEf fectCnt(0) {} 388 AutoRestoreEffects() : fDrawState(NULL), fColorEffectCnt(0), fCoverageEf fectCnt(0) {}
385 389
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
959 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. 963 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
960 */ 964 */
961 void setVertexAttribs(const GrVertexAttrib attribs[], int count); 965 void setVertexAttribs(const GrVertexAttrib attribs[], int count);
962 966
963 typedef SkRefCnt INHERITED; 967 typedef SkRefCnt INHERITED;
964 }; 968 };
965 969
966 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 970 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
967 971
968 #endif 972 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkTwoPointRadialGradient.cpp ('k') | src/gpu/GrEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698