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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 const SkLight* light() const { return fLight; } | 343 const SkLight* light() const { return fLight; } |
344 SkScalar surfaceScale() const { return fSurfaceScale; } | 344 SkScalar surfaceScale() const { return fSurfaceScale; } |
345 const SkMatrix& filterMatrix() const { return fFilterMatrix; } | 345 const SkMatrix& filterMatrix() const { return fFilterMatrix; } |
346 | 346 |
347 protected: | 347 protected: |
348 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 348 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
349 | 349 |
350 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { | 350 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE { |
351 // lighting shaders are complicated. We just throw up our hands. | 351 // lighting shaders are complicated. We just throw up our hands. |
352 inout->mulByUnknownColor(); | 352 inout->mulByUnknownFourComponents(); |
353 } | 353 } |
354 | 354 |
355 private: | 355 private: |
356 typedef GrSingleTextureEffect INHERITED; | 356 typedef GrSingleTextureEffect INHERITED; |
357 const SkLight* fLight; | 357 const SkLight* fLight; |
358 SkScalar fSurfaceScale; | 358 SkScalar fSurfaceScale; |
359 SkMatrix fFilterMatrix; | 359 SkMatrix fFilterMatrix; |
360 }; | 360 }; |
361 | 361 |
362 class GrDiffuseLightingEffect : public GrLightingEffect { | 362 class GrDiffuseLightingEffect : public GrLightingEffect { |
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1698 | 1698 |
1699 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1699 fsBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
1700 } | 1700 } |
1701 | 1701 |
1702 #endif | 1702 #endif |
1703 | 1703 |
1704 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1704 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
1705 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1705 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
1706 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1706 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
1707 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1707 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |