aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/convex_all_line_paths.cpp
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2015-05-08 07:08:13 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-08 07:08:13 -0700
commit2a974625c559fcb2640b587fed6f92d5b58cab24 (patch)
tree403103134208085d7eef4bd9a3a0178e33676e34 /gm/convex_all_line_paths.cpp
parente16dfdbeadcb659e2ff4c56669fc08ee69e3f18f (diff)
Fix convex-lineonly-paths GM so it plays nice with SampleApp
Diffstat (limited to 'gm/convex_all_line_paths.cpp')
-rw-r--r--gm/convex_all_line_paths.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp
index 0ffd65497c..81b98b88f8 100644
--- a/gm/convex_all_line_paths.cpp
+++ b/gm/convex_all_line_paths.cpp
@@ -28,7 +28,6 @@ namespace skiagm {
class ConvexLineOnlyPathsGM : public GM {
public:
ConvexLineOnlyPathsGM() {
- fOffset.set(0, SkScalarHalf(kMaxPathHeight));
this->setBGColor(0xFFFFFFFF);
}
@@ -250,17 +249,17 @@ protected:
// Draw a single path several times, shrinking it, flipping its direction
// and changing its start vertex each time.
- void drawPath(SkCanvas* canvas, int index) {
+ void drawPath(SkCanvas* canvas, int index, SkPoint* offset) {
SkPoint center;
{
SkPath path = GetPath(index, 0, SkPath::kCW_Direction);
- if (fOffset.fX+path.getBounds().width() > kGMWidth) {
- fOffset.fX = 0;
- fOffset.fY += kMaxPathHeight;
+ if (offset->fX+path.getBounds().width() > kGMWidth) {
+ offset->fX = 0;
+ offset->fY += kMaxPathHeight;
}
- center = { fOffset.fX + SkScalarHalf(path.getBounds().width()), fOffset.fY};
- fOffset.fX += path.getBounds().width();
+ center = { offset->fX + SkScalarHalf(path.getBounds().width()), offset->fY};
+ offset->fX += path.getBounds().width();
}
const SkColor colors[2] = { SK_ColorBLACK, SK_ColorWHITE };
@@ -283,8 +282,11 @@ protected:
}
void onDraw(SkCanvas* canvas) override {
+ // the right edge of the last drawn path
+ SkPoint offset = { 0, SkScalarHalf(kMaxPathHeight) };
+
for (int i = 0; i < kNumPaths; ++i) {
- this->drawPath(canvas, i);
+ this->drawPath(canvas, i, &offset);
}
// Repro for crbug.com/472723 (Missing AA on portions of graphic with GPU rasterization)
@@ -309,8 +311,6 @@ private:
static const int kGMWidth = 512;
static const int kGMHeight = 512;
- SkPoint fOffset; // the right edge of the last drawn path
-
typedef GM INHERITED;
};