| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkStrokeRec.h" | 8 #include "SkStrokeRec.h" |
| 9 #include "SkPaintDefaults.h" | 9 #include "SkPaintDefaults.h" |
| 10 | 10 |
| 11 // must be < 0, since ==0 means hairline, and >0 means normal stroke | 11 // must be < 0, since ==0 means hairline, and >0 means normal stroke |
| 12 #define kStrokeRec_FillStyleWidth (-SK_Scalar1) | 12 #define kStrokeRec_FillStyleWidth (-SK_Scalar1) |
| 13 | 13 |
| 14 SkStrokeRec::SkStrokeRec(InitStyle s) { | 14 SkStrokeRec::SkStrokeRec(InitStyle s) { |
| 15 fResScale = 1; | 15 fResScale = 1; |
| 16 fWidth = (kFill_InitStyle == s) ? kStrokeRec_FillStyleWidth : 0; | 16 fWidth = (kFill_InitStyle == s) ? kStrokeRec_FillStyleWidth : 0; |
| 17 fMiterLimit = SkPaintDefaults_MiterLimit; | 17 fMiterLimit = SkPaintDefaults_MiterLimit; |
| 18 fCap = SkPaint::kDefault_Cap; | 18 fCap = SkPaint::kDefault_Cap; |
| 19 fJoin = SkPaint::kDefault_Join; | 19 fJoin = SkPaint::kDefault_Join; |
| 20 fStrokeAndFill = false; | 20 fStrokeAndFill = false; |
| 21 } | 21 } |
| 22 | 22 |
| 23 SkStrokeRec::SkStrokeRec(const SkStrokeRec& src) { | |
| 24 memcpy(this, &src, sizeof(src)); | |
| 25 } | |
| 26 | |
| 27 SkStrokeRec::SkStrokeRec(const SkPaint& paint, SkScalar resScale) { | 23 SkStrokeRec::SkStrokeRec(const SkPaint& paint, SkScalar resScale) { |
| 28 this->init(paint, paint.getStyle(), resScale); | 24 this->init(paint, paint.getStyle(), resScale); |
| 29 } | 25 } |
| 30 | 26 |
| 31 SkStrokeRec::SkStrokeRec(const SkPaint& paint, SkPaint::Style styleOverride, SkS
calar resScale) { | 27 SkStrokeRec::SkStrokeRec(const SkPaint& paint, SkPaint::Style styleOverride, SkS
calar resScale) { |
| 32 this->init(paint, styleOverride, resScale); | 28 this->init(paint, styleOverride, resScale); |
| 33 } | 29 } |
| 34 | 30 |
| 35 void SkStrokeRec::init(const SkPaint& paint, SkPaint::Style style, SkScalar resS
cale) { | 31 void SkStrokeRec::init(const SkPaint& paint, SkPaint::Style style, SkScalar resS
cale) { |
| 36 fResScale = resScale; | 32 fResScale = resScale; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 paint->setStyle(SkPaint::kFill_Style); | 127 paint->setStyle(SkPaint::kFill_Style); |
| 132 return; | 128 return; |
| 133 } | 129 } |
| 134 | 130 |
| 135 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS
troke_Style); | 131 paint->setStyle(fStrokeAndFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kS
troke_Style); |
| 136 paint->setStrokeWidth(fWidth); | 132 paint->setStrokeWidth(fWidth); |
| 137 paint->setStrokeMiter(fMiterLimit); | 133 paint->setStrokeMiter(fMiterLimit); |
| 138 paint->setStrokeCap(fCap); | 134 paint->setStrokeCap(fCap); |
| 139 paint->setStrokeJoin(fJoin); | 135 paint->setStrokeJoin(fJoin); |
| 140 } | 136 } |
| OLD | NEW |