Chromium Code Reviews| Index: samplecode/SampleLighting.cpp |
| diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp |
| index a27aa9de41b117667e030ff9c6cdd61c13e6de5a..6c13268a7de57603142200ab5769622a2c7abeae 100755 |
| --- a/samplecode/SampleLighting.cpp |
| +++ b/samplecode/SampleLighting.cpp |
| @@ -8,8 +8,10 @@ |
| #include "SampleCode.h" |
| #include "Resources.h" |
| +#include "SkBitmapProcShader.h" |
| #include "SkCanvas.h" |
| #include "SkLightingShader.h" |
| +#include "SkNormalSource.h" |
| #include "SkPoint3.h" |
| static sk_sp<SkLights> create_lights(SkScalar angle, SkScalar blue) { |
| @@ -64,9 +66,12 @@ protected: |
| sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor)); |
| SkPaint paint; |
| - paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap, |
| - std::move(lights), SkVector::Make(1.0f, 0.0f), |
| - nullptr, nullptr)); |
| + sk_sp<SkShader> normalMap = SkMakeBitmapShader(fNormalBitmap, |
| + SkShader::kClamp_TileMode, SkShader::kClamp_TileMode, nullptr, nullptr); |
| + sk_sp<SkNormalSource> normalSource = SkNormalSource::MakeFromNormalMap( |
|
robertphillips
2016/07/06 16:36:33
Why can't you use SkMatrix::I() ?
dvonbeck
2016/07/06 18:07:48
Oops. Done. Should have known!
|
| + std::move(normalMap), SkMatrix::MakeScale(1.0f)/*identity matrix*/); |
| + paint.setShader(SkLightingShader::Make(fDiffuseBitmap, std::move(lights), nullptr, |
| + std::move(normalSource))); |
| paint.setColor(SK_ColorBLACK); |
| SkRect r = SkRect::MakeWH((SkScalar)fDiffuseBitmap.width(), |