aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/MipMapBench.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-06-10 11:41:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-06-10 11:41:47 -0700
commit6644d9353f3f0c09914385fd762e073f98d54205 (patch)
tree617f3b1d2ca2b06cc34decfb44c4c975ba903ca5 /bench/MipMapBench.cpp
parent7049396b65660907af5292d899053280430d929a (diff)
respect srgb gamma when building mips
Proposed policy: - If the target is *legacy* (e.g. L32/PMColor) ignore gamma - If the target is S32/F16 respect gamma BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2029373004 Review-Url: https://codereview.chromium.org/2029373004
Diffstat (limited to 'bench/MipMapBench.cpp')
-rw-r--r--bench/MipMapBench.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/bench/MipMapBench.cpp b/bench/MipMapBench.cpp
index 652524364b..1f41e817db 100644
--- a/bench/MipMapBench.cpp
+++ b/bench/MipMapBench.cpp
@@ -13,10 +13,13 @@ class MipMapBench: public Benchmark {
SkBitmap fBitmap;
SkString fName;
const int fW, fH;
+ SkSourceGammaTreatment fTreatment;
public:
- MipMapBench(int w, int h) : fW(w), fH(h) {
- fName.printf("mipmap_build_%dx%d", w, h);
+ MipMapBench(int w, int h, SkSourceGammaTreatment treatment)
+ : fW(w), fH(h), fTreatment(treatment)
+ {
+ fName.printf("mipmap_build_%dx%d_%d_gamma", w, h, static_cast<int>(treatment));
}
protected:
@@ -27,13 +30,14 @@ protected:
const char* onGetName() override { return fName.c_str(); }
void onDelayedSetup() override {
- fBitmap.allocN32Pixels(fW, fH, true);
+ SkImageInfo info = SkImageInfo::MakeS32(fW, fH, kPremul_SkAlphaType);
+ fBitmap.allocPixels(info);
fBitmap.eraseColor(SK_ColorWHITE); // so we don't read uninitialized memory
}
void onDraw(int loops, SkCanvas*) override {
for (int i = 0; i < loops * 4; i++) {
- SkMipMap::Build(fBitmap, nullptr)->unref();
+ SkMipMap::Build(fBitmap, fTreatment, nullptr)->unref();
}
}
@@ -44,7 +48,8 @@ private:
// Build variants that exercise the width and heights being even or odd at each level, as the
// impl specializes on each of these.
//
-DEF_BENCH( return new MipMapBench(511, 511); )
-DEF_BENCH( return new MipMapBench(512, 511); )
-DEF_BENCH( return new MipMapBench(511, 512); )
-DEF_BENCH( return new MipMapBench(512, 512); )
+DEF_BENCH( return new MipMapBench(511, 511, SkSourceGammaTreatment::kIgnore); )
+DEF_BENCH( return new MipMapBench(512, 511, SkSourceGammaTreatment::kIgnore); )
+DEF_BENCH( return new MipMapBench(511, 512, SkSourceGammaTreatment::kIgnore); )
+DEF_BENCH( return new MipMapBench(512, 512, SkSourceGammaTreatment::kIgnore); )
+DEF_BENCH( return new MipMapBench(512, 512, SkSourceGammaTreatment::kRespect); )