| 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 #include "SkColorCubeFilter.h" | 8 #include "SkColorCubeFilter.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&)
SK_OVERRIDE; | 225 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&)
SK_OVERRIDE; |
| 226 | 226 |
| 227 private: | 227 private: |
| 228 GrGLProgramDataManager::UniformHandle fColorCubeSizeUni; | 228 GrGLProgramDataManager::UniformHandle fColorCubeSizeUni; |
| 229 GrGLProgramDataManager::UniformHandle fColorCubeInvSizeUni; | 229 GrGLProgramDataManager::UniformHandle fColorCubeInvSizeUni; |
| 230 | 230 |
| 231 typedef GrGLFragmentProcessor INHERITED; | 231 typedef GrGLFragmentProcessor INHERITED; |
| 232 }; | 232 }; |
| 233 | 233 |
| 234 private: | 234 private: |
| 235 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 235 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 236 | 236 |
| 237 GrColorCubeEffect(GrTexture* colorCube); | 237 GrColorCubeEffect(GrTexture* colorCube); |
| 238 | 238 |
| 239 GrCoordTransform fColorCubeTransform; | 239 GrCoordTransform fColorCubeTransform; |
| 240 GrTextureAccess fColorCubeAccess; | 240 GrTextureAccess fColorCubeAccess; |
| 241 | 241 |
| 242 typedef GrFragmentProcessor INHERITED; | 242 typedef GrFragmentProcessor INHERITED; |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 /////////////////////////////////////////////////////////////////////////////// | 245 /////////////////////////////////////////////////////////////////////////////// |
| 246 | 246 |
| 247 GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube) | 247 GrColorCubeEffect::GrColorCubeEffect(GrTexture* colorCube) |
| 248 : fColorCubeTransform(kLocal_GrCoordSet, colorCube) | 248 : fColorCubeTransform(kLocal_GrCoordSet, colorCube) |
| 249 , fColorCubeAccess(colorCube, "bgra", GrTextureParams::kBilerp_FilterMode) { | 249 , fColorCubeAccess(colorCube, "bgra", GrTextureParams::kBilerp_FilterMode) { |
| 250 this->addCoordTransform(&fColorCubeTransform); | 250 this->addCoordTransform(&fColorCubeTransform); |
| 251 this->addTextureAccess(&fColorCubeAccess); | 251 this->addTextureAccess(&fColorCubeAccess); |
| 252 } | 252 } |
| 253 | 253 |
| 254 GrColorCubeEffect::~GrColorCubeEffect() { | 254 GrColorCubeEffect::~GrColorCubeEffect() { |
| 255 } | 255 } |
| 256 | 256 |
| 257 bool GrColorCubeEffect::onIsEqual(const GrProcessor& sBase) const { | 257 bool GrColorCubeEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
| 258 const GrColorCubeEffect& s = sBase.cast<GrColorCubeEffect>(); | 258 const GrColorCubeEffect& s = sBase.cast<GrColorCubeEffect>(); |
| 259 return fColorCubeAccess.getTexture() == s.fColorCubeAccess.getTexture(); | 259 return fColorCubeAccess.getTexture() == s.fColorCubeAccess.getTexture(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const { | 262 const GrBackendFragmentProcessorFactory& GrColorCubeEffect::getFactory() const { |
| 263 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance(); | 263 return GrTBackendFragmentProcessorFactory<GrColorCubeEffect>::getInstance(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 void GrColorCubeEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 266 void GrColorCubeEffect::onComputeInvariantOutput(InvariantOutput* inout) const { |
| 267 inout->setToUnknown(); | 267 inout->setToUnknown(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 static_cast<GrTexture*>(context->findAndRefCachedResource( | 365 static_cast<GrTexture*>(context->findAndRefCachedResource( |
| 366 GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID))))
; | 366 GrTexturePriv::ComputeKey(context->getGpu(), NULL, desc, cacheID))))
; |
| 367 | 367 |
| 368 if (!textureCube) { | 368 if (!textureCube) { |
| 369 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); | 369 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); |
| 370 } | 370 } |
| 371 | 371 |
| 372 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; | 372 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; |
| 373 } | 373 } |
| 374 #endif | 374 #endif |
| OLD | NEW |