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

Unified Diff: src/effects/SkLightingShader.h

Issue 1245883003: Move LightingShader to effects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address 64b gcc memory issues (seems to require more space than others) Created 5 years, 5 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/SkBitmapProcState.h ('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/effects/SkLightingShader.h b/src/effects/SkLightingShader.h
new file mode 100644
index 0000000000000000000000000000000000000000..d3fe3f66ac5d1b6652ac1a0cf33c794bf4326761
--- /dev/null
+++ b/src/effects/SkLightingShader.h
@@ -0,0 +1,45 @@
+
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+
+#ifndef SkLightingShader_DEFINED
+#define SkLightingShader_DEFINED
+
+#include "SkPoint3.h"
+#include "SkShader.h"
+
+class SK_API SkLightingShader {
+public:
+ struct Light {
+ SkVector3 fDirection; // direction towards the light (+Z is out of the screen).
+ // If degenerate, it will be replaced with (0, 0, 1).
+ SkColor fColor; // linear (unpremul) color. Note: alpha assumed to be 255.
+ };
+
+ /** Returns a shader that lights the diffuse and normal maps with a single light.
+
+ It returns a shader with a reference count of 1.
+ The caller should decrement the shader's reference count when done with the shader.
+ It is an error for count to be < 2.
+ @param diffuse the diffuse bitmap
+ @param normal the normal map
+ @param light the light applied to the normal map
+ @param ambient the linear (unpremul) ambient light color. Note: alpha assumed to be 255.
+
+ NULL will be returned if:
+ either 'diffuse' or 'normal' are empty
+ either 'diffuse' or 'normal' are too big (> 65535 on a side)
+ 'diffuse' and 'normal' aren't the same size
+ */
+ static SkShader* Create(const SkBitmap& diffuse, const SkBitmap& normal,
+ const SkLightingShader::Light& light, const SkColor ambient);
+
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
+};
+
+#endif
« no previous file with comments | « src/core/SkBitmapProcState.h ('k') | src/effects/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698