From 4e05ee9c5ab7a816e64ea3444859c00d5715e7a5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 23 Feb 2022 00:01:52 +0000 Subject: [PATCH] Benchmark wxIMAGE_QUALITY_BOX_AVERAGE too for completeness Check the speed of wxImage::Scale() using this algorithm too. As expected, it's between normal and high quality when upscaling and exactly the same as high quality when shrinking (because it is actually the algorithm used for shrinking for wxIMAGE_QUALITY_HIGH). --- tests/benchmarks/image.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/benchmarks/image.cpp b/tests/benchmarks/image.cpp index 15fc4ebaf5..663e1a362e 100644 --- a/tests/benchmarks/image.cpp +++ b/tests/benchmarks/image.cpp @@ -79,6 +79,14 @@ BENCHMARK_FUNC(EnlargeNormal) wxIMAGE_QUALITY_NORMAL).IsOk(); } +BENCHMARK_FUNC(EnlargeBoxAverage) +{ + const wxImage& image = GetTestImage(); + const double factor = Bench::GetNumericParameter(150) / 100.; + return image.Scale(factor*image.GetWidth(), factor*image.GetHeight(), + wxIMAGE_QUALITY_BOX_AVERAGE).IsOk(); +} + BENCHMARK_FUNC(EnlargeHighQuality) { const wxImage& image = GetTestImage(); @@ -95,6 +103,14 @@ BENCHMARK_FUNC(ShrinkNormal) wxIMAGE_QUALITY_NORMAL).IsOk(); } +BENCHMARK_FUNC(ShrinkBoxAverage) +{ + const wxImage& image = GetTestImage(); + const double factor = Bench::GetNumericParameter(50) / 100.; + return image.Scale(factor*image.GetWidth(), factor*image.GetHeight(), + wxIMAGE_QUALITY_BOX_AVERAGE).IsOk(); +} + BENCHMARK_FUNC(ShrinkHighQuality) { const wxImage& image = GetTestImage();