gm: virtual->override
Change-Id: I7782f1d08a03c725bed76078adfb9b84aad34a5f Reviewed-on: https://skia-review.googlesource.com/c/skia/+/228347 Reviewed-by: Ben Wagner <bungeman@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
This commit is contained in:
parent
3e6aa9f528
commit
bd865e2703
@ -81,18 +81,11 @@ static void show_k_text(SkCanvas* canvas, SkScalar x, SkScalar y, const SkScalar
|
||||
}
|
||||
|
||||
class ArithmodeGM : public skiagm::GM {
|
||||
public:
|
||||
ArithmodeGM () {}
|
||||
SkString onShortName() override { return SkString("arithmode"); }
|
||||
|
||||
protected:
|
||||
SkISize onISize() override { return {640, 572}; }
|
||||
|
||||
virtual SkString onShortName() {
|
||||
return SkString("arithmode");
|
||||
}
|
||||
|
||||
virtual SkISize onISize() { return SkISize::Make(640, 572); }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
sk_sp<SkImage> src = make_src();
|
||||
sk_sp<SkImage> dst = make_dst();
|
||||
sk_sp<SkImageFilter> srcFilter = SkImageSource::Make(src);
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace skiagm {
|
||||
namespace {
|
||||
|
||||
static const char* color_type_name(SkColorType colorType) {
|
||||
switch (colorType) {
|
||||
@ -67,24 +67,16 @@ static void draw_checks(SkCanvas* canvas, int width, int height) {
|
||||
SkIntToScalar(height) }, paint);
|
||||
}
|
||||
|
||||
class BitmapCopyGM : public GM {
|
||||
public:
|
||||
class BitmapCopyGM : public skiagm::GM {
|
||||
SkBitmap fDst[NUM_CONFIGS];
|
||||
|
||||
BitmapCopyGM() {
|
||||
this->setBGColor(0xFFDDDDDD);
|
||||
}
|
||||
void onOnceBeforeDraw() override { this->setBGColor(0xFFDDDDDD); }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("bitmapcopy");
|
||||
}
|
||||
SkString onShortName() override { return SkString("bitmapcopy"); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(540, 330);
|
||||
}
|
||||
SkISize onISize() override { return {540, 330}; }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
SkScalar horizMargin = 10;
|
||||
SkScalar vertMargin = 10;
|
||||
@ -138,12 +130,9 @@ protected:
|
||||
canvas->translate(horizOffset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_GM( return new BitmapCopyGM; )
|
||||
}
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "include/core/SkTileMode.h"
|
||||
#include "include/core/SkTypes.h"
|
||||
|
||||
namespace skiagm {
|
||||
namespace {
|
||||
|
||||
// This GM draws a 3x3 grid (with the center element excluded) of rectangles
|
||||
// filled with a bitmap shader. The bitmap shader is transformed so that the
|
||||
@ -49,7 +49,7 @@ static SkBitmap create_bitmap() {
|
||||
constexpr SkScalar RECT_SIZE = 64;
|
||||
constexpr SkScalar SLIDE_SIZE = 300;
|
||||
|
||||
class ClippedBitmapShadersGM : public GM {
|
||||
class ClippedBitmapShadersGM : public skiagm::GM {
|
||||
public:
|
||||
ClippedBitmapShadersGM(SkTileMode mode, bool hq=false)
|
||||
: fMode(mode), fHQ(hq) {
|
||||
@ -59,7 +59,7 @@ protected:
|
||||
SkTileMode fMode;
|
||||
bool fHQ;
|
||||
|
||||
virtual SkString onShortName() {
|
||||
SkString onShortName() override {
|
||||
SkString descriptor;
|
||||
switch (fMode) {
|
||||
case SkTileMode::kRepeat:
|
||||
@ -82,11 +82,9 @@ protected:
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(300, 300);
|
||||
}
|
||||
SkISize onISize() override { return {300, 300}; }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkBitmap bmp = create_bitmap();
|
||||
SkMatrix s;
|
||||
s.reset();
|
||||
@ -120,8 +118,7 @@ protected:
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kRepeat); )
|
||||
DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kMirror); )
|
||||
@ -130,6 +127,3 @@ DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kClamp); )
|
||||
DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kRepeat, true); )
|
||||
DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kMirror, true); )
|
||||
DEF_GM( return new ClippedBitmapShadersGM(SkTileMode::kClamp, true); )
|
||||
|
||||
|
||||
}
|
||||
|
@ -32,11 +32,11 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
namespace skiagm {
|
||||
namespace {
|
||||
|
||||
static uint16_t gData[] = { 0xFFFF, 0xCCCF, 0xCCCF, 0xFFFF };
|
||||
|
||||
class ColorEmojiBlendModesGM : public GM {
|
||||
class ColorEmojiBlendModesGM : public skiagm::GM {
|
||||
public:
|
||||
const static int W = 64;
|
||||
const static int H = 64;
|
||||
@ -65,15 +65,15 @@ protected:
|
||||
kOpaque_SkAlphaType), gData, 4);
|
||||
}
|
||||
|
||||
virtual SkString onShortName() override {
|
||||
SkString onShortName() override {
|
||||
return SkString("coloremoji_blendmodes");
|
||||
}
|
||||
|
||||
virtual SkISize onISize() override {
|
||||
return SkISize::Make(400, 640);
|
||||
SkISize onISize() override {
|
||||
return {400, 640};
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) override {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->translate(SkIntToScalar(10), SkIntToScalar(20));
|
||||
|
||||
const SkBlendMode gModes[] = {
|
||||
@ -169,9 +169,6 @@ private:
|
||||
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new ColorEmojiBlendModesGM; )
|
||||
|
||||
}
|
||||
|
@ -45,24 +45,14 @@ static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) {
|
||||
}
|
||||
|
||||
class ColorFiltersGM : public skiagm::GM {
|
||||
public:
|
||||
ColorFiltersGM() {
|
||||
fName.set("lightingcolorfilter");
|
||||
}
|
||||
SkString onShortName() override { return SkString("lightingcolorfilter"); }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() override {
|
||||
return fName;
|
||||
}
|
||||
|
||||
virtual SkISize onISize() override {
|
||||
return SkISize::Make(620, 430);
|
||||
}
|
||||
SkISize onISize() override { return {620, 430}; }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkRect r = {0, 0, 600, 50};
|
||||
|
||||
SkPaint paint;
|
||||
SkRect r;
|
||||
r.setWH(600, 50);
|
||||
paint.setShader(make_shader(r));
|
||||
|
||||
const struct {
|
||||
@ -85,13 +75,6 @@ protected:
|
||||
canvas->translate(0, r.height() + 10);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SkString fName;
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_GM(return new ColorFiltersGM;)
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "include/private/SkTArray.h"
|
||||
#include "include/utils/SkRandom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class SkDoOnce : SkNoncopyable {
|
||||
public:
|
||||
SkDoOnce() { fDidOnce = false; }
|
||||
@ -35,25 +37,15 @@ private:
|
||||
bool fDidOnce;
|
||||
};
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
class ConvexPathsGM : public GM {
|
||||
class ConvexPathsGM : public skiagm::GM {
|
||||
SkDoOnce fOnce;
|
||||
public:
|
||||
ConvexPathsGM() {
|
||||
this->setBGColor(0xFF000000);
|
||||
}
|
||||
|
||||
protected:
|
||||
void onOnceBeforeDraw() override { this->setBGColor(0xFF000000); }
|
||||
|
||||
virtual SkString onShortName() {
|
||||
return SkString("convexpaths");
|
||||
}
|
||||
SkString onShortName() override { return SkString("convexpaths"); }
|
||||
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(1200, 1100);
|
||||
}
|
||||
SkISize onISize() override { return {1200, 1100}; }
|
||||
|
||||
void makePaths() {
|
||||
if (fOnce.alreadyDone()) {
|
||||
@ -278,7 +270,7 @@ protected:
|
||||
fPaths.push_back().addCircle(0, 0, 1.2f);
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
this->makePaths();
|
||||
|
||||
SkPaint paint;
|
||||
@ -306,13 +298,8 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
SkTArray<SkPath> fPaths;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new ConvexPathsGM; )
|
||||
|
||||
}
|
||||
|
@ -18,25 +18,16 @@
|
||||
#include "tools/Resources.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
namespace {
|
||||
/**
|
||||
* Test copying an image from 8888 to 4444.
|
||||
*/
|
||||
class CopyTo4444GM : public GM {
|
||||
public:
|
||||
CopyTo4444GM() {}
|
||||
class CopyTo4444GM : public skiagm::GM {
|
||||
SkString onShortName() override { return SkString("copyTo4444"); }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("copyTo4444");
|
||||
}
|
||||
SkISize onISize() override { return {360, 180}; }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(360, 180);
|
||||
}
|
||||
|
||||
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) {
|
||||
DrawResult onDraw(SkCanvas* canvas, SkString* errorMsg) override {
|
||||
SkBitmap bm, bm4444;
|
||||
if (!GetResourceAsBitmap("images/dog.jpg", &bm)) {
|
||||
*errorMsg = "Could not decode the file. Did you forget to set the resourcePath?";
|
||||
@ -49,16 +40,12 @@ protected:
|
||||
canvas->drawBitmap(bm4444, SkIntToScalar(bm.width()), 0);
|
||||
return DrawResult::kOk;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new CopyTo4444GM; )
|
||||
|
||||
}
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DEF_SIMPLE_GM(format4444, canvas, 64, 64) {
|
||||
canvas->scale(16, 16);
|
||||
|
@ -23,6 +23,8 @@
|
||||
#include "include/effects/SkGradientShader.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// test shader w/ transparency
|
||||
static sk_sp<SkShader> make_grad(SkScalar width) {
|
||||
SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
|
||||
@ -45,17 +47,13 @@ static sk_sp<SkShader> make_chrome_solid() {
|
||||
return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkTileMode::kClamp);
|
||||
}
|
||||
|
||||
namespace skiagm {
|
||||
|
||||
// Replicate chrome layout test - clipped pathed gradient-shaded text
|
||||
class ChromeGradTextGM1 : public GM {
|
||||
public:
|
||||
ChromeGradTextGM1() { }
|
||||
protected:
|
||||
class ChromeGradTextGM1 : public skiagm::GM {
|
||||
SkString onShortName() override { return SkString("chrome_gradtext1"); }
|
||||
|
||||
virtual SkString onShortName() { return SkString("chrome_gradtext1"); }
|
||||
virtual SkISize onISize() { return SkISize::Make(500, 480); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
SkISize onISize() override { return {500, 480}; }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
SkRect r = SkRect::MakeWH(SkIntToScalar(100), SkIntToScalar(100));
|
||||
|
||||
@ -72,20 +70,15 @@ protected:
|
||||
|
||||
canvas->drawString("I", 0, 100, font, paint);
|
||||
}
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
|
||||
// Replicate chrome layout test - switching between solid & gradient text
|
||||
class ChromeGradTextGM2 : public GM {
|
||||
public:
|
||||
ChromeGradTextGM2() { }
|
||||
protected:
|
||||
class ChromeGradTextGM2 : public skiagm::GM {
|
||||
SkString onShortName() override { return SkString("chrome_gradtext2"); }
|
||||
|
||||
virtual SkString onShortName() { return SkString("chrome_gradtext2"); }
|
||||
virtual SkISize onISize() { return SkISize::Make(500, 480); }
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
SkISize onISize() override { return {500, 480}; }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkPaint paint;
|
||||
SkFont font(ToolUtils::create_portable_typeface());
|
||||
font.setEdging(SkFont::Edging::kAlias);
|
||||
@ -103,15 +96,11 @@ protected:
|
||||
paint.setStyle(SkPaint::kStroke_Style);
|
||||
canvas->drawString("Gradient Stroke Text", 0, 200, font, paint);
|
||||
}
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new ChromeGradTextGM1; )
|
||||
DEF_GM( return new ChromeGradTextGM2; )
|
||||
}
|
||||
|
||||
DEF_SIMPLE_GM(gradtext, canvas, 500, 480) {
|
||||
static constexpr float kTextSize = 26.0f;
|
||||
|
@ -21,29 +21,21 @@
|
||||
#include "include/core/SkTypeface.h"
|
||||
#include "tools/ToolUtils.h"
|
||||
|
||||
namespace skiagm {
|
||||
namespace {
|
||||
|
||||
/** Draws two rectangles. In output formats that support internal links (PDF),
|
||||
* clicking the one labeled "Link to A" should take you to the one labeled
|
||||
* "Target A". Note that you'll need to zoom your PDF viewer in a fair bit in
|
||||
* order for the scrolling to not be blocked by the edge of the document.
|
||||
*/
|
||||
class InternalLinksGM : public GM {
|
||||
public:
|
||||
InternalLinksGM() {
|
||||
this->setBGColor(0xFFDDDDDD);
|
||||
}
|
||||
class InternalLinksGM : public skiagm::GM {
|
||||
void onOnceBeforeDraw() override { this->setBGColor(0xFFDDDDDD); }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("internal_links");
|
||||
}
|
||||
SkString onShortName() override { return SkString("internal_links"); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(700, 500);
|
||||
}
|
||||
SkISize onISize() override { return {700, 500}; }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
sk_sp<SkData> name(SkData::MakeWithCString("target-a"));
|
||||
|
||||
canvas->save();
|
||||
@ -61,7 +53,6 @@ protected:
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
private:
|
||||
/** Draw an arbitrary rectangle at a given location and label it with some
|
||||
* text. */
|
||||
void drawLabeledRect(SkCanvas* canvas, const char* text, SkScalar x, SkScalar y) {
|
||||
@ -75,12 +66,7 @@ private:
|
||||
paint.setColor(SK_ColorBLACK);
|
||||
canvas->drawString(text, x, y, font, paint);
|
||||
}
|
||||
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new InternalLinksGM; )
|
||||
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
#include "src/core/SkBlurMask.h"
|
||||
#include "src/core/SkClipOpPriv.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// This GM tests 3 different ways of drawing four shadows around a square:
|
||||
// just using 4 blurred rects
|
||||
// using 4 1-level draw loopers
|
||||
@ -40,8 +42,8 @@ public:
|
||||
|
||||
MegaLooperGM(Type type) : fType(type) {}
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
private:
|
||||
SkString onShortName() override {
|
||||
switch (fType) {
|
||||
case k0x0_Type:
|
||||
return SkString("megalooper_0x0");
|
||||
@ -56,11 +58,11 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(kWidth, kHeight);
|
||||
SkISize onISize() override {
|
||||
return {kWidth, kHeight};
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
for (int y = 100; y < kHeight; y += 200) {
|
||||
for (int x = 100; x < kWidth; x += 200) {
|
||||
switch (fType) {
|
||||
@ -79,7 +81,6 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static constexpr int kWidth = 800;
|
||||
static constexpr int kHeight = 800;
|
||||
static constexpr int kHalfOuterClipSize = 100;
|
||||
@ -237,8 +238,6 @@ private:
|
||||
|
||||
return looperBuilder.detach();
|
||||
}
|
||||
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
const SkPoint MegaLooperGM::gBlurOffsets[4] = {
|
||||
@ -251,6 +250,7 @@ const SkPoint MegaLooperGM::gBlurOffsets[4] = {
|
||||
const SkColor MegaLooperGM::gColors[4] = {
|
||||
SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED
|
||||
};
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); )
|
||||
DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); )
|
||||
|
@ -30,17 +30,9 @@ static inline void set_bitmap(SkBitmap* bitmap, uint8_t alpha) {
|
||||
}
|
||||
|
||||
class OverdrawColorFilter : public skiagm::GM {
|
||||
public:
|
||||
OverdrawColorFilter() {}
|
||||
SkString onShortName() override { return SkString("overdrawcolorfilter"); }
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() override {
|
||||
return SkString("overdrawcolorfilter");
|
||||
}
|
||||
|
||||
virtual SkISize onISize() override {
|
||||
return SkISize::Make(200, 400);
|
||||
}
|
||||
SkISize onISize() override { return {200, 400}; }
|
||||
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
static const SkPMColor colors[SkOverdrawColorFilter::kNumColors] = {
|
||||
@ -69,9 +61,6 @@ protected:
|
||||
set_bitmap(&bitmap, 6);
|
||||
canvas->drawBitmap(bitmap, 100, 200, &paint);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
DEF_GM(return new OverdrawColorFilter;)
|
||||
|
@ -27,23 +27,14 @@ enum class Type {
|
||||
kTurbulence,
|
||||
};
|
||||
|
||||
} // anonymous ns
|
||||
|
||||
class PerlinNoiseGM : public skiagm::GM {
|
||||
public:
|
||||
PerlinNoiseGM() {
|
||||
this->setBGColor(0xFF000000);
|
||||
fSize = SkISize::Make(80, 80);
|
||||
}
|
||||
SkISize fSize = {80, 80};
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("perlinnoise");
|
||||
}
|
||||
void onOnceBeforeDraw() override { this->setBGColor(0xFF000000); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(200, 500);
|
||||
}
|
||||
SkString onShortName() override { return SkString("perlinnoise"); }
|
||||
|
||||
SkISize onISize() override { return {200, 500}; }
|
||||
|
||||
void drawRect(SkCanvas* canvas, int x, int y, const SkPaint& paint, const SkISize& size) {
|
||||
canvas->save();
|
||||
@ -78,7 +69,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->clear(SK_ColorBLACK);
|
||||
test(canvas, 0, 0, Type::kFractalNoise,
|
||||
0.1f, 0.1f, 0, 0, false);
|
||||
@ -110,23 +101,14 @@ protected:
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
SkISize fSize;
|
||||
};
|
||||
|
||||
class PerlinNoiseGM2 : public skiagm::GM {
|
||||
public:
|
||||
PerlinNoiseGM2() {
|
||||
fSize = SkISize::Make(80, 80);
|
||||
}
|
||||
SkISize fSize = {80, 80};
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("perlinnoise_localmatrix");
|
||||
}
|
||||
SkString onShortName() override { return SkString("perlinnoise_localmatrix"); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(640, 480);
|
||||
}
|
||||
SkISize onISize() override { return {640, 480}; }
|
||||
|
||||
void install(SkPaint* paint, Type type,
|
||||
float baseFrequencyX, float baseFrequencyY, int numOctaves, float seed,
|
||||
@ -139,7 +121,7 @@ protected:
|
||||
paint->setShader(std::move(shader));
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->translate(10, 10);
|
||||
|
||||
SkPaint paint;
|
||||
@ -189,13 +171,9 @@ protected:
|
||||
canvas->drawRect(r, paint);
|
||||
canvas->restore();
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
SkISize fSize;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
} // namespace
|
||||
|
||||
DEF_GM( return new PerlinNoiseGM; )
|
||||
DEF_GM( return new PerlinNoiseGM2; )
|
||||
|
@ -71,19 +71,12 @@ static void draw_text(SkCanvas* canvas, const SkPaint& paint, const SkFont& font
|
||||
|
||||
class SrcModeGM : public skiagm::GM {
|
||||
SkPath fPath;
|
||||
public:
|
||||
SrcModeGM() {
|
||||
this->setBGColor(SK_ColorBLACK);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return SkString("srcmode");
|
||||
}
|
||||
void onOnceBeforeDraw() override { this->setBGColor(SK_ColorBLACK); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(640, 760);
|
||||
}
|
||||
SkString onShortName() override { return SkString("srcmode"); }
|
||||
|
||||
SkISize onISize() override { return {640, 760}; }
|
||||
|
||||
void drawContent(SkCanvas* canvas) {
|
||||
canvas->translate(SkIntToScalar(20), SkIntToScalar(20));
|
||||
@ -141,15 +134,12 @@ protected:
|
||||
return surface;
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
auto surf(compat_surface(canvas, this->getISize(), this->isCanvasDeferred()));
|
||||
surf->getCanvas()->drawColor(SK_ColorWHITE);
|
||||
this->drawContent(surf->getCanvas());
|
||||
surf->draw(canvas, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
private:
|
||||
typedef skiagm::GM INHERITED;
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -119,15 +119,15 @@ public:
|
||||
TableColorFilterGM() {}
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
SkString onShortName() override {
|
||||
return SkString("tablecolorfilter");
|
||||
}
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(700, 1650);
|
||||
SkISize onISize() override {
|
||||
return {700, 1650};
|
||||
}
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
canvas->drawColor(0xFFDDDDDD);
|
||||
canvas->translate(20, 20);
|
||||
|
||||
@ -218,26 +218,18 @@ class ComposeColorFilterGM : public skiagm::GM {
|
||||
};
|
||||
const SkColor* fColors;
|
||||
const SkBlendMode* fModes;
|
||||
SkString fName;
|
||||
const char* fName;
|
||||
|
||||
public:
|
||||
ComposeColorFilterGM(const SkColor colors[], const SkBlendMode modes[],
|
||||
const char suffix[])
|
||||
: fColors(colors), fModes(modes)
|
||||
{
|
||||
fName.printf("colorcomposefilter_%s", suffix);
|
||||
}
|
||||
ComposeColorFilterGM(const SkColor colors[], const SkBlendMode modes[], const char* name)
|
||||
: fColors(colors), fModes(modes), fName(name) {}
|
||||
|
||||
protected:
|
||||
virtual SkString onShortName() {
|
||||
return fName;
|
||||
}
|
||||
private:
|
||||
SkString onShortName() override { return SkString(fName); }
|
||||
|
||||
virtual SkISize onISize() {
|
||||
return SkISize::Make(790, 790);
|
||||
}
|
||||
SkISize onISize() override { return {790, 790}; }
|
||||
|
||||
virtual void onDraw(SkCanvas* canvas) {
|
||||
void onDraw(SkCanvas* canvas) override {
|
||||
SkBitmap bm;
|
||||
make_bm1(&bm);
|
||||
|
||||
@ -288,9 +280,6 @@ protected:
|
||||
canvas->translate(0, r.height() + spacer);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
typedef GM INHERITED;
|
||||
};
|
||||
|
||||
const SkColor gColors0[] = { SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW };
|
||||
@ -300,7 +289,7 @@ const SkBlendMode gModes0[] = {
|
||||
SkBlendMode::kColorBurn,
|
||||
SkBlendMode::kExclusion,
|
||||
};
|
||||
DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); )
|
||||
DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "colorcomposefilter_wacky"); )
|
||||
|
||||
const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF };
|
||||
const SkBlendMode gModes1[] = {
|
||||
@ -309,4 +298,4 @@ const SkBlendMode gModes1[] = {
|
||||
SkBlendMode::kDstOut,
|
||||
SkBlendMode::kSrcATop,
|
||||
};
|
||||
DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); )
|
||||
DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "colorcomposefilter_alpha"); )
|
||||
|
Loading…
Reference in New Issue
Block a user