Index: gm/convex_all_line_paths.cpp |
diff --git a/gm/convex_all_line_paths.cpp b/gm/convex_all_line_paths.cpp |
index 0ffd65497cbf08ff910724f0917d0c09d50bd132..81b98b88f8d07e82cf5bcf4886490015cc6c6ab5 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; |
}; |