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

Unified Diff: src/core/SkLightingShader.h

Issue 2050773002: Refactoring of CPU NormalMap handling out into its own class (Closed) Base URL: https://skia.googlesource.com/skia@dvonbeck-normals-gpu-cl
Patch Set: Got rid of variable-length arrays Created 4 years, 6 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 | « no previous file | src/core/SkLightingShader.cpp » ('j') | src/core/SkLightingShader.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLightingShader.h
diff --git a/src/core/SkLightingShader.h b/src/core/SkLightingShader.h
index 6301eeeea13595919e5626829ac36134e93ccbe3..75a7738755865704972e22bc1c7232bb93764adf 100644
--- a/src/core/SkLightingShader.h
+++ b/src/core/SkLightingShader.h
@@ -16,9 +16,8 @@ class SkMatrix;
class SK_API SkLightingShader {
public:
- /** Abstract class that generates or reads in normals for use by SkLightingShader. Currently
- implements the GPU side only. Not to be used as part of the API yet. Used internally by
- SkLightingShader.
+ /** Abstract class that generates or reads in normals for use by SkLightingShader. Not to be
+ used as part of the API yet. Used internally by SkLightingShader.
*/
class NormalSource : public SkFlattenable {
public:
@@ -37,6 +36,30 @@ public:
SkSourceGammaTreatment gammaTreatment) const = 0;
#endif
+ class Provider {
+ public:
+ virtual ~Provider(){};
egdaniel 2016/06/16 13:48:10 nit: space between () and {}
dvonbeck 2016/06/16 22:05:40 Done.
+
+ /** Called for each span of the object being drawn on the CPU. Your subclass should set
+ the appropriate normals that correspond to the specified device coordinates.
+ */
+ virtual void fillScanLine(int x, int y, SkPoint3 output[], int count) const = 0;
+
+ /** Returns the maximum count that can be passed into 'fillScanLine' for an output
+ buffer of size 'count'.
+ */
+ virtual int maxCountForFillScanLine(int count) const = 0;
+ };
+
+ /** Returns an instance of 'Provider' that provides normals for the CPU pipeline. The
+ necessary data will be initialized in place at 'storage'.
+ */
+ virtual Provider* asProvider(const SkShader::ContextRec& rec, void* storage) const = 0;
+
+ /** Amount of memory needed to store a provider object and its dependencies.
+ */
+ virtual size_t providerSize() const = 0;
+
SK_DEFINE_FLATTENABLE_TYPE(NormalSource)
};
« no previous file with comments | « no previous file | src/core/SkLightingShader.cpp » ('j') | src/core/SkLightingShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698