diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-13 19:45:41 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-13 19:45:41 +0000 |
commit | 1037d92bbc10cafb61d050638e8cbe5a3aa6706f (patch) | |
tree | 49f4e5edaddcbe0c772914904913e2492d656b71 /gm | |
parent | 3da3b621c34810514a6d415a1dc782bd21648c3c (diff) |
Added Z scale when X and Y scale to spot lights and point lights
Z scale is set as the average of X scale and Y scale.
BUG=skia:
R=senorblanco@google.com, senorblanco@chromium.org
Author: sugoi@chromium.org
Review URL: https://codereview.chromium.org/198013002
git-svn-id: http://skia.googlecode.com/svn/trunk@13798 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm')
-rw-r--r-- | gm/imagefiltersscaled.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp index 809e7ea344..5dca30b822 100644 --- a/gm/imagefiltersscaled.cpp +++ b/gm/imagefiltersscaled.cpp @@ -12,6 +12,7 @@ #include "SkDisplacementMapEffect.h" #include "SkDropShadowImageFilter.h" #include "SkGradientShader.h" +#include "SkLightingImageFilter.h" #include "SkMorphologyImageFilter.h" #include "SkOffsetImageFilter.h" #include "SkPerlinNoiseShader.h" @@ -35,7 +36,7 @@ protected: } virtual SkISize onISize() { - return make_isize(1140, 500); + return make_isize(1428, 500); } void make_checkerboard() { @@ -91,6 +92,15 @@ protected: SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); + SkPoint3 pointLocation(0, 0, SkIntToScalar(10)); + SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToScalar(20)); + SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0); + SkScalar spotExponent = SK_Scalar1; + SkScalar cutoffAngle = SkIntToScalar(15); + SkScalar kd = SkIntToScalar(2); + SkScalar surfaceScale = SkIntToScalar(1); + SkColor white(0xFFFFFFFF); + SkImageFilter* filters[] = { SkBlurImageFilter::Create(SkIntToScalar(4), SkIntToScalar(4)), SkDropShadowImageFilter::Create(SkIntToScalar(5), SkIntToScalar(10), SkIntToScalar(3), @@ -105,6 +115,9 @@ protected: SkOffsetImageFilter::Create(SkIntToScalar(32), 0), SkResizeImageFilter::Create(RESIZE_FACTOR, RESIZE_FACTOR, SkPaint::kNone_FilterLevel), SkRectShaderImageFilter::Create(noise), + SkLightingImageFilter::CreatePointLitDiffuse(pointLocation, white, surfaceScale, kd), + SkLightingImageFilter::CreateSpotLitDiffuse(spotLocation, spotTarget, spotExponent, + cutoffAngle, white, surfaceScale, kd), }; SkVector scales[] = { |