gm: delete boilerplate
Change-Id: I1fdcbadf8ec587637edfca29cd34f845a11ef045 Reviewed-on: https://skia-review.googlesource.com/c/186083 Commit-Queue: Hal Canary <halcanary@google.com> Reviewed-by: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
c7601bf508
commit
607c44fa25
64
gm/aaa.cpp
64
gm/aaa.cpp
@ -12,21 +12,7 @@
|
||||
#define W 800
|
||||
#define H 800
|
||||
|
||||
class AnalyticAntiAliasConvexGM : public skiagm::GM {
|
||||
public:
|
||||
AnalyticAntiAliasConvexGM() {}
|
||||
|
||||
protected:
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("analytic_antialias_convex");
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(W, H);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(analytic_antialias_convex, canvas, W, H) {
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorRED);
|
||||
p.setAntiAlias(true);
|
||||
@ -100,25 +86,7 @@ protected:
|
||||
canvas->drawPath(path, p);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
class AnalyticAntiAliasGeneralGM : public skiagm::GM {
|
||||
public:
|
||||
AnalyticAntiAliasGeneralGM() {}
|
||||
|
||||
protected:
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("analytic_antialias_general");
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(W, H);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(analytic_antialias_general, canvas, W, H) {
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorRED);
|
||||
p.setAntiAlias(true);
|
||||
@ -164,25 +132,7 @@ protected:
|
||||
canvas->drawPath(path, p);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
class AnalyticAntiAliasInverseGM : public skiagm::GM {
|
||||
public:
|
||||
AnalyticAntiAliasInverseGM() {}
|
||||
|
||||
protected:
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("analytic_antialias_inverse");
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(W, H);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(analytic_antialias_inverse, canvas, W, H) {
|
||||
SkPaint p;
|
||||
p.setColor(SK_ColorRED);
|
||||
p.setAntiAlias(true);
|
||||
@ -195,11 +145,3 @@ protected:
|
||||
canvas->drawPath(path, p);
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM( return new AnalyticAntiAliasConvexGM; )
|
||||
DEF_GM( return new AnalyticAntiAliasGeneralGM; )
|
||||
DEF_GM( return new AnalyticAntiAliasInverseGM; )
|
||||
|
@ -124,23 +124,7 @@ static void draw_rect_tests(SkCanvas* canvas) {
|
||||
Each region should show as a blue center surrounded by a 2px green
|
||||
border, with no red.
|
||||
*/
|
||||
|
||||
class AAClipGM : public skiagm::GM {
|
||||
public:
|
||||
AAClipGM() {
|
||||
|
||||
}
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("aaclip");
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(240, 120);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(aaclip, canvas, 240, 120) {
|
||||
// Initial pixel-boundary-aligned draw
|
||||
draw_rect_tests(canvas);
|
||||
|
||||
@ -162,12 +146,6 @@ protected:
|
||||
draw_rect_tests(canvas);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM(return new AAClipGM;)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef SK_BUILD_FOR_MAC
|
||||
@ -210,20 +188,7 @@ static void test_image(SkCanvas* canvas, const SkImageInfo& info) {
|
||||
CGImageRelease(image);
|
||||
}
|
||||
|
||||
class CGImageGM : public skiagm::GM {
|
||||
public:
|
||||
CGImageGM() {}
|
||||
|
||||
protected:
|
||||
SkString onShortName() override {
|
||||
return SkString("cgimage");
|
||||
}
|
||||
|
||||
SkISize onISize() override {
|
||||
return SkISize::Make(800, 250);
|
||||
}
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(cgimage, canvas, 800, 250) {
|
||||
const struct {
|
||||
SkColorType fCT;
|
||||
SkAlphaType fAT;
|
||||
@ -246,10 +211,6 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
//DEF_GM( return new CGImageGM; )
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -115,24 +115,9 @@ static sk_sp<SkShader> make_bg_shader() {
|
||||
&m);
|
||||
}
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
class AARectModesGM : public GM {
|
||||
SkPaint fBGPaint;
|
||||
public:
|
||||
AARectModesGM () {
|
||||
fBGPaint.setShader(make_bg_shader());
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
SkString onShortName() override {
|
||||
return SkString("aarectmodes");
|
||||
}
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(640, 480); }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(aarectmodes, canvas, 640, 480) {
|
||||
SkPaint bgPaint;
|
||||
bgPaint.setShader(make_bg_shader());
|
||||
if (false) { // avoid bit rot, suppress warning
|
||||
test4(canvas);
|
||||
}
|
||||
@ -150,7 +135,7 @@ namespace skiagm {
|
||||
canvas->translate(W * 5, 0);
|
||||
canvas->save();
|
||||
}
|
||||
canvas->drawRect(bounds, fBGPaint);
|
||||
canvas->drawRect(bounds, bgPaint);
|
||||
canvas->saveLayer(&bounds, nullptr);
|
||||
SkScalar dy = drawCell(canvas, gModes[i],
|
||||
gAlphaValue[alpha & 1],
|
||||
@ -164,12 +149,3 @@ namespace skiagm {
|
||||
canvas->translate(W * 5 / 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_GM( return new AARectModesGM; );
|
||||
}
|
||||
|
@ -67,16 +67,7 @@ DEF_GM( return new AddArcGM; )
|
||||
|
||||
#define R 400
|
||||
|
||||
class AddArcMeasGM : public skiagm::GM {
|
||||
public:
|
||||
AddArcMeasGM() {}
|
||||
|
||||
protected:
|
||||
SkString onShortName() override { return SkString("addarc_meas"); }
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(2*R + 40, 2*R + 40); }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(addarc_meas, canvas, 2*R + 40, 2*R + 40) {
|
||||
canvas->translate(R + 20, R + 20);
|
||||
|
||||
SkPaint paint;
|
||||
@ -108,11 +99,6 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new AddArcMeasGM; )
|
||||
|
||||
///////////////////////////////////////////////////
|
||||
|
||||
// Emphasize drawing a stroked oval (containing conics) and then scaling the results up,
|
||||
@ -230,16 +216,7 @@ static void html_canvas_arc(SkPath* path, SkScalar x, SkScalar y, SkScalar r, Sk
|
||||
}
|
||||
|
||||
// Lifted from canvas-arc-circumference-fill-diffs.html
|
||||
class ManyArcsGM : public skiagm::GM {
|
||||
public:
|
||||
ManyArcsGM() {}
|
||||
|
||||
protected:
|
||||
SkString onShortName() override { return SkString("manyarcs"); }
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(620, 330); }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(manyarcs, canvas, 620, 330) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
@ -283,22 +260,8 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new ManyArcsGM; )
|
||||
|
||||
// Lifted from https://bugs.chromium.org/p/chromium/issues/detail?id=640031
|
||||
class TinyAngleBigRadiusArcsGM : public skiagm::GM {
|
||||
public:
|
||||
TinyAngleBigRadiusArcsGM() {}
|
||||
|
||||
protected:
|
||||
SkString onShortName() override { return SkString("tinyanglearcs"); }
|
||||
|
||||
SkISize onISize() override { return SkISize::Make(620, 330); }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
DEF_SIMPLE_GM(tinyanglearcs, canvas, 620, 330) {
|
||||
SkPaint paint;
|
||||
paint.setAntiAlias(true);
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
@ -332,8 +295,3 @@ protected:
|
||||
canvas->translate(20, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
DEF_GM( return new TinyAngleBigRadiusArcsGM; )
|
||||
|
Loading…
Reference in New Issue
Block a user