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 1197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 : INHERITED(light, surfaceScale, input, cropRect), | 1208 : INHERITED(light, surfaceScale, input, cropRect), |
1209 fKD(kd) | 1209 fKD(kd) |
1210 { | 1210 { |
1211 } | 1211 } |
1212 | 1212 |
1213 SkFlattenable* SkDiffuseLightingImageFilter::CreateProc(SkReadBuffer& buffer) { | 1213 SkFlattenable* SkDiffuseLightingImageFilter::CreateProc(SkReadBuffer& buffer) { |
1214 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 1214 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
1215 SkAutoTUnref<SkImageFilterLight> light(SkImageFilterLight::UnflattenLight(bu
ffer)); | 1215 SkAutoTUnref<SkImageFilterLight> light(SkImageFilterLight::UnflattenLight(bu
ffer)); |
1216 SkScalar surfaceScale = buffer.readScalar(); | 1216 SkScalar surfaceScale = buffer.readScalar(); |
1217 SkScalar kd = buffer.readScalar(); | 1217 SkScalar kd = buffer.readScalar(); |
1218 return Create(light, surfaceScale, kd, common.getInput(0), &common.cropRect(
)); | 1218 return Create(light, surfaceScale, kd, common.getInput(0).get(), &common.cro
pRect()); |
1219 } | 1219 } |
1220 | 1220 |
1221 void SkDiffuseLightingImageFilter::flatten(SkWriteBuffer& buffer) const { | 1221 void SkDiffuseLightingImageFilter::flatten(SkWriteBuffer& buffer) const { |
1222 this->INHERITED::flatten(buffer); | 1222 this->INHERITED::flatten(buffer); |
1223 buffer.writeScalar(fKD); | 1223 buffer.writeScalar(fKD); |
1224 } | 1224 } |
1225 | 1225 |
1226 bool SkDiffuseLightingImageFilter::onFilterImageDeprecated(Proxy* proxy, | 1226 bool SkDiffuseLightingImageFilter::onFilterImageDeprecated(Proxy* proxy, |
1227 const SkBitmap& sourc
e, | 1227 const SkBitmap& sourc
e, |
1228 const Context& ctx, | 1228 const Context& ctx, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 fShininess(shininess) | 1351 fShininess(shininess) |
1352 { | 1352 { |
1353 } | 1353 } |
1354 | 1354 |
1355 SkFlattenable* SkSpecularLightingImageFilter::CreateProc(SkReadBuffer& buffer) { | 1355 SkFlattenable* SkSpecularLightingImageFilter::CreateProc(SkReadBuffer& buffer) { |
1356 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 1356 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
1357 SkAutoTUnref<SkImageFilterLight> light(SkImageFilterLight::UnflattenLight(bu
ffer)); | 1357 SkAutoTUnref<SkImageFilterLight> light(SkImageFilterLight::UnflattenLight(bu
ffer)); |
1358 SkScalar surfaceScale = buffer.readScalar(); | 1358 SkScalar surfaceScale = buffer.readScalar(); |
1359 SkScalar ks = buffer.readScalar(); | 1359 SkScalar ks = buffer.readScalar(); |
1360 SkScalar shine = buffer.readScalar(); | 1360 SkScalar shine = buffer.readScalar(); |
1361 return Create(light, surfaceScale, ks, shine, common.getInput(0), &common.cr
opRect()); | 1361 return Create(light, surfaceScale, ks, shine, common.getInput(0).get(), &com
mon.cropRect()); |
1362 } | 1362 } |
1363 | 1363 |
1364 void SkSpecularLightingImageFilter::flatten(SkWriteBuffer& buffer) const { | 1364 void SkSpecularLightingImageFilter::flatten(SkWriteBuffer& buffer) const { |
1365 this->INHERITED::flatten(buffer); | 1365 this->INHERITED::flatten(buffer); |
1366 buffer.writeScalar(fKS); | 1366 buffer.writeScalar(fKS); |
1367 buffer.writeScalar(fShininess); | 1367 buffer.writeScalar(fShininess); |
1368 } | 1368 } |
1369 | 1369 |
1370 bool SkSpecularLightingImageFilter::onFilterImageDeprecated(Proxy* proxy, | 1370 bool SkSpecularLightingImageFilter::onFilterImageDeprecated(Proxy* proxy, |
1371 const SkBitmap& sour
ce, | 1371 const SkBitmap& sour
ce, |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2118 | 2118 |
2119 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2119 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2120 } | 2120 } |
2121 | 2121 |
2122 #endif | 2122 #endif |
2123 | 2123 |
2124 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2124 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2125 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2125 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2126 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2126 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2127 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2127 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |