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

Unified Diff: bench/LightingBench.cpp

Issue 1869763002: Update LightingImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 years, 8 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 | fuzz/FilterFuzz.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 2c78749d9f01f2155c3d07c26d4686b2a3d8b610..72f37bf4d0e84bfe9b2d14dad03db7a18a45ce4c 100644
--- a/bench/LightingBench.cpp
+++ b/bench/LightingBench.cpp
@@ -20,11 +20,11 @@ public:
LightingBaseBench(bool small) : fIsSmall(small) { }
protected:
- void draw(int loops, SkCanvas* canvas, SkImageFilter* imageFilter) const {
+ void draw(int loops, SkCanvas* canvas, sk_sp<SkImageFilter> imageFilter) const {
SkRect r = fIsSmall ? SkRect::MakeWH(FILTER_WIDTH_SMALL, FILTER_HEIGHT_SMALL) :
SkRect::MakeWH(FILTER_WIDTH_LARGE, FILTER_HEIGHT_LARGE);
SkPaint paint;
- paint.setImageFilter(imageFilter)->unref();
+ paint.setImageFilter(std::move(imageFilter));
for (int i = 0; i < loops; i++) {
canvas->drawRect(r, paint);
}
@@ -99,8 +99,7 @@ protected:
class LightingPointLitDiffuseBench : public LightingBaseBench {
public:
- LightingPointLitDiffuseBench(bool small) : INHERITED(small) {
- }
+ LightingPointLitDiffuseBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -108,10 +107,11 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreatePointLitDiffuse(GetPointLocation(),
- GetWhite(),
- GetSurfaceScale(),
- GetKd()));
+ draw(loops, canvas, SkLightingImageFilter::MakePointLitDiffuse(GetPointLocation(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd(),
+ nullptr));
}
private:
@@ -120,8 +120,7 @@ private:
class LightingDistantLitDiffuseBench : public LightingBaseBench {
public:
- LightingDistantLitDiffuseBench(bool small) : INHERITED(small) {
- }
+ LightingDistantLitDiffuseBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -129,10 +128,11 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateDistantLitDiffuse(GetDistantDirection(),
- GetWhite(),
- GetSurfaceScale(),
- GetKd()));
+ draw(loops, canvas, SkLightingImageFilter::MakeDistantLitDiffuse(GetDistantDirection(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd(),
+ nullptr));
}
private:
@@ -141,8 +141,7 @@ private:
class LightingSpotLitDiffuseBench : public LightingBaseBench {
public:
- LightingSpotLitDiffuseBench(bool small) : INHERITED(small) {
- }
+ LightingSpotLitDiffuseBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -150,13 +149,14 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateSpotLitDiffuse(GetSpotLocation(),
- GetSpotTarget(),
- GetSpotExponent(),
- GetCutoffAngle(),
- GetWhite(),
- GetSurfaceScale(),
- GetKd()));
+ draw(loops, canvas, SkLightingImageFilter::MakeSpotLitDiffuse(GetSpotLocation(),
+ GetSpotTarget(),
+ GetSpotExponent(),
+ GetCutoffAngle(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKd(),
+ nullptr));
}
private:
@@ -165,8 +165,7 @@ private:
class LightingPointLitSpecularBench : public LightingBaseBench {
public:
- LightingPointLitSpecularBench(bool small) : INHERITED(small) {
- }
+ LightingPointLitSpecularBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -174,11 +173,12 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreatePointLitSpecular(GetPointLocation(),
- GetWhite(),
- GetSurfaceScale(),
- GetKs(),
- GetShininess()));
+ draw(loops, canvas, SkLightingImageFilter::MakePointLitSpecular(GetPointLocation(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess(),
+ nullptr));
}
private:
@@ -187,8 +187,7 @@ private:
class LightingDistantLitSpecularBench : public LightingBaseBench {
public:
- LightingDistantLitSpecularBench(bool small) : INHERITED(small) {
- }
+ LightingDistantLitSpecularBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -196,11 +195,12 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateDistantLitSpecular(GetDistantDirection(),
- GetWhite(),
- GetSurfaceScale(),
- GetKs(),
- GetShininess()));
+ draw(loops, canvas, SkLightingImageFilter::MakeDistantLitSpecular(GetDistantDirection(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess(),
+ nullptr));
}
private:
@@ -209,8 +209,7 @@ private:
class LightingSpotLitSpecularBench : public LightingBaseBench {
public:
- LightingSpotLitSpecularBench(bool small) : INHERITED(small) {
- }
+ LightingSpotLitSpecularBench(bool small) : INHERITED(small) { }
protected:
const char* onGetName() override {
@@ -218,14 +217,15 @@ protected:
}
void onDraw(int loops, SkCanvas* canvas) override {
- draw(loops, canvas, SkLightingImageFilter::CreateSpotLitSpecular(GetSpotLocation(),
- GetSpotTarget(),
- GetSpotExponent(),
- GetCutoffAngle(),
- GetWhite(),
- GetSurfaceScale(),
- GetKs(),
- GetShininess()));
+ draw(loops, canvas, SkLightingImageFilter::MakeSpotLitSpecular(GetSpotLocation(),
+ GetSpotTarget(),
+ GetSpotExponent(),
+ GetCutoffAngle(),
+ GetWhite(),
+ GetSurfaceScale(),
+ GetKs(),
+ GetShininess(),
+ nullptr));
}
private:
« no previous file with comments | « no previous file | fuzz/FilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698