| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 GrBackendProcessorFactory::kIllegalEffectClassID; | 52 GrBackendProcessorFactory::kIllegalEffectClassID; |
| 53 | 53 |
| 54 /////////////////////////////////////////////////////////////////////////////// | 54 /////////////////////////////////////////////////////////////////////////////// |
| 55 | 55 |
| 56 GrProcessor::~GrProcessor() {} | 56 GrProcessor::~GrProcessor() {} |
| 57 | 57 |
| 58 const char* GrProcessor::name() const { | 58 const char* GrProcessor::name() const { |
| 59 return this->getFactory().name(); | 59 return this->getFactory().name(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void GrProcessor::addCoordTransform(const GrCoordTransform* transform) { | |
| 63 fCoordTransforms.push_back(transform); | |
| 64 SkDEBUGCODE(transform->setInEffect();) | |
| 65 } | |
| 66 | |
| 67 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { | 62 void GrProcessor::addTextureAccess(const GrTextureAccess* access) { |
| 68 fTextureAccesses.push_back(access); | 63 fTextureAccesses.push_back(access); |
| 69 this->addGpuResource(access->getProgramTexture()); | 64 this->addGpuResource(access->getProgramTexture()); |
| 70 } | 65 } |
| 71 | 66 |
| 72 void* GrProcessor::operator new(size_t size) { | 67 void* GrProcessor::operator new(size_t size) { |
| 73 return GrProcessor_Globals::GetTLS()->allocate(size); | 68 return GrProcessor_Globals::GetTLS()->allocate(size); |
| 74 } | 69 } |
| 75 | 70 |
| 76 void GrProcessor::operator delete(void* target) { | 71 void GrProcessor::operator delete(void* target) { |
| 77 GrProcessor_Globals::GetTLS()->release(target); | 72 GrProcessor_Globals::GetTLS()->release(target); |
| 78 } | 73 } |
| 79 | 74 |
| 80 #ifdef SK_DEBUG | 75 #ifdef SK_DEBUG |
| 81 void GrProcessor::assertEquality(const GrProcessor& other) const { | 76 void GrProcessor::assertEquality(const GrProcessor& other) const { |
| 82 SkASSERT(this->numTransforms() == other.numTransforms()); | |
| 83 for (int i = 0; i < this->numTransforms(); ++i) { | |
| 84 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | |
| 85 } | |
| 86 SkASSERT(this->numTextures() == other.numTextures()); | 77 SkASSERT(this->numTextures() == other.numTextures()); |
| 87 for (int i = 0; i < this->numTextures(); ++i) { | 78 for (int i = 0; i < this->numTextures(); ++i) { |
| 88 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 79 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
| 89 } | 80 } |
| 90 } | 81 } |
| 91 | 82 |
| 92 void GrProcessor::InvariantOutput::validate() const { | 83 void GrProcessor::InvariantOutput::validate() const { |
| 93 if (fIsSingleComponent) { | 84 if (fIsSingleComponent) { |
| 94 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; | 85 SkASSERT(0 == fValidFlags || kRGBA_GrColorComponentFlags == fValidFlags)
; |
| 95 if (kRGBA_GrColorComponentFlags == fValidFlags) { | 86 if (kRGBA_GrColorComponentFlags == fValidFlags) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 122 } | 113 } |
| 123 } | 114 } |
| 124 if (kB_GrColorComponentFlag & fValidFlags) { | 115 if (kB_GrColorComponentFlag & fValidFlags) { |
| 125 if (c[2] > c[3]) { | 116 if (c[2] > c[3]) { |
| 126 return false; | 117 return false; |
| 127 } | 118 } |
| 128 } | 119 } |
| 129 } | 120 } |
| 130 return true; | 121 return true; |
| 131 } | 122 } |
| 132 #endif | 123 #endif // end DEBUG |
| 133 | 124 |
| 125 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 126 |
| 127 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { |
| 128 fCoordTransforms.push_back(transform); |
| 129 SkDEBUGCODE(transform->setInEffect();) |
| 130 } |
| OLD | NEW |