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" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 class GrLightingEffect : public GrSingleTextureEffect { | 344 class GrLightingEffect : public GrSingleTextureEffect { |
345 public: | 345 public: |
346 GrLightingEffect(GrTexture* texture, const SkLight* light, SkScalar surfaceS
cale, const SkMatrix& matrix); | 346 GrLightingEffect(GrTexture* texture, const SkLight* light, SkScalar surfaceS
cale, const SkMatrix& matrix); |
347 virtual ~GrLightingEffect(); | 347 virtual ~GrLightingEffect(); |
348 | 348 |
349 const SkLight* light() const { return fLight; } | 349 const SkLight* light() const { return fLight; } |
350 SkScalar surfaceScale() const { return fSurfaceScale; } | 350 SkScalar surfaceScale() const { return fSurfaceScale; } |
351 const SkMatrix& filterMatrix() const { return fFilterMatrix; } | 351 const SkMatrix& filterMatrix() const { return fFilterMatrix; } |
352 | 352 |
| 353 virtual void getConstantColorComponents(GrColor* color, |
| 354 uint32_t* validFlags) const SK_OVERR
IDE { |
| 355 // lighting shaders are complicated. We just throw up our hands. |
| 356 *validFlags = 0; |
| 357 } |
| 358 |
353 protected: | 359 protected: |
354 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 360 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
355 | 361 |
356 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | |
357 // lighting shaders are complicated. We just throw up our hands. | |
358 inout->fValidFlags = 0; | |
359 inout->fIsSingleComponent = false; | |
360 } | |
361 | |
362 private: | 362 private: |
363 typedef GrSingleTextureEffect INHERITED; | 363 typedef GrSingleTextureEffect INHERITED; |
364 const SkLight* fLight; | 364 const SkLight* fLight; |
365 SkScalar fSurfaceScale; | 365 SkScalar fSurfaceScale; |
366 SkMatrix fFilterMatrix; | 366 SkMatrix fFilterMatrix; |
367 }; | 367 }; |
368 | 368 |
369 class GrDiffuseLightingEffect : public GrLightingEffect { | 369 class GrDiffuseLightingEffect : public GrLightingEffect { |
370 public: | 370 public: |
371 static GrFragmentProcessor* Create(GrTexture* texture, | 371 static GrFragmentProcessor* Create(GrTexture* texture, |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1719 |
1720 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1720 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1721 } | 1721 } |
1722 | 1722 |
1723 #endif | 1723 #endif |
1724 | 1724 |
1725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1727 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1727 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1728 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1728 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |