| 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 center = { offset->fX + SkScalarHalf(path.getBounds().width()), offs
et->fY}; | 271 center = { offset->fX + SkScalarHalf(path.getBounds().width()), offs
et->fY}; |
| 272 offset->fX += path.getBounds().width(); | 272 offset->fX += path.getBounds().width(); |
| 273 if (fDoStrokeAndFill) { | 273 if (fDoStrokeAndFill) { |
| 274 offset->fX += kStrokeWidth; | 274 offset->fX += kStrokeWidth; |
| 275 } | 275 } |
| 276 } | 276 } |
| 277 | 277 |
| 278 const SkColor colors[2] = { SK_ColorBLACK, SK_ColorWHITE }; | 278 const SkColor colors[2] = { SK_ColorBLACK, SK_ColorWHITE }; |
| 279 const SkPath::Direction dirs[2] = { SkPath::kCW_Direction, SkPath::kCCW_
Direction }; | 279 const SkPath::Direction dirs[2] = { SkPath::kCW_Direction, SkPath::kCCW_
Direction }; |
| 280 const float scales[] = { 1.0f, 0.75f, 0.5f, 0.25f, 0.1f, 0.01f, 0.001f }
; | 280 const float scales[] = { 1.0f, 0.75f, 0.5f, 0.25f, 0.1f, 0.01f, 0.001f }
; |
| 281 const SkPaint::Join joins[3] = { SkPaint::kRound_Join, | 281 const SkPaint::Join joins[3] = { SkPaint::kRound_Join, |
| 282 SkPaint::kBevel_Join, | 282 SkPaint::kBevel_Join, |
| 283 SkPaint::kMiter_Join }; | 283 SkPaint::kMiter_Join }; |
| 284 | 284 |
| 285 SkPaint paint; | 285 SkPaint paint; |
| 286 paint.setAntiAlias(true); | 286 paint.setAntiAlias(true); |
| 287 | 287 |
| 288 for (size_t i = 0; i < SK_ARRAY_COUNT(scales); ++i) { | 288 for (size_t i = 0; i < SK_ARRAY_COUNT(scales); ++i) { |
| 289 SkPath path = GetPath(index, (int) i, dirs[i%2]); | 289 SkPath path = GetPath(index, (int) i, dirs[i%2]); |
| 290 if (fDoStrokeAndFill) { | 290 if (fDoStrokeAndFill) { |
| 291 paint.setStyle(SkPaint::kStrokeAndFill_Style); | 291 paint.setStyle(SkPaint::kStrokeAndFill_Style); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 SkPath p1; | 329 SkPath p1; |
| 330 p1.moveTo(60.8522949f, 364.671021f); | 330 p1.moveTo(60.8522949f, 364.671021f); |
| 331 p1.lineTo(59.4380493f, 364.671021f); | 331 p1.lineTo(59.4380493f, 364.671021f); |
| 332 p1.lineTo(385.414276f, 690.647217f); | 332 p1.lineTo(385.414276f, 690.647217f); |
| 333 p1.lineTo(386.121399f, 689.940125f); | 333 p1.lineTo(386.121399f, 689.940125f); |
| 334 canvas->drawPath(p1, p); | 334 canvas->drawPath(p1, p); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 private: | 338 private: |
| 339 static const int kStrokeWidth = 10; | 339 static constexpr int kStrokeWidth = 10; |
| 340 static const int kNumPaths = 20; | 340 static constexpr int kNumPaths = 20; |
| 341 static const int kMaxPathHeight = 100; | 341 static constexpr int kMaxPathHeight = 100; |
| 342 static const int kGMWidth = 512; | 342 static constexpr int kGMWidth = 512; |
| 343 static const int kGMHeight = 512; | 343 static constexpr int kGMHeight = 512; |
| 344 | 344 |
| 345 bool fDoStrokeAndFill; | 345 bool fDoStrokeAndFill; |
| 346 | 346 |
| 347 typedef GM INHERITED; | 347 typedef GM INHERITED; |
| 348 }; | 348 }; |
| 349 | 349 |
| 350 ////////////////////////////////////////////////////////////////////////////// | 350 ////////////////////////////////////////////////////////////////////////////// |
| 351 | 351 |
| 352 DEF_GM(return new ConvexLineOnlyPathsGM(false);) | 352 DEF_GM(return new ConvexLineOnlyPathsGM(false);) |
| 353 DEF_GM(return new ConvexLineOnlyPathsGM(true);) | 353 DEF_GM(return new ConvexLineOnlyPathsGM(true);) |
| 354 } | 354 } |
| OLD | NEW |