| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 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 | 8 |
| 9 | 9 |
| 10 #include "SkDiscretePathEffect.h" | 10 #include "SkDiscretePathEffect.h" |
| 11 #include "SkFlattenableBuffers.h" | 11 #include "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" |
| 12 #include "SkPathMeasure.h" | 13 #include "SkPathMeasure.h" |
| 13 #include "SkRandom.h" | 14 #include "SkRandom.h" |
| 14 | 15 |
| 15 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) { | 16 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) { |
| 16 SkVector normal = tangent; | 17 SkVector normal = tangent; |
| 17 normal.rotateCCW(); | 18 normal.rotateCCW(); |
| 18 normal.setLength(scale); | 19 normal.setLength(scale); |
| 19 *p += normal; | 20 *p += normal; |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 64 } |
| 64 } | 65 } |
| 65 if (meas.isClosed()) { | 66 if (meas.isClosed()) { |
| 66 dst->close(); | 67 dst->close(); |
| 67 } | 68 } |
| 68 } | 69 } |
| 69 } while (meas.nextContour()); | 70 } while (meas.nextContour()); |
| 70 return true; | 71 return true; |
| 71 } | 72 } |
| 72 | 73 |
| 73 void SkDiscretePathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { | 74 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const { |
| 74 this->INHERITED::flatten(buffer); | 75 this->INHERITED::flatten(buffer); |
| 75 buffer.writeScalar(fSegLength); | 76 buffer.writeScalar(fSegLength); |
| 76 buffer.writeScalar(fPerterb); | 77 buffer.writeScalar(fPerterb); |
| 77 } | 78 } |
| 78 | 79 |
| 79 SkDiscretePathEffect::SkDiscretePathEffect(SkFlattenableReadBuffer& buffer) { | 80 SkDiscretePathEffect::SkDiscretePathEffect(SkReadBuffer& buffer) { |
| 80 fSegLength = buffer.readScalar(); | 81 fSegLength = buffer.readScalar(); |
| 81 fPerterb = buffer.readScalar(); | 82 fPerterb = buffer.readScalar(); |
| 82 } | 83 } |
| OLD | NEW |