aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkLightingImageFilter.h
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-11 16:01:22 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-11 16:01:22 +0000
commit894790d77c56cd4bae8070331d275c6d2897e33c (patch)
tree3eb922a14915b4a54f5788b323ae6d2c6c80fe45 /include/effects/SkLightingImageFilter.h
parenteb715c8d5caa2191d611c4f9cfb22b4afc6c8d02 (diff)
This patch implements the diffuse and specular lighting filters in Ganesh.
There are three light types for each: distant, point and spot, whose code generation lives in a GrGLLight class hierarchy. This similar to the CPU implementation, where each light type provides a function to compute the vector from the surface plane to the light (surfaceToLight) and to compute the light colour (emitLightColour). Instead of templated member functions, as in the CPU implementation, these are virtual functions to emit the light-specific GLSL code. All of the code for the GPU path lives in the same file as that for the CPU path, SkLightingImageFilter.cpp. In order to provide Ganesh a hook to access it, SkImageFilter now has a asNewCustomStage() virtual, which allows an image filter to return a GrCustomStage representing that filter. Note that this patch does not handle the border conditions correctly (the [top|bottom][Left|Right]Normal() functions in the CPU implementation). That will come in a future patch. Review URL: http://codereview.appspot.com/6345081/ git-svn-id: http://skia.googlecode.com/svn/trunk@4535 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects/SkLightingImageFilter.h')
-rw-r--r--include/effects/SkLightingImageFilter.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/effects/SkLightingImageFilter.h b/include/effects/SkLightingImageFilter.h
index 5406e7e627..c1ef234ea4 100644
--- a/include/effects/SkLightingImageFilter.h
+++ b/include/effects/SkLightingImageFilter.h
@@ -39,6 +39,9 @@ public:
SkPoint3 operator-(const SkPoint3& other) const {
return SkPoint3(fX - other.fX, fY - other.fY, fZ - other.fZ);
}
+ bool operator==(const SkPoint3& other) const {
+ return fX == other.fX && fY == other.fY && fZ == other.fZ;
+ }
SkScalar fX, fY, fZ;
};