| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "SampleCode.h" | 8 #include "SampleCode.h" |
| 9 #include "SkView.h" | 9 #include "SkView.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // paint.setAntiAliasOn(true); | 154 // paint.setAntiAliasOn(true); |
| 155 paint.setStyle(SkPaint::kStroke_Style); | 155 paint.setStyle(SkPaint::kStroke_Style); |
| 156 | 156 |
| 157 canvas->drawRect(fClip, paint); | 157 canvas->drawRect(fClip, paint); |
| 158 | 158 |
| 159 #if 1 | 159 #if 1 |
| 160 paint.setColor(0xFF555555); | 160 paint.setColor(0xFF555555); |
| 161 paint.setStrokeWidth(SkIntToScalar(2)); | 161 paint.setStrokeWidth(SkIntToScalar(2)); |
| 162 // paint.setPathEffect(new SkCornerPathEffect(SkIntToScalar(30)))->unref(
); | 162 // paint.setPathEffect(new SkCornerPathEffect(SkIntToScalar(30)))->unref(
); |
| 163 canvas->drawPath(fPath, paint); | 163 canvas->drawPath(fPath, paint); |
| 164 // paint.setPathEffect(NULL); | 164 // paint.setPathEffect(nullptr); |
| 165 #endif | 165 #endif |
| 166 | 166 |
| 167 SkPath tmp; | 167 SkPath tmp; |
| 168 SkIRect iclip; | 168 SkIRect iclip; |
| 169 fClip.round(&iclip); | 169 fClip.round(&iclip); |
| 170 | 170 |
| 171 SkCullPointsPath cpp(iclip, &tmp); | 171 SkCullPointsPath cpp(iclip, &tmp); |
| 172 | 172 |
| 173 cpp.moveTo(fPoints[0].fX, fPoints[0].fY); | 173 cpp.moveTo(fPoints[0].fX, fPoints[0].fY); |
| 174 for (int i = 0; i < fPtCount; i++) | 174 for (int i = 0; i < fPtCount; i++) |
| 175 cpp.lineTo(fPoints[i].fX, fPoints[i].fY); | 175 cpp.lineTo(fPoints[i].fX, fPoints[i].fY); |
| 176 | 176 |
| 177 paint.setColor(SK_ColorRED); | 177 paint.setColor(SK_ColorRED); |
| 178 paint.setStrokeWidth(SkIntToScalar(3)); | 178 paint.setStrokeWidth(SkIntToScalar(3)); |
| 179 paint.setStrokeJoin(SkPaint::kRound_Join); | 179 paint.setStrokeJoin(SkPaint::kRound_Join); |
| 180 canvas->drawPath(tmp, paint); | 180 canvas->drawPath(tmp, paint); |
| 181 | 181 |
| 182 this->inval(NULL); | 182 this->inval(nullptr); |
| 183 } | 183 } |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 SkRect fClip; | 186 SkRect fClip; |
| 187 SkIPoint* fPoints; | 187 SkIPoint* fPoints; |
| 188 SkPath fPath; | 188 SkPath fPath; |
| 189 int fPtCount; | 189 int fPtCount; |
| 190 | 190 |
| 191 typedef SampleView INHERITED; | 191 typedef SampleView INHERITED; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 ////////////////////////////////////////////////////////////////////////////// | 194 ////////////////////////////////////////////////////////////////////////////// |
| 195 | 195 |
| 196 static SkView* MyFactory() { return new CullView; } | 196 static SkView* MyFactory() { return new CullView; } |
| 197 static SkViewRegister reg(MyFactory); | 197 static SkViewRegister reg(MyFactory); |
| OLD | NEW |