| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkReadBuffer.h" | 11 #include "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" | 12 #include "SkWriteBuffer.h" |
| 13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
| 14 #include "SkWriteBuffer.h" | 14 #include "SkWriteBuffer.h" |
| 15 #include "SkTypes.h" | 15 #include "SkTypes.h" |
| 16 | 16 |
| 17 #if SK_SUPPORT_GPU | 17 #if SK_SUPPORT_GPU |
| 18 #include "effects/GrSingleTextureEffect.h" | 18 #include "effects/GrSingleTextureEffect.h" |
| 19 #include "gl/GrGLProcessor.h" | 19 #include "gl/GrGLProcessor.h" |
| 20 #include "gl/builders/GrGLProgramBuilder.h" | 20 #include "gl/builders/GrGLProgramBuilder.h" |
| 21 #include "GrFragmentProcessor.h" | 21 #include "GrFragmentProcessor.h" |
| 22 #include "GrInvariantOutput.h" |
| 22 #include "GrTBackendProcessorFactory.h" | 23 #include "GrTBackendProcessorFactory.h" |
| 23 | 24 |
| 24 class GrGLDiffuseLightingEffect; | 25 class GrGLDiffuseLightingEffect; |
| 25 class GrGLSpecularLightingEffect; | 26 class GrGLSpecularLightingEffect; |
| 26 | 27 |
| 27 // For brevity | 28 // For brevity |
| 28 typedef GrGLProgramDataManager::UniformHandle UniformHandle; | 29 typedef GrGLProgramDataManager::UniformHandle UniformHandle; |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 namespace { | 32 namespace { |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 GrLightingEffect(GrTexture* texture, const SkLight* light, SkScalar surfaceS
cale, const SkMatrix& matrix); | 347 GrLightingEffect(GrTexture* texture, const SkLight* light, SkScalar surfaceS
cale, const SkMatrix& matrix); |
| 347 virtual ~GrLightingEffect(); | 348 virtual ~GrLightingEffect(); |
| 348 | 349 |
| 349 const SkLight* light() const { return fLight; } | 350 const SkLight* light() const { return fLight; } |
| 350 SkScalar surfaceScale() const { return fSurfaceScale; } | 351 SkScalar surfaceScale() const { return fSurfaceScale; } |
| 351 const SkMatrix& filterMatrix() const { return fFilterMatrix; } | 352 const SkMatrix& filterMatrix() const { return fFilterMatrix; } |
| 352 | 353 |
| 353 protected: | 354 protected: |
| 354 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 355 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
| 355 | 356 |
| 356 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 357 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
| 357 // lighting shaders are complicated. We just throw up our hands. | 358 // lighting shaders are complicated. We just throw up our hands. |
| 358 inout->mulByUnknownColor(); | 359 inout->mulByUnknownColor(); |
| 359 } | 360 } |
| 360 | 361 |
| 361 private: | 362 private: |
| 362 typedef GrSingleTextureEffect INHERITED; | 363 typedef GrSingleTextureEffect INHERITED; |
| 363 const SkLight* fLight; | 364 const SkLight* fLight; |
| 364 SkScalar fSurfaceScale; | 365 SkScalar fSurfaceScale; |
| 365 SkMatrix fFilterMatrix; | 366 SkMatrix fFilterMatrix; |
| 366 }; | 367 }; |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1717 | 1718 |
| 1718 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1719 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 1719 } | 1720 } |
| 1720 | 1721 |
| 1721 #endif | 1722 #endif |
| 1722 | 1723 |
| 1723 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1724 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 1724 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1727 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |