Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 #include "SkDashPathEffect.h" | 8 #include "SkDashPathEffect.h" |
| 11 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
| 12 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
| 13 #include "SkPathMeasure.h" | 11 #include "SkPathMeasure.h" |
| 14 | 12 |
| 15 static inline int is_even(int x) { | 13 static inline int is_even(int x) { |
| 16 return (~x) << 31; | 14 return (~x) << 31; |
| 17 } | 15 } |
| 18 | 16 |
| 19 static SkScalar FindFirstInterval(const SkScalar intervals[], SkScalar phase, | 17 static SkScalar FindFirstInterval(const SkScalar intervals[], SkScalar phase, |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 536 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { | 534 void SkDashPathEffect::flatten(SkWriteBuffer& buffer) const { |
| 537 this->INHERITED::flatten(buffer); | 535 this->INHERITED::flatten(buffer); |
| 538 buffer.writeScalar(fPhase); | 536 buffer.writeScalar(fPhase); |
| 539 buffer.writeScalarArray(fIntervals, fCount); | 537 buffer.writeScalarArray(fIntervals, fCount); |
| 540 } | 538 } |
| 541 | 539 |
| 542 SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { | 540 SkFlattenable* SkDashPathEffect::CreateProc(SkReadBuffer& buffer) { |
| 543 return SkNEW_ARGS(SkDashPathEffect, (buffer)); | 541 return SkNEW_ARGS(SkDashPathEffect, (buffer)); |
| 544 } | 542 } |
| 545 | 543 |
| 546 SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) { | 544 SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) { |
|
robertphillips
2014/05/20 12:34:06
overlength - just remove the use of the temp varia
reed1
2014/05/20 17:21:57
Done.
| |
| 547 bool useOldPic = buffer.pictureVersion() < 25 && 0 != buffer.pictureVersion( ); | 545 bool useOldPic = buffer.pictureVersionLT(SkReadBuffer::kDashWritesPhaseInter vals_PictureVersion); |
| 548 if (useOldPic) { | 546 if (useOldPic) { |
| 549 fInitialDashIndex = buffer.readInt(); | 547 fInitialDashIndex = buffer.readInt(); |
| 550 fInitialDashLength = buffer.readScalar(); | 548 fInitialDashLength = buffer.readScalar(); |
| 551 fIntervalLength = buffer.readScalar(); | 549 fIntervalLength = buffer.readScalar(); |
| 552 buffer.readBool(); // Dummy for old ScalarToFit field | 550 buffer.readBool(); // Dummy for old ScalarToFit field |
| 553 } else { | 551 } else { |
| 554 fPhase = buffer.readScalar(); | 552 fPhase = buffer.readScalar(); |
| 555 } | 553 } |
| 556 | 554 |
| 557 fCount = buffer.getArrayCount(); | 555 fCount = buffer.getArrayCount(); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 568 if (fInitialDashLength != -1) { // Signal for bad dash interval | 566 if (fInitialDashLength != -1) { // Signal for bad dash interval |
| 569 for (int i = 0; i < fInitialDashIndex; ++i) { | 567 for (int i = 0; i < fInitialDashIndex; ++i) { |
| 570 fPhase += fIntervals[i]; | 568 fPhase += fIntervals[i]; |
| 571 } | 569 } |
| 572 fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength; | 570 fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength; |
| 573 } | 571 } |
| 574 } else { | 572 } else { |
| 575 this->setInternalMembers(fPhase); | 573 this->setInternalMembers(fPhase); |
| 576 } | 574 } |
| 577 } | 575 } |
| OLD | NEW |