diff options
Diffstat (limited to 'bench/SkLinearBitmapPipelineBench.cpp')
-rw-r--r-- | bench/SkLinearBitmapPipelineBench.cpp | 81 |
1 files changed, 42 insertions, 39 deletions
diff --git a/bench/SkLinearBitmapPipelineBench.cpp b/bench/SkLinearBitmapPipelineBench.cpp index 476d015231..ad5cf61882 100644 --- a/bench/SkLinearBitmapPipelineBench.cpp +++ b/bench/SkLinearBitmapPipelineBench.cpp @@ -17,12 +17,12 @@ struct CommonBitmapFPBenchmark : public Benchmark { CommonBitmapFPBenchmark( SkISize srcSize, - SkColorProfileType colorProfile, + bool isSRGB, SkMatrix m, bool useBilerp, SkShader::TileMode xTile, SkShader::TileMode yTile) - : fColorProfile(colorProfile) + : fIsSRGB(isSRGB) , fM{m} , fUseBilerp{useBilerp} , fXTile{xTile} @@ -89,7 +89,8 @@ struct CommonBitmapFPBenchmark : public Benchmark { bool trash = fM.invert(&fInvert); sk_ignore_unused_variable(trash); - fInfo = SkImageInfo::MakeN32Premul(width, height, fColorProfile); + fInfo = SkImageInfo::MakeN32Premul(width, height, fIsSRGB ? + SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named) : nullptr); } bool isSuitableFor(Backend backend) override { @@ -100,7 +101,7 @@ struct CommonBitmapFPBenchmark : public Benchmark { SkString fName; SkISize fSrcSize; - SkColorProfileType fColorProfile; + bool fIsSRGB; SkMatrix fM; SkMatrix fInvert; bool fUseBilerp; @@ -113,16 +114,16 @@ struct CommonBitmapFPBenchmark : public Benchmark { struct SkBitmapFPGeneral final : public CommonBitmapFPBenchmark { SkBitmapFPGeneral( SkISize srcSize, - SkColorProfileType colorProfile, + bool isSRGB, SkMatrix m, bool useBilerp, SkShader::TileMode xTile, SkShader::TileMode yTile) - : CommonBitmapFPBenchmark(srcSize, colorProfile, m, useBilerp, xTile, yTile) { } + : CommonBitmapFPBenchmark(srcSize, isSRGB, m, useBilerp, xTile, yTile) { } SkString BaseName() override { SkString name; - if (fInfo.isSRGB()) { + if (fInfo.gammaCloseToSRGB()) { name.set("sRGB"); } else { name.set("Linr"); @@ -159,12 +160,12 @@ struct SkBitmapFPGeneral final : public CommonBitmapFPBenchmark { struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark { SkBitmapFPOrigShader( SkISize srcSize, - SkColorProfileType colorProfile, + bool isSRGB, SkMatrix m, bool useBilerp, SkShader::TileMode xTile, SkShader::TileMode yTile) - : CommonBitmapFPBenchmark(srcSize, colorProfile, m, useBilerp, xTile, yTile) { } + : CommonBitmapFPBenchmark(srcSize, isSRGB, m, useBilerp, xTile, yTile) { } SkString BaseName() override { SkString name{"Orig"}; @@ -212,80 +213,82 @@ struct SkBitmapFPOrigShader : public CommonBitmapFPBenchmark { sk_sp<SkImage> fImage; }; +const bool gSRGB = true; +const bool gLinearRGB = false; static SkISize srcSize = SkISize::Make(120, 100); static SkMatrix mI = SkMatrix::I(); DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mI, false, + srcSize, gSRGB, mI, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mI, false, + srcSize, gLinearRGB, mI, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mI, false, + srcSize, gLinearRGB, mI, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mI, true, + srcSize, gSRGB, mI, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mI, true, + srcSize, gLinearRGB, mI, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mI, true, + srcSize, gLinearRGB, mI, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) static SkMatrix mS = SkMatrix::MakeScale(2.7f, 2.7f); DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mS, false, + srcSize, gSRGB, mS, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mS, false, + srcSize, gLinearRGB, mS, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mS, false, + srcSize, gLinearRGB, mS, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mS, true, + srcSize, gSRGB, mS, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mS, true, + srcSize, gLinearRGB, mS, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mS, true, + srcSize, gLinearRGB, mS, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) // Repeat DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mS, false, + srcSize, gSRGB, mS, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mS, false, + srcSize, gLinearRGB, mS, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mS, false, + srcSize, gLinearRGB, mS, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mS, true, + srcSize, gSRGB, mS, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mS, true, + srcSize, gLinearRGB, mS, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mS, true, + srcSize, gLinearRGB, mS, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) static SkMatrix rotate(SkScalar r) { @@ -296,50 +299,50 @@ static SkMatrix rotate(SkScalar r) { static SkMatrix mR = rotate(30); DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mR, false, + srcSize, gSRGB, mR, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mR, false, + srcSize, gLinearRGB, mR, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mR, false, + srcSize, gLinearRGB, mR, false, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mR, true, + srcSize, gSRGB, mR, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mR, true, + srcSize, gLinearRGB, mR, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mR, true, + srcSize, gLinearRGB, mR, true, SkShader::kClamp_TileMode, SkShader::kClamp_TileMode);) // Repeat DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mR, false, + srcSize, gSRGB, mR, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mR, false, + srcSize, gLinearRGB, mR, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mR, false, + srcSize, gLinearRGB, mR, false, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kSRGB_SkColorProfileType, mR, true, + srcSize, gSRGB, mR, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPGeneral( - srcSize, kLinear_SkColorProfileType, mR, true, + srcSize, gLinearRGB, mR, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) DEF_BENCH(return new SkBitmapFPOrigShader( - srcSize, kLinear_SkColorProfileType, mR, true, + srcSize, gLinearRGB, mR, true, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode);) |