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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 protected: | 353 protected: |
354 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 354 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
355 | 355 |
356 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | 356 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { |
357 // lighting shaders are complicated. We just throw up our hands. | 357 // lighting shaders are complicated. We just throw up our hands. |
358 inout->fValidFlags = 0; | 358 inout->mulByUnknownColor(); |
359 inout->fIsSingleComponent = false; | |
360 } | 359 } |
361 | 360 |
362 private: | 361 private: |
363 typedef GrSingleTextureEffect INHERITED; | 362 typedef GrSingleTextureEffect INHERITED; |
364 const SkLight* fLight; | 363 const SkLight* fLight; |
365 SkScalar fSurfaceScale; | 364 SkScalar fSurfaceScale; |
366 SkMatrix fFilterMatrix; | 365 SkMatrix fFilterMatrix; |
367 }; | 366 }; |
368 | 367 |
369 class GrDiffuseLightingEffect : public GrLightingEffect { | 368 class GrDiffuseLightingEffect : public GrLightingEffect { |
(...skipping 1349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1718 |
1720 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1719 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1721 } | 1720 } |
1722 | 1721 |
1723 #endif | 1722 #endif |
1724 | 1723 |
1725 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1724 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1725 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1727 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1726 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1728 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1727 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |