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

Unified Diff: src/effects/SkLightingShader.h

Issue 1304673002: Revert "Update SkLightingShader to support rotation" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/core/SkPoint3.cpp ('k') | src/effects/SkLightingShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkLightingShader.h
diff --git a/src/core/SkLightingShader.h b/src/effects/SkLightingShader.h
similarity index 55%
rename from src/core/SkLightingShader.h
rename to src/effects/SkLightingShader.h
index 499e358238090dbc4ce817b5154b21f0f7441076..64d41a291e7bd8d90d402e1b33954bd3cd78a1dc 100644
--- a/src/core/SkLightingShader.h
+++ b/src/effects/SkLightingShader.h
@@ -10,57 +10,15 @@
#ifndef SkLightingShader_DEFINED
#define SkLightingShader_DEFINED
-#include "SkFlattenable.h"
-#include "SkLight.h"
+#include "SkPoint3.h"
#include "SkShader.h"
-#include "SkTDArray.h"
-
-class SkBitmap;
-class SkMatrix;
class SK_API SkLightingShader {
public:
- class Lights : public SkRefCnt {
- public:
- class Builder {
- public:
- Builder(const SkLight lights[], int numLights)
- : fLights(SkNEW_ARGS(Lights, (lights, numLights))) {
- }
-
- Builder() : fLights(SkNEW(Lights)) { }
-
- // TODO: limit the number of lights here or just ignore those
- // above some maximum?
- void add(const SkLight& light) {
- if (fLights) {
- *fLights->fLights.push() = light;
- }
- }
-
- const Lights* finish() {
- return fLights.detach();
- }
-
- private:
- SkAutoTUnref<Lights> fLights;
- };
-
- int numLights() const {
- return fLights.count();
- }
-
- const SkLight& light(int index) const {
- return fLights[index];
- }
-
- private:
- Lights() {}
- Lights(const SkLight lights[], int numLights) : fLights(lights, numLights) {}
-
- SkTDArray<SkLight> fLights;
-
- typedef SkRefCnt INHERITED;
+ struct Light {
+ SkVector3 fDirection; // direction towards the light (+Z is out of the screen).
+ // If degenerate, it will be replaced with (0, 0, 1).
+ SkColor3f fColor; // linear (unpremul) color. Range is 0..1 in each channel.
};
/** Returns a shader that lights the diffuse and normal maps with a single light.
@@ -92,8 +50,8 @@ public:
(127, 127, 0).
*/
static SkShader* Create(const SkBitmap& diffuse, const SkBitmap& normal,
- const Lights* lights, const SkVector& invNormRotation,
- const SkMatrix* diffLocalMatrix, const SkMatrix* normLocalMatrix);
+ const SkLightingShader::Light& light, const SkColor3f& ambient,
+ const SkMatrix* localMatrix);
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
};
« no previous file with comments | « src/core/SkPoint3.cpp ('k') | src/effects/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698