diff options
author | liyuqian <liyuqian@google.com> | 2016-10-03 13:49:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-03 13:49:37 -0700 |
commit | e60d85597f803c4dff6329840215af1d1d9a8fdc (patch) | |
tree | f82916ea6f7f539cd4af0e8bda723d82ce58d4ab /gm/aaa.cpp | |
parent | f85d2a4fa1b71e6ee28518431e2a34df5683bc81 (diff) |
Add GMs for Analytic Anti-Aliasing
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2386293002
Review-Url: https://codereview.chromium.org/2386293002
Diffstat (limited to 'gm/aaa.cpp')
-rw-r--r-- | gm/aaa.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gm/aaa.cpp b/gm/aaa.cpp new file mode 100644 index 0000000000..d49d3f06c3 --- /dev/null +++ b/gm/aaa.cpp @@ -0,0 +1,59 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#include "gm.h" +#include "SkPath.h" +#include "SkScan.h" + +#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 { + SkPaint p; + p.setColor(SK_ColorRED); + p.setAntiAlias(true); + + canvas->clear(0xFFFFFFFF); + + canvas->save(); + + SkScalar y = 0; + + canvas->translate(0, y); + canvas->rotate(1); + canvas->drawRectCoords(20, 20, 200, 200, p); + canvas->restore(); + + y += 200; + + canvas->translate(0, y); + canvas->rotate(1); + canvas->drawRectCoords(20, 20, 20.2f, 200, p); + canvas->drawRectCoords(20, 200, 200, 200.1f, p); + canvas->drawCircle(100, 100, 30, p); + canvas->restore(); + } + +private: + typedef skiagm::GM INHERITED; +}; + +DEF_GM( return new AnalyticAntiAliasConvexGM; ) |