Index: bench/MipMapBench.cpp |
diff --git a/bench/MipMapBench.cpp b/bench/MipMapBench.cpp |
index 652524364b2de8acf63c35153784409fc252e90a..1f41e817db4e9d2389ed88690aa738091152a8d7 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); ) |