Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1156)

Unified Diff: samplecode/SampleShadowing.cpp

Issue 2224163005: Made shadows blurry (thru implementing variance mapping) (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: made req changes Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samplecode/SampleShadowing.cpp
diff --git a/samplecode/SampleShadowing.cpp b/samplecode/SampleShadowing.cpp
index 7b434bca80a5fc5a5be323c4b54f84594e7bc2e4..47b559c995bc7dd94ff60928b7cd390a944b8399 100644
--- a/samplecode/SampleShadowing.cpp
+++ b/samplecode/SampleShadowing.cpp
@@ -45,6 +45,11 @@ public:
fMoveLight = false;
fClearShadowMaps = false;
+
+ fShType.fShadowRadius = 2.0f;
+ fShType.fBiasingConstant = 0.3f;
+ fShType.fMinVariance = 1024;
+ fShType.fBlurAlgorithm = SkShadowType::kVariance_BlurAlgorithm;
}
protected:
@@ -113,13 +118,15 @@ protected:
for (int i = 0; i < fLights->numLights(); i++) {
fLights->light(i).setShadowMap(nullptr);
}
+
fSceneChanged = false;
fLightsChanged = false;
fClearShadowMaps = false;
-
- canvas->setLights(fLights);
- canvas->drawShadowedPicture(fPicture, nullptr, nullptr);
}
+
+ canvas->setLights(fLights);
+
+ canvas->drawShadowedPicture(fPicture, nullptr, nullptr, fShType);
}
SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
@@ -205,6 +212,8 @@ private:
bool fSceneChanged;
bool fLightsChanged;
+ SkShadowType fShType;
+
sk_sp<SkLights> fLights;
typedef SampleView INHERITED;

Powered by Google App Engine
This is Rietveld 408576698