aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-15 05:09:32 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 05:09:32 -0700
commit47db5fe4436c924f42b05bc63f8fad833b99bfbe (patch)
treeee36eee27a6b983aec2a6600a2a50768ec9e4fc0 /bench
parentad3dc0da218cc43c9917a256d4afb8cf0d7c5899 (diff)
Revert of Update DisplacementMapEffect to sk_sp (patchset #3 id:40001 of https://codereview.chromium.org/1877783003/ )
Reason for revert: unexpected image diffs in imagefilterscropexpand GM Original issue's description: > Update DisplacementMapEffect to sk_sp > > TBR=reed@google.com > > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1877783003 > > Committed: https://skia.googlesource.com/skia/+/a53011ef44705a091a8e24f7ea289a3f9ad759f2 TBR=fmalita@chromium.org,reed@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1884253004
Diffstat (limited to 'bench')
-rw-r--r--bench/DisplacementBench.cpp36
-rw-r--r--bench/ImageFilterDAGBench.cpp7
2 files changed, 22 insertions, 21 deletions
diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp
index 9edf21476c..82857e630f 100644
--- a/bench/DisplacementBench.cpp
+++ b/bench/DisplacementBench.cpp
@@ -18,7 +18,9 @@
class DisplacementBaseBench : public Benchmark {
public:
- DisplacementBaseBench(bool small) : fInitialized(false), fIsSmall(small) { }
+ DisplacementBaseBench(bool small) :
+ fInitialized(false), fIsSmall(small) {
+ }
protected:
void onDelayedSetup() override {
@@ -90,7 +92,8 @@ private:
class DisplacementZeroBench : public DisplacementBaseBench {
public:
- DisplacementZeroBench(bool small) : INHERITED(small) { }
+ DisplacementZeroBench(bool small) : INHERITED(small) {
+ }
protected:
const char* onGetName() override {
@@ -101,10 +104,9 @@ protected:
SkPaint paint;
sk_sp<SkImageFilter> displ(SkImageSource::Make(fCheckerboard));
// No displacement effect
- paint.setImageFilter(SkDisplacementMapEffect::Make(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kG_ChannelSelectorType,
- 0.0f, std::move(displ), nullptr));
+ paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kG_ChannelSelectorType, 0.0f, displ.get()))->unref();
for (int i = 0; i < loops; i++) {
this->drawClippedBitmap(canvas, 0, 0, paint);
@@ -117,7 +119,8 @@ private:
class DisplacementAlphaBench : public DisplacementBaseBench {
public:
- DisplacementAlphaBench(bool small) : INHERITED(small) { }
+ DisplacementAlphaBench(bool small) : INHERITED(small) {
+ }
protected:
const char* onGetName() override {
@@ -128,12 +131,11 @@ protected:
SkPaint paint;
sk_sp<SkImageFilter> displ(SkImageSource::Make(fCheckerboard));
// Displacement, with 1 alpha component (which isn't pre-multiplied)
- paint.setImageFilter(SkDisplacementMapEffect::Make(
- SkDisplacementMapEffect::kB_ChannelSelectorType,
- SkDisplacementMapEffect::kA_ChannelSelectorType,
- 16.0f, std::move(displ), nullptr));
+ paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kB_ChannelSelectorType,
+ SkDisplacementMapEffect::kA_ChannelSelectorType, 16.0f, displ.get()))->unref();
for (int i = 0; i < loops; i++) {
- this->drawClippedBitmap(canvas, 100, 0, paint);
+ drawClippedBitmap(canvas, 100, 0, paint);
}
}
@@ -143,7 +145,8 @@ private:
class DisplacementFullBench : public DisplacementBaseBench {
public:
- DisplacementFullBench(bool small) : INHERITED(small) { }
+ DisplacementFullBench(bool small) : INHERITED(small) {
+ }
protected:
const char* onGetName() override {
@@ -154,10 +157,9 @@ protected:
SkPaint paint;
sk_sp<SkImageFilter> displ(SkImageSource::Make(fCheckerboard));
// Displacement, with 2 non-alpha components
- paint.setImageFilter(SkDisplacementMapEffect::Make(
- SkDisplacementMapEffect::kR_ChannelSelectorType,
- SkDisplacementMapEffect::kB_ChannelSelectorType,
- 32.0f, std::move(displ), nullptr));
+ paint.setImageFilter(SkDisplacementMapEffect::Create(
+ SkDisplacementMapEffect::kR_ChannelSelectorType,
+ SkDisplacementMapEffect::kB_ChannelSelectorType, 32.0f, displ.get()))->unref();
for (int i = 0; i < loops; ++i) {
this->drawClippedBitmap(canvas, 200, 0, paint);
}
diff --git a/bench/ImageFilterDAGBench.cpp b/bench/ImageFilterDAGBench.cpp
index 776ee787fd..308b3b0037 100644
--- a/bench/ImageFilterDAGBench.cpp
+++ b/bench/ImageFilterDAGBench.cpp
@@ -62,11 +62,10 @@ protected:
auto xSelector = SkDisplacementMapEffect::kR_ChannelSelectorType;
auto ySelector = SkDisplacementMapEffect::kB_ChannelSelectorType;
SkScalar scale = 2;
-
+ sk_sp<SkImageFilter> displ(SkDisplacementMapEffect::Create(xSelector, ySelector, scale,
+ blur.get(), blur.get()));
SkPaint paint;
- paint.setImageFilter(SkDisplacementMapEffect::Make(xSelector, ySelector, scale,
- blur, blur));
-
+ paint.setImageFilter(std::move(displ));
SkRect rect = SkRect::Make(SkIRect::MakeWH(400, 400));
canvas->drawRect(rect, paint);
}