Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(361)

Side by Side Diff: src/effects/SkDashPathEffect.cpp

Issue 29143005: Constify SkFlattenable::getFactory(). (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 results->fLast.addRect(x - halfWidth, y - halfHeight, 521 results->fLast.addRect(x - halfWidth, y - halfHeight,
522 x + halfWidth, y + halfHeight); 522 x + halfWidth, y + halfHeight);
523 } 523 }
524 524
525 SkASSERT(curPt == results->fNumPoints); 525 SkASSERT(curPt == results->fNumPoints);
526 } 526 }
527 527
528 return true; 528 return true;
529 } 529 }
530 530
531 SkFlattenable::Factory SkDashPathEffect::getFactory() { 531 SkFlattenable::Factory SkDashPathEffect::getFactory() const {
532 return fInitialDashLength < 0 ? NULL : CreateProc; 532 return fInitialDashLength < 0 ? NULL : CreateProc;
533 } 533 }
534 534
535 void SkDashPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { 535 void SkDashPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
536 SkASSERT(fInitialDashLength >= 0); 536 SkASSERT(fInitialDashLength >= 0);
537 537
538 this->INHERITED::flatten(buffer); 538 this->INHERITED::flatten(buffer);
539 buffer.writeInt(fInitialDashIndex); 539 buffer.writeInt(fInitialDashIndex);
540 buffer.writeScalar(fInitialDashLength); 540 buffer.writeScalar(fInitialDashLength);
541 buffer.writeScalar(fIntervalLength); 541 buffer.writeScalar(fIntervalLength);
542 buffer.writeBool(fScaleToFit); 542 buffer.writeBool(fScaleToFit);
543 buffer.writeScalarArray(fIntervals, fCount); 543 buffer.writeScalarArray(fIntervals, fCount);
544 } 544 }
545 545
546 SkFlattenable* SkDashPathEffect::CreateProc(SkFlattenableReadBuffer& buffer) { 546 SkFlattenable* SkDashPathEffect::CreateProc(SkFlattenableReadBuffer& buffer) {
547 return SkNEW_ARGS(SkDashPathEffect, (buffer)); 547 return SkNEW_ARGS(SkDashPathEffect, (buffer));
548 } 548 }
549 549
550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) { 550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) {
551 fInitialDashIndex = buffer.readInt(); 551 fInitialDashIndex = buffer.readInt();
552 fInitialDashLength = buffer.readScalar(); 552 fInitialDashLength = buffer.readScalar();
553 fIntervalLength = buffer.readScalar(); 553 fIntervalLength = buffer.readScalar();
554 fScaleToFit = buffer.readBool(); 554 fScaleToFit = buffer.readBool();
555 555
556 fCount = buffer.getArrayCount(); 556 fCount = buffer.getArrayCount();
557 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount); 557 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount);
558 buffer.readScalarArray(fIntervals); 558 buffer.readScalarArray(fIntervals);
559 } 559 }
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698