| 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 | 9 |
| 10 #include "SkImage.h" | 10 #include "SkImage.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 SkSTArray<3, sk_sp<SkImage>, true> fImages; | 66 SkSTArray<3, sk_sp<SkImage>, true> fImages; |
| 67 SkSTArray<3, SkScalar> fScales; | 67 SkSTArray<3, SkScalar> fScales; |
| 68 SkVector fVector; | 68 SkVector fVector; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 static sk_sp<SkImage> MakeImage(const SkVector& vec, SkColor color) { | 71 static sk_sp<SkImage> MakeImage(const SkVector& vec, SkColor color) { |
| 72 const SkPoint start = SkPoint::Make(vec.y() * kSegLen / 2, vec.x() * kSe
gLen / 2); | 72 const SkPoint start = SkPoint::Make(vec.y() * kSegLen / 2, vec.x() * kSe
gLen / 2); |
| 73 const SkPoint end = SkPoint::Make(start.x() + vec.x() * (kSegLen - 1), | 73 const SkPoint end = SkPoint::Make(start.x() + vec.x() * (kSegLen - 1), |
| 74 start.y() + vec.y() * (kSegLen - 1))
; | 74 start.y() + vec.y() * (kSegLen - 1))
; |
| 75 | 75 |
| 76 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(kSegLen, k
SegLen)); | 76 auto surface(SkSurface::MakeRasterN32Premul(kSegLen, kSegLen)); |
| 77 surface->getCanvas()->clear(SK_ColorTRANSPARENT); | 77 surface->getCanvas()->clear(SK_ColorTRANSPARENT); |
| 78 | 78 |
| 79 SkPaint paint; | 79 SkPaint paint; |
| 80 paint.setAntiAlias(true); | 80 paint.setAntiAlias(true); |
| 81 const SkRect border = SkRect::MakeIWH(kSegLen, kSegLen).makeInset(.5f, .
5f); | 81 const SkRect border = SkRect::MakeIWH(kSegLen, kSegLen).makeInset(.5f, .
5f); |
| 82 paint.setColor(SK_ColorBLUE); | 82 paint.setColor(SK_ColorBLUE); |
| 83 paint.setStyle(SkPaint::kStroke_Style); | 83 paint.setStyle(SkPaint::kStroke_Style); |
| 84 surface->getCanvas()->drawRect(border, paint); | 84 surface->getCanvas()->drawRect(border, paint); |
| 85 | 85 |
| 86 paint.setColor(SK_ColorBLACK); | 86 paint.setColor(SK_ColorBLACK); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 } | 139 } |
| 140 | 140 |
| 141 static const unsigned kSegLen = 15; | 141 static const unsigned kSegLen = 15; |
| 142 static const unsigned kStretchFactor = 4; | 142 static const unsigned kStretchFactor = 4; |
| 143 SkSTArray<2, ImageSet> fSets; | 143 SkSTArray<2, ImageSet> fSets; |
| 144 | 144 |
| 145 typedef GM INHERITED; | 145 typedef GM INHERITED; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 DEF_GM(return new ImageScaleAlignedGM();) | 148 DEF_GM(return new ImageScaleAlignedGM();) |
| OLD | NEW |