| 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 case SkLight::kPoint_LightType: return SkNEW_ARGS(SkPointLight, (buffe
r)); | 822 case SkLight::kPoint_LightType: return SkNEW_ARGS(SkPointLight, (buffe
r)); |
| 823 case SkLight::kSpot_LightType: return SkNEW_ARGS(SkSpotLight, (buffer
)); | 823 case SkLight::kSpot_LightType: return SkNEW_ARGS(SkSpotLight, (buffer
)); |
| 824 default: | 824 default: |
| 825 SkDEBUGFAIL("Unknown LightType."); | 825 SkDEBUGFAIL("Unknown LightType."); |
| 826 buffer.validate(false); | 826 buffer.validate(false); |
| 827 return NULL; | 827 return NULL; |
| 828 } | 828 } |
| 829 } | 829 } |
| 830 /////////////////////////////////////////////////////////////////////////////// | 830 /////////////////////////////////////////////////////////////////////////////// |
| 831 | 831 |
| 832 SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceSca
le, SkImageFilter* input, const CropRect* cropRect) | 832 SkLightingImageFilter::SkLightingImageFilter(SkLight* light, SkScalar surfaceSca
le, |
| 833 : INHERITED(input, cropRect), | 833 SkImageFilter* input, const CropRec
t* cropRect) |
| 834 : INHERITED(1, &input, cropRect), |
| 834 fLight(light), | 835 fLight(light), |
| 835 fSurfaceScale(SkScalarDiv(surfaceScale, SkIntToScalar(255))) | 836 fSurfaceScale(SkScalarDiv(surfaceScale, SkIntToScalar(255))) |
| 836 { | 837 { |
| 837 SkASSERT(fLight); | 838 SkASSERT(fLight); |
| 838 // our caller knows that we take ownership of the light, so we don't | 839 // our caller knows that we take ownership of the light, so we don't |
| 839 // need to call ref() here. | 840 // need to call ref() here. |
| 840 } | 841 } |
| 841 | 842 |
| 842 SkImageFilter* SkLightingImageFilter::CreateDistantLitDiffuse( | 843 SkImageFilter* SkLightingImageFilter::CreateDistantLitDiffuse( |
| 843 const SkPoint3& direction, SkColor lightColor, SkScalar surfaceScale, | 844 const SkPoint3& direction, SkColor lightColor, SkScalar surfaceScale, |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 | 1613 |
| 1613 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 1614 builder->fsCodeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 1614 } | 1615 } |
| 1615 | 1616 |
| 1616 #endif | 1617 #endif |
| 1617 | 1618 |
| 1618 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 1619 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 1619 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 1620 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 1620 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 1621 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 1621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1622 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |