OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkPathPriv.h" | 9 #include "SkPathPriv.h" |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 angle += angleStep; | 21 angle += angleStep; |
22 } | 22 } |
23 } | 23 } |
24 | 24 |
25 namespace skiagm { | 25 namespace skiagm { |
26 | 26 |
27 // This GM is intended to exercise Ganesh's handling of convex line-only | 27 // This GM is intended to exercise Ganesh's handling of convex line-only |
28 // paths | 28 // paths |
29 class ConvexLineOnlyPathsGM : public GM { | 29 class ConvexLineOnlyPathsGM : public GM { |
30 public: | 30 public: |
31 ConvexLineOnlyPathsGM() { | 31 ConvexLineOnlyPathsGM() { |
32 this->setBGColor(0xFFFFFFFF); | 32 this->setBGColor(0xFFFFFFFF); |
33 } | 33 } |
34 | 34 |
35 protected: | 35 protected: |
36 SkString onShortName() override { return SkString("convex-lineonly-paths");
} | 36 SkString onShortName() override { return SkString("convex-lineonly-paths");
} |
37 SkISize onISize() override { return SkISize::Make(kGMWidth, kGMHeight); } | 37 SkISize onISize() override { return SkISize::Make(kGMWidth, kGMHeight); } |
38 bool runAsBench() const override { return true; } | 38 bool runAsBench() const override { return true; } |
39 | 39 |
40 static SkPath GetPath(int index, int offset, SkPath::Direction dir) { | 40 static SkPath GetPath(int index, int offset, SkPath::Direction dir) { |
41 // narrow rect | 41 // narrow rect |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 canvas->translate(center.fX, center.fY); | 277 canvas->translate(center.fX, center.fY); |
278 canvas->scale(scales[i], scales[i]); | 278 canvas->scale(scales[i], scales[i]); |
279 paint.setColor(colors[i%2]); | 279 paint.setColor(colors[i%2]); |
280 canvas->drawPath(path, paint); | 280 canvas->drawPath(path, paint); |
281 canvas->restore(); | 281 canvas->restore(); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void onDraw(SkCanvas* canvas) override { | 285 void onDraw(SkCanvas* canvas) override { |
286 // the right edge of the last drawn path | 286 // the right edge of the last drawn path |
287 SkPoint offset = { 0, SkScalarHalf(kMaxPathHeight) }; | 287 SkPoint offset = { 0, SkScalarHalf(kMaxPathHeight) }; |
288 | 288 |
289 for (int i = 0; i < kNumPaths; ++i) { | 289 for (int i = 0; i < kNumPaths; ++i) { |
290 this->drawPath(canvas, i, &offset); | 290 this->drawPath(canvas, i, &offset); |
291 } | 291 } |
292 | 292 |
293 // Repro for crbug.com/472723 (Missing AA on portions of graphic with GP
U rasterization) | 293 // Repro for crbug.com/472723 (Missing AA on portions of graphic with GP
U rasterization) |
294 { | 294 { |
295 canvas->translate(356.0f, 50.0f); | 295 canvas->translate(356.0f, 50.0f); |
296 | 296 |
297 SkPaint p; | 297 SkPaint p; |
(...skipping 14 matching lines...) Expand all Loading... |
312 static const int kGMWidth = 512; | 312 static const int kGMWidth = 512; |
313 static const int kGMHeight = 512; | 313 static const int kGMHeight = 512; |
314 | 314 |
315 typedef GM INHERITED; | 315 typedef GM INHERITED; |
316 }; | 316 }; |
317 | 317 |
318 ////////////////////////////////////////////////////////////////////////////// | 318 ////////////////////////////////////////////////////////////////////////////// |
319 | 319 |
320 DEF_GM(return new ConvexLineOnlyPathsGM;) | 320 DEF_GM(return new ConvexLineOnlyPathsGM;) |
321 } | 321 } |
OLD | NEW |