Add new SkPoint3 class
The existing Light filter and the upcoming Lighting Shader both need a Point3 class
Review URL: https://codereview.chromium.org/1229693009
diff --git a/samplecode/SampleFilterFuzz.cpp b/samplecode/SampleFilterFuzz.cpp
index 30389b6..bae7c21 100644
--- a/samplecode/SampleFilterFuzz.cpp
+++ b/samplecode/SampleFilterFuzz.cpp
@@ -26,6 +26,7 @@
#include "SkPerlinNoiseShader.h"
#include "SkPictureImageFilter.h"
#include "SkPictureRecorder.h"
+#include "SkPoint3.h"
#include "SkRandom.h"
#include "SkRectShaderImageFilter.h"
#include "SkTestImageFilters.h"
@@ -128,7 +129,7 @@
}
static SkPoint3 make_point() {
- return SkPoint3(make_scalar(), make_scalar(), make_scalar(true));
+ return SkPoint3::Make(make_scalar(), make_scalar(), make_scalar(true));
}
static SkDisplacementMapEffect::ChannelSelectorType make_channel_selector_type() {
@@ -357,10 +358,10 @@
break;
case SPOT_LIGHT:
filter = (R(2) == 1) ?
- SkLightingImageFilter::CreateSpotLitDiffuse(SkPoint3(0, 0, 0),
+ SkLightingImageFilter::CreateSpotLitDiffuse(SkPoint3::Make(0, 0, 0),
make_point(), make_scalar(), make_scalar(), make_color(),
make_scalar(), make_scalar(), make_image_filter()) :
- SkLightingImageFilter::CreateSpotLitSpecular(SkPoint3(0, 0, 0),
+ SkLightingImageFilter::CreateSpotLitSpecular(SkPoint3::Make(0, 0, 0),
make_point(), make_scalar(), make_scalar(), make_color(),
make_scalar(), make_scalar(), SkIntToScalar(R(10)), make_image_filter());
break;
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 40e6fbb..a002a93 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -11,6 +11,7 @@
#include "SkCanvas.h"
#include "SkErrorInternals.h"
#include "SkGr.h"
+#include "SkPoint3.h"
#include "SkReadBuffer.h"
#include "SkShader.h"
#include "SkWriteBuffer.h"
@@ -21,18 +22,6 @@
///////////////////////////////////////////////////////////////////////////////
-struct SkVector3 {
- SkScalar fX, fY, fZ;
-
- bool operator==(const SkVector3& other) const {
- return fX == other.fX && fY == other.fY && fZ == other.fZ;
- }
-
- bool operator!=(const SkVector3& other) const {
- return !(*this == other);
- }
-};
-
class LightingShader : public SkShader {
public:
struct Light {