| 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 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1103 /////////////////////////////////////////////////////////////////////////////// | 1103 /////////////////////////////////////////////////////////////////////////////// |
| 1104 | 1104 |
| 1105 SkLightingImageFilter::SkLightingImageFilter(sk_sp<SkImageFilterLight> light, | 1105 SkLightingImageFilter::SkLightingImageFilter(sk_sp<SkImageFilterLight> light, |
| 1106 SkScalar surfaceScale, | 1106 SkScalar surfaceScale, |
| 1107 sk_sp<SkImageFilter> input, const C
ropRect* cropRect) | 1107 sk_sp<SkImageFilter> input, const C
ropRect* cropRect) |
| 1108 : INHERITED(&input, 1, cropRect) | 1108 : INHERITED(&input, 1, cropRect) |
| 1109 , fLight(std::move(light)) | 1109 , fLight(std::move(light)) |
| 1110 , fSurfaceScale(surfaceScale / 255) { | 1110 , fSurfaceScale(surfaceScale / 255) { |
| 1111 } | 1111 } |
| 1112 | 1112 |
| 1113 SkLightingImageFilter::~SkLightingImageFilter() {} |
| 1114 |
| 1113 sk_sp<SkImageFilter> SkLightingImageFilter::MakeDistantLitDiffuse(const SkPoint3
& direction, | 1115 sk_sp<SkImageFilter> SkLightingImageFilter::MakeDistantLitDiffuse(const SkPoint3
& direction, |
| 1114 SkColor lightC
olor, | 1116 SkColor lightC
olor, |
| 1115 SkScalar surfa
ceScale, | 1117 SkScalar surfa
ceScale, |
| 1116 SkScalar kd, | 1118 SkScalar kd, |
| 1117 sk_sp<SkImageF
ilter> input, | 1119 sk_sp<SkImageF
ilter> input, |
| 1118 const CropRect
* cropRect) { | 1120 const CropRect
* cropRect) { |
| 1119 sk_sp<SkImageFilterLight> light(new SkDistantLight(direction, lightColor)); | 1121 sk_sp<SkImageFilterLight> light(new SkDistantLight(direction, lightColor)); |
| 1120 return SkDiffuseLightingImageFilter::Make(std::move(light), surfaceScale, kd
, | 1122 return SkDiffuseLightingImageFilter::Make(std::move(light), surfaceScale, kd
, |
| 1121 std::move(input), cropRect); | 1123 std::move(input), cropRect); |
| 1122 } | 1124 } |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2134 | 2136 |
| 2135 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2137 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 2136 } | 2138 } |
| 2137 | 2139 |
| 2138 #endif | 2140 #endif |
| 2139 | 2141 |
| 2140 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2142 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 2141 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2143 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 2142 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2144 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 2143 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2145 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |