Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Unified Diff: gm/convex_all_line_paths.cpp

Issue 1131273002: Fix convex-lineonly-paths GM so it plays nice with SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698