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

Unified Diff: samplecode/SampleLighting.cpp

Issue 2026763002: Make use of new SkLights class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix SampleApp slide Created 4 years, 7 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
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkLight.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleLighting.cpp
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 5171579f6459d0b5ce9665c4985a143b8f0c8ae9..a27aa9de41b117667e030ff9c6cdd61c13e6de5a 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -12,16 +12,16 @@
#include "SkLightingShader.h"
#include "SkPoint3.h"
-static const SkLightingShader::Lights* create_lights(SkScalar angle, SkScalar blue) {
+static sk_sp<SkLights> create_lights(SkScalar angle, SkScalar blue) {
const SkVector3 dir = SkVector3::Make(SkScalarSin(angle)*SkScalarSin(SK_ScalarPI*0.25f),
SkScalarCos(angle)*SkScalarSin(SK_ScalarPI*0.25f),
SkScalarCos(SK_ScalarPI*0.25f));
- SkLightingShader::Lights::Builder builder;
+ SkLights::Builder builder;
- builder.add(SkLight(SkColor3f::Make(1.0f, 1.0f, blue), dir));
- builder.add(SkLight(SkColor3f::Make(0.1f, 0.1f, 0.1f)));
+ builder.add(SkLights::Light(SkColor3f::Make(1.0f, 1.0f, blue), dir));
+ builder.add(SkLights::Light(SkColor3f::Make(0.1f, 0.1f, 0.1f)));
return builder.finish();
}
@@ -62,11 +62,10 @@ protected:
fColorFactor = 0.0f;
}
- SkAutoTUnref<const SkLightingShader::Lights> lights(create_lights(fLightAngle,
- fColorFactor));
+ sk_sp<SkLights> lights(create_lights(fLightAngle, fColorFactor));
SkPaint paint;
paint.setShader(SkLightingShader::Make(fDiffuseBitmap, fNormalBitmap,
- lights, SkVector::Make(1.0f, 0.0f),
+ std::move(lights), SkVector::Make(1.0f, 0.0f),
nullptr, nullptr));
paint.setColor(SK_ColorBLACK);
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkLight.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698