c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
67 lines
1.7 KiB
C++
67 lines
1.7 KiB
C++
/*
|
|
* Copyright 2012 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "bench/Benchmark.h"
|
|
#include "include/core/SkBitmap.h"
|
|
#include "include/core/SkCanvas.h"
|
|
#include "include/core/SkColorPriv.h"
|
|
#include "include/core/SkPaint.h"
|
|
#include "include/core/SkShader.h"
|
|
#include "include/core/SkString.h"
|
|
#include "include/private/SkTArray.h"
|
|
#include "include/utils/SkRandom.h"
|
|
|
|
|
|
class LineBench : public Benchmark {
|
|
SkScalar fStrokeWidth;
|
|
bool fDoAA;
|
|
SkString fName;
|
|
enum {
|
|
PTS = 500,
|
|
};
|
|
SkPoint fPts[PTS];
|
|
|
|
public:
|
|
LineBench(SkScalar width, bool doAA) {
|
|
fStrokeWidth = width;
|
|
fDoAA = doAA;
|
|
fName.printf("lines_%g_%s", width, doAA ? "AA" : "BW");
|
|
|
|
SkRandom rand;
|
|
for (int i = 0; i < PTS; ++i) {
|
|
fPts[i].set(rand.nextUScalar1() * 640, rand.nextUScalar1() * 480);
|
|
}
|
|
}
|
|
|
|
protected:
|
|
const char* onGetName() override {
|
|
return fName.c_str();
|
|
}
|
|
|
|
void onDraw(int loops, SkCanvas* canvas) override {
|
|
SkPaint paint;
|
|
this->setupPaint(&paint);
|
|
|
|
paint.setStyle(SkPaint::kStroke_Style);
|
|
paint.setAntiAlias(fDoAA);
|
|
paint.setStrokeWidth(fStrokeWidth);
|
|
|
|
for (int i = 0; i < loops; i++) {
|
|
canvas->drawPoints(SkCanvas::kLines_PointMode, PTS, fPts, paint);
|
|
}
|
|
}
|
|
|
|
private:
|
|
typedef Benchmark INHERITED;
|
|
};
|
|
|
|
DEF_BENCH(return new LineBench(0, false);)
|
|
DEF_BENCH(return new LineBench(SK_Scalar1, false);)
|
|
DEF_BENCH(return new LineBench(0, true);)
|
|
DEF_BENCH(return new LineBench(SK_Scalar1/2, true);)
|
|
DEF_BENCH(return new LineBench(SK_Scalar1, true);)
|