| 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 "GrContext.h" | 9 #include "GrContext.h" | 
| 10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" | 
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 138         return false; | 138         return false; | 
| 139     } | 139     } | 
| 140     for (int i = 0; i < this->numTextures(); ++i) { | 140     for (int i = 0; i < this->numTextures(); ++i) { | 
| 141         if (this->textureAccess(i) != that.textureAccess(i)) { | 141         if (this->textureAccess(i) != that.textureAccess(i)) { | 
| 142             return false; | 142             return false; | 
| 143         } | 143         } | 
| 144     } | 144     } | 
| 145     return true; | 145     return true; | 
| 146 } | 146 } | 
| 147 | 147 | 
| 148 void GrProcessor::computeInvariantOutput(GrInvariantOutput* inout) const { |  | 
| 149     this->onComputeInvariantOutput(inout); |  | 
| 150 } |  | 
| 151 |  | 
| 152 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 148 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 
| 153 | 149 | 
| 154 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | 150 void GrFragmentProcessor::addCoordTransform(const GrCoordTransform* transform) { | 
| 155     fCoordTransforms.push_back(transform); | 151     fCoordTransforms.push_back(transform); | 
| 156     SkDEBUGCODE(transform->setInProcessor();) | 152     SkDEBUGCODE(transform->setInProcessor();) | 
| 157 } | 153 } | 
| 158 | 154 | 
| 159 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
     st { | 155 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) con
     st { | 
| 160     if (fCoordTransforms.count() != that.fCoordTransforms.count()) { | 156     if (fCoordTransforms.count() != that.fCoordTransforms.count()) { | 
| 161         return false; | 157         return false; | 
| 162     } | 158     } | 
| 163     int count = fCoordTransforms.count(); | 159     int count = fCoordTransforms.count(); | 
| 164     for (int i = 0; i < count; ++i) { | 160     for (int i = 0; i < count; ++i) { | 
| 165         if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { | 161         if (*fCoordTransforms[i] != *that.fCoordTransforms[i]) { | 
| 166             return false; | 162             return false; | 
| 167         } | 163         } | 
| 168     } | 164     } | 
| 169     return true; | 165     return true; | 
| 170 } | 166 } | 
| 171 | 167 | 
|  | 168 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
      { | 
|  | 169     this->onComputeInvariantOutput(inout); | 
|  | 170 } | 
|  | 171 | 
| 172 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 172 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 
| 173 | 173 | 
| 174 void GrGeometryProcessor::computeInvariantColor(GrInvariantOutput* intout) const
      { | 174 void GrGeometryProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) co
     nst { | 
|  | 175     if (fHasVertexColor) { | 
|  | 176         if (fOpaqueVertexColors) { | 
|  | 177             out->setUnknownOpaqueFourComponents(); | 
|  | 178         } else { | 
|  | 179             out->setUnknownFourComponents(); | 
|  | 180         } | 
|  | 181     } else { | 
|  | 182         out->setKnownFourComponents(fColor); | 
|  | 183     } | 
|  | 184     this->onGetInvariantOutputColor(out); | 
|  | 185 } | 
| 175 | 186 | 
|  | 187 void GrGeometryProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out)
      const { | 
|  | 188     this->onGetInvariantOutputCoverage(out); | 
| 176 } | 189 } | 
| 177 | 190 | 
| 178 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 191 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 
|  | 192 | 
|  | 193 void GrPathProcessor::getInvariantOutputColor(GrInitInvariantOutput* out) const 
     { | 
|  | 194     out->setKnownFourComponents(fColor); | 
|  | 195 } | 
|  | 196 | 
|  | 197 void GrPathProcessor::getInvariantOutputCoverage(GrInitInvariantOutput* out) con
     st { | 
|  | 198     out->setKnownSingleComponent(0xff); | 
|  | 199 } | 
|  | 200 | 
|  | 201 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 
| 179 | 202 | 
| 180 /* | 203 /* | 
| 181  * GrGeometryData shares the same pool so it lives in this file too | 204  * GrGeometryData shares the same pool so it lives in this file too | 
| 182  */ | 205  */ | 
| 183 void* GrGeometryData::operator new(size_t size) { | 206 void* GrGeometryData::operator new(size_t size) { | 
| 184     return GrProcessor_Globals::GetTLS()->allocate(size); | 207     return GrProcessor_Globals::GetTLS()->allocate(size); | 
| 185 } | 208 } | 
| 186 | 209 | 
| 187 void GrGeometryData::operator delete(void* target) { | 210 void GrGeometryData::operator delete(void* target) { | 
| 188     GrProcessor_Globals::GetTLS()->release(target); | 211     GrProcessor_Globals::GetTLS()->release(target); | 
| 189 } | 212 } | 
| 190 | 213 | 
| 191 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 214 ////////////////////////////////////////////////////////////////////////////////
     /////////////////// | 
| 192 | 215 | 
| 193 // Initial static variable from GrXPFactory | 216 // Initial static variable from GrXPFactory | 
| 194 int32_t GrXPFactory::gCurrXPFClassID = | 217 int32_t GrXPFactory::gCurrXPFClassID = | 
| 195         GrXPFactory::kIllegalXPFClassID; | 218         GrXPFactory::kIllegalXPFClassID; | 
| 196 |  | 
| OLD | NEW | 
|---|