| OLD | NEW |
| 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 "GrProcessor.h" | 8 #include "GrProcessor.h" |
| 9 #include "GrBackendProcessorFactory.h" | 9 #include "GrBackendProcessorFactory.h" |
| 10 #include "GrContext.h" | 10 #include "GrContext.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 void* GrProcessor::operator new(size_t size) { | 111 void* GrProcessor::operator new(size_t size) { |
| 112 return GrProcessor_Globals::GetTLS()->allocate(size); | 112 return GrProcessor_Globals::GetTLS()->allocate(size); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void GrProcessor::operator delete(void* target) { | 115 void GrProcessor::operator delete(void* target) { |
| 116 GrProcessor_Globals::GetTLS()->release(target); | 116 GrProcessor_Globals::GetTLS()->release(target); |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool GrProcessor::hasSameTextureAccesses(const GrProcessor& that) const { |
| 120 if (this->numTextures() != that.numTextures()) { |
| 121 return false; |
| 122 } |
| 123 for (int i = 0; i < this->numTextures(); ++i) { |
| 124 if (this->textureAccess(i) != that.textureAccess(i)) { |
| 125 return false; |
| 126 } |
| 127 } |
| 128 return true; |
| 129 } |
| 130 |
| 119 #ifdef SK_DEBUG | 131 #ifdef SK_DEBUG |
| 120 void GrProcessor::assertTexturesEqual(const GrProcessor& other) const { | |
| 121 SkASSERT(this->numTextures() == other.numTextures()); | |
| 122 for (int i = 0; i < this->numTextures(); ++i) { | |
| 123 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | |
| 124 } | |
| 125 } | |
| 126 | 132 |
| 127 void GrProcessor::InvariantOutput::validate() const { | 133 void GrProcessor::InvariantOutput::validate() const { |
| 128 if (fIsSingleComponent) { | 134 if (fIsSingleComponent) { |
| 129 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; | 135 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; |
| 130 if (kRGBA_GrColorComponentFlags == fValidFlags) { | 136 if (kRGBA_GrColorComponentFlags == fValidFlags) { |
| 131 SkASSERT(this->colorComponentsAllEqual()); | 137 SkASSERT(this->colorComponentsAllEqual()); |
| 132 } | 138 } |
| 133 } | 139 } |
| 134 | 140 |
| 135 SkASSERT(this->validPreMulColor()); | 141 SkASSERT(this->validPreMulColor()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 return false; | 184 return false; |
| 179 } | 185 } |
| 180 int count = fCoordTransforms.count(); | 186 int count = fCoordTransforms.count(); |
| 181 for (int i = 0; i < count; ++i) { | 187 for (int i = 0; i < count; ++i) { |
| 182 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { | 188 if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { |
| 183 return false; | 189 return false; |
| 184 } | 190 } |
| 185 } | 191 } |
| 186 return true; | 192 return true; |
| 187 } | 193 } |
| OLD | NEW |