Reland "Fix directional shadows."
This is a reland of 6789b824015373104bc3282c971e435a9f542f59
Original change's description:
> Fix directional shadows.
>
> The xy offset calculation for drawShadow was not quite correct. Rather
> than normalizing the light vector and using the xy values of that as the
> base offset value, we should scale the light vector by 1/z.
>
> See https://github.com/flutter/engine/pull/27124#issuecomment-880182653
> for more detail.
>
> Bug: skia:10781
> Change-Id: Ib69a313cb96a532f8d89644e3d69f666a184e897
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428880
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Bug: skia:10781
Change-Id: Ib58d374aa03d0144512e5ded6ccd572c74783607
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/428978
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/samplecode/SampleMaterialShadows.cpp b/samplecode/SampleMaterialShadows.cpp
index e84c5cf..8cb951f 100644
--- a/samplecode/SampleMaterialShadows.cpp
+++ b/samplecode/SampleMaterialShadows.cpp
@@ -34,7 +34,7 @@
fLargeRRPath.addRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(-64, -64, 128, 128), 4, 4));
fSmallRRPath.addRRect(SkRRect::MakeRectXY(SkRect::MakeXYWH(-40, -40, 80, 80), 4, 4));
- fLightPos = SkPoint3::Make(0, -700, 600);
+ fLightPos = SkPoint3::Make(0, -700, 700);
}
SkString name() override { return SkString("MaterialShadows"); }