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

Unified Diff: bench/MipMapBench.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 4 years, 6 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/gamma.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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); )
« no previous file with comments | « no previous file | gm/gamma.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698