| OLD | NEW |
| 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 #ifndef GrProgramElementRef_DEFINED | 8 #ifndef GrProgramElementRef_DEFINED |
| 9 #define GrProgramElementRef_DEFINED | 9 #define GrProgramElementRef_DEFINED |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 SkSafeUnref(fObj); | 31 SkSafeUnref(fObj); |
| 32 fObj = obj; | 32 fObj = obj; |
| 33 } | 33 } |
| 34 | 34 |
| 35 void convertToPendingExec() { | 35 void convertToPendingExec() { |
| 36 SkASSERT(!fOwnPendingExec); | 36 SkASSERT(!fOwnPendingExec); |
| 37 fObj->convertRefToPendingExecution(); | 37 fObj->convertRefToPendingExecution(); |
| 38 fOwnPendingExec = true; | 38 fOwnPendingExec = true; |
| 39 } | 39 } |
| 40 | 40 |
| 41 // In the short term we need to support copying a GrEffectStage and making t
he copy own | 41 // In the short term we need to support copying a GrProcessorStage and makin
g the copy own |
| 42 // the same type of ref as the source. This function exists to support this.
TODO: Once | 42 // the same type of ref as the source. This function exists to support this.
TODO: Once |
| 43 // GrDrawState and GrOptDrawState no longer share a base class they won't ha
ve to share | 43 // GrDrawState and GrOptDrawState no longer share a base class they won't ha
ve to share |
| 44 // GrEffectStage and we can have GrOptDrawState always own pending execution
s rather than | 44 // GrProcessorStage and we can have GrOptDrawState always own pending execut
ions rather than |
| 45 // refs on GrProgramElements. At that point we should be able to delete this
function. | 45 // refs on GrProgramElements. At that point we should be able to delete this
function. |
| 46 // This function makes assumptions that are valid in the GrEffectStage use c
ase and should | 46 // This function makes assumptions that are valid in the GrProcessorStage us
e case and should |
| 47 // not be used elsewhere. | 47 // not be used elsewhere. |
| 48 void initAndRef(const GrProgramElementRef& that) { | 48 void initAndRef(const GrProgramElementRef& that) { |
| 49 SkASSERT(!fObj); | 49 SkASSERT(!fObj); |
| 50 SkASSERT(that.fObj); | 50 SkASSERT(that.fObj); |
| 51 if (that.fOwnPendingExec) { | 51 if (that.fOwnPendingExec) { |
| 52 SkASSERT(that.fObj->fPendingExecutions > 0); | 52 SkASSERT(that.fObj->fPendingExecutions > 0); |
| 53 that.fObj->fPendingExecutions++; | 53 that.fObj->fPendingExecutions++; |
| 54 } else { | 54 } else { |
| 55 that.fObj->ref(); | 55 that.fObj->ref(); |
| 56 } | 56 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 private: | 87 private: |
| 88 bool fOwnPendingExec; | 88 bool fOwnPendingExec; |
| 89 T* fObj; | 89 T* fObj; |
| 90 | 90 |
| 91 typedef SkNoncopyable INHERITED; | 91 typedef SkNoncopyable INHERITED; |
| 92 }; | 92 }; |
| 93 #endif | 93 #endif |
| OLD | NEW |