| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 GrBackendProcessorFactory::kIllegalEffectClassID; | 96 GrBackendProcessorFactory::kIllegalEffectClassID; |
| 97 | 97 |
| 98 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
| 99 | 99 |
| 100 GrProcessor::~GrProcessor() {} | 100 GrProcessor::~GrProcessor() {} |
| 101 | 101 |
| 102 const char* GrProcessor::name() const { | 102 const char* GrProcessor::name() const { |
| 103 return this->getFactory().name(); | 103 return this->getFactory().name(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void GrProcessor::addCoordTransform(const GrCoordTransform* transform) { |
| 107 fCoordTransforms.push_back(transform); |
| 108 SkDEBUGCODE(transform->setInEffect();) |
| 109 } |
| 110 |
| 106 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { | 111 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { |
| 107 fTextureAccesses.push_back(access); | 112 fTextureAccesses.push_back(access); |
| 108 this->addGpuResource(access->getProgramTexture()); | 113 this->addGpuResource(access->getProgramTexture()); |
| 109 } | 114 } |
| 110 | 115 |
| 111 void* GrProcessor::operator new(size_t size) { | 116 void* GrProcessor::operator new(size_t size) { |
| 112 return GrProcessor_Globals::GetTLS()->allocate(size); | 117 return GrProcessor_Globals::GetTLS()->allocate(size); |
| 113 } | 118 } |
| 114 | 119 |
| 115 void GrProcessor::operator delete(void* target) { | 120 void GrProcessor::operator delete(void* target) { |
| 116 GrProcessor_Globals::GetTLS()->release(target); | 121 GrProcessor_Globals::GetTLS()->release(target); |
| 117 } | 122 } |
| 118 | 123 |
| 119 #ifdef SK_DEBUG | 124 #ifdef SK_DEBUG |
| 120 void GrProcessor::assertEquality(const GrProcessor& other) const { | 125 void GrProcessor::assertEquality(const GrProcessor& other) const { |
| 126 SkASSERT(this->numTransforms() == other.numTransforms()); |
| 127 for (int i = 0; i < this->numTransforms(); ++i) { |
| 128 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
| 129 } |
| 121 SkASSERT(this->numTextures() == other.numTextures()); | 130 SkASSERT(this->numTextures() == other.numTextures()); |
| 122 for (int i = 0; i < this->numTextures(); ++i) { | 131 for (int i = 0; i < this->numTextures(); ++i) { |
| 123 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 132 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
| 124 } | 133 } |
| 125 } | 134 } |
| 126 | 135 |
| 127 void GrProcessor::InvariantOutput::validate() const { | 136 void GrProcessor::InvariantOutput::validate() const { |
| 128 if (fIsSingleComponent) { | 137 if (fIsSingleComponent) { |
| 129 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; | 138 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; |
| 130 if (kRGBA_GrColorComponentFlags == fValidFlags) { | 139 if (kRGBA_GrColorComponentFlags == fValidFlags) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 157 } | 166 } |
| 158 } | 167 } |
| 159 if (kB_GrColorComponentFlag & fValidFlags) { | 168 if (kB_GrColorComponentFlag & fValidFlags) { |
| 160 if (c[2] > c[3]) { | 169 if (c[2] > c[3]) { |
| 161 return false; | 170 return false; |
| 162 } | 171 } |
| 163 } | 172 } |
| 164 } | 173 } |
| 165 return true; | 174 return true; |
| 166 } | 175 } |
| 167 #endif // end DEBUG | 176 #endif |
| 168 | 177 |
| 169 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | |
| 170 | |
| 171 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | |
| 172 fCoordTransforms.push_back(transform); | |
| 173 SkDEBUGCODE(transform->setInEffect();) | |
| 174 } | |
| OLD | NEW |