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

Unified Diff: bench/LightingBench.cpp

Issue 1229693009: Add new SkPoint3 class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: More Chromium staging 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 | « no previous file | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/LightingBench.cpp
diff --git a/bench/LightingBench.cpp b/bench/LightingBench.cpp
index a56ed226e2441a0ae6a6a2409672eb6b964dc109..ce6c11989d697a329b5dca9a992fc6f249dabff1 100644
--- a/bench/LightingBench.cpp
+++ b/bench/LightingBench.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkDevice.h"
#include "SkLightingImageFilter.h"
+#include "SkPoint3.h"
#define FILTER_WIDTH_SMALL SkIntToScalar(32)
#define FILTER_HEIGHT_SMALL SkIntToScalar(32)
@@ -30,63 +31,65 @@ protected:
}
}
- static SkPoint3 getPointLocation() {
- static SkPoint3 pointLocation(0, 0, SkIntToScalar(10));
+ static SkPoint3 GetPointLocation() {
+ static SkPoint3 pointLocation = SkPoint3::Make(0, 0, SkIntToScalar(10));
return pointLocation;
}
- static SkPoint3 getDistantDirection() {
+ static SkPoint3 GetDistantDirection() {
static SkScalar azimuthRad = SkDegreesToRadians(SkIntToScalar(225));
static SkScalar elevationRad = SkDegreesToRadians(SkIntToScalar(5));
- static SkPoint3 distantDirection(SkScalarMul(SkScalarCos(azimuthRad),
- SkScalarCos(elevationRad)),
- SkScalarMul(SkScalarSin(azimuthRad),
- SkScalarCos(elevationRad)),
- SkScalarSin(elevationRad));
+ static SkPoint3 distantDirection = SkPoint3::Make(SkScalarMul(SkScalarCos(azimuthRad),
+ SkScalarCos(elevationRad)),
+ SkScalarMul(SkScalarSin(azimuthRad),
+ SkScalarCos(elevationRad)),
+ SkScalarSin(elevationRad));
return distantDirection;
}
- static SkPoint3 getSpotLocation() {
- static SkPoint3 spotLocation(SkIntToScalar(-10), SkIntToScalar(-10), SkIntToScalar(20));
+ static SkPoint3 GetSpotLocation() {
+ static SkPoint3 spotLocation = SkPoint3::Make(SkIntToScalar(-10),
+ SkIntToScalar(-10),
+ SkIntToScalar(20));
return spotLocation;
}
- static SkPoint3 getSpotTarget() {
- static SkPoint3 spotTarget(SkIntToScalar(40), SkIntToScalar(40), 0);
+ static SkPoint3 GetSpotTarget() {
+ static SkPoint3 spotTarget = SkPoint3::Make(SkIntToScalar(40), SkIntToScalar(40), 0);
return spotTarget;
}
- static SkScalar getSpotExponent() {
+ static SkScalar GetSpotExponent() {
static SkScalar spotExponent = SK_Scalar1;
return spotExponent;
}
- static SkScalar getCutoffAngle() {
+ static SkScalar GetCutoffAngle() {
static SkScalar cutoffAngle = SkIntToScalar(15);
return cutoffAngle;
}
- static SkScalar getKd() {
+ static SkScalar GetKd() {
static SkScalar kd = SkIntToScalar(2);
return kd;
}
- static SkScalar getKs() {
+ static SkScalar GetKs() {
static SkScalar ks = SkIntToScalar(1);
return ks;
}
- static SkScalar getShininess() {
+ static SkScalar GetShininess() {
static SkScalar shininess = SkIntToScalar(8);
return shininess;
}
- static SkScalar getSurfaceScale() {
+ static SkScalar GetSurfaceScale() {
static SkScalar surfaceScale = SkIntToScalar(1);
return surfaceScale;
}
- static SkColor getWhite() {
+ static SkColor GetWhite() {
static SkColor white(0xFFFFFFFF);
return white;
}
@@ -106,10 +109,10 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(getPointLocation(),
- getWhite(),
- getSurfaceScale(),
- getKd()));
+ draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(GetPointLocation(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd()));
}
private:
@@ -127,10 +130,10 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(getDistantDirection(),
- getWhite(),
- getSurfaceScale(),
- getKd()));
+ draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(GetDistantDirection(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd()));
}
private:
@@ -148,13 +151,13 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(getSpotLocation(),
- getSpotTarget(),
- getSpotExponent(),
- getCutoffAngle(),
- getWhite(),
- getSurfaceScale(),
- getKd()));
+ draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(GetSpotLocation(),
+ GetSpotTarget(),
+ GetSpotExponent(),
+ GetCutoffAngle(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd()));
}
private:
@@ -172,11 +175,11 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(getPointLocation(),
- getWhite(),
- getSurfaceScale(),
- getKs(),
- getShininess()));
+ draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(GetPointLocation(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess()));
}
private:
@@ -194,11 +197,11 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(getDistantDirection(),
- getWhite(),
- getSurfaceScale(),
- getKs(),
- getShininess()));
+ draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(GetDistantDirection(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess()));
}
private:
@@ -216,14 +219,14 @@ protected:
}
void onDraw(const int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(getSpotLocation(),
- getSpotTarget(),
- getSpotExponent(),
- getCutoffAngle(),
- getWhite(),
- getSurfaceScale(),
- getKs(),
- getShininess()));
+ draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(GetSpotLocation(),
+ GetSpotTarget(),
+ GetSpotExponent(),
+ GetCutoffAngle(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess()));
}
private:
« no previous file with comments | « no previous file | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698