Move ToolUtils::make_big_path() to bench/

The ToolUtils file is getting a bit bloated, IMO. I noticed this when
working on Bazel includes.

Including non-header files is a small nuisance in Bazel, so it
is probably better to just make it its own compilation unit.

Change-Id: I06ca3808a37ebef6478f5afa3f14086429899590
Bug: skia:12541
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/459197
Reviewed-by: Ben Wagner <bungeman@google.com>
This commit is contained in:
Kevin Lubick 2021-10-13 16:02:56 -04:00 committed by SkCQ
parent 5ff51fb2e3
commit f541ddf785
10 changed files with 5198 additions and 5167 deletions

View File

@ -2246,7 +2246,10 @@ if (skia_enable_tools) {
}
test_app("skpbench") {
sources = [ "tools/skpbench/skpbench.cpp" ]
sources = [
"bench/BigPath.cpp",
"tools/skpbench/skpbench.cpp",
]
deps = [
":common_flags_config",
":common_flags_gpu",

5173
bench/BigPath.cpp Normal file

File diff suppressed because it is too large Load Diff

16
bench/BigPath.h Normal file
View File

@ -0,0 +1,16 @@
/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#pragma once
class SkPath;
namespace BenchUtils {
SkPath make_big_path();
}

View File

@ -6,6 +6,7 @@
*/
#include "bench/Benchmark.h"
#include "bench/BigPath.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPath.h"
#include "tools/ToolUtils.h"
@ -42,7 +43,7 @@ protected:
return SkIPoint::Make(640, 100);
}
void onDelayedSetup() override { fPath = ToolUtils::make_big_path(); }
void onDelayedSetup() override { fPath = BenchUtils::make_big_path(); }
void onDraw(int loops, SkCanvas* canvas) override {
SkPaint paint;

View File

@ -13,6 +13,7 @@ bench_sources = [
"$_bench/BenchLogger.cpp",
"$_bench/Benchmark.cpp",
"$_bench/BezierBench.cpp",
"$_bench/BigPath.cpp",
"$_bench/BigPathBench.cpp",
"$_bench/BitmapRegionDecoderBench.cpp",
"$_bench/BlendmodeBench.cpp",

View File

@ -576,7 +576,6 @@ DM_SRCS_ALL = struct(
"tests/*.cpp",
"tests/*.h",
"tools/AutoreleasePool.h",
"tools/BigPathBench.inc",
"tools/BinaryAsset.h",
"tools/CrashHandler.cpp",
"tools/CrashHandler.h",

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,6 @@
#include <cmath>
#include <cstring>
#include <memory>
namespace ToolUtils {
@ -371,17 +370,6 @@ void create_tetra_normal_map(SkBitmap* bm, const SkIRect& dst) {
}
}
#if !defined(__clang__) && defined(_MSC_VER)
// MSVC takes ~2 minutes to compile this function with optimization.
// We don't really care to wait that long for this function.
#pragma optimize("", off)
#endif
SkPath make_big_path() {
SkPathBuilder path;
#include "BigPathBench.inc" // IWYU pragma: keep
return path.detach();
}
bool copy_to(SkBitmap* dst, SkColorType dstColorType, const SkBitmap& src) {
SkPixmap srcPM;
if (!src.peekPixels(&srcPM)) {

View File

@ -149,8 +149,6 @@ void create_frustum_normal_map(SkBitmap* bm, const SkIRect& dst);
void create_tetra_normal_map(SkBitmap* bm, const SkIRect& dst);
SkPath make_big_path();
// A helper object to test the topological sorting code (TopoSortBench.cpp & TopoSortTest.cpp)
class TopoTestNode : public SkRefCnt {
public:

View File

@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "bench/BigPath.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkDeferredDisplayList.h"
#include "include/core/SkGraphics.h"
@ -687,7 +688,7 @@ static sk_sp<SkPicture> create_warmup_skp() {
stroke.setStrokeWidth(2);
// Use a big path to (theoretically) warmup the CPU.
SkPath bigPath = ToolUtils::make_big_path();
SkPath bigPath = BenchUtils::make_big_path();
recording->drawPath(bigPath, stroke);
// Use a perlin shader to warmup the GPU.