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

Side by Side Diff: src/core/SkPath.cpp

Issue 1507113007: Another memcpy -> sk_careful_memcpy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « no previous file | 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkErrorInternals.h" 9 #include "SkErrorInternals.h"
10 #include "SkGeometry.h" 10 #include "SkGeometry.h"
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 int SkPath::countPoints() const { 576 int SkPath::countPoints() const {
577 return fPathRef->countPoints(); 577 return fPathRef->countPoints();
578 } 578 }
579 579
580 int SkPath::getPoints(SkPoint dst[], int max) const { 580 int SkPath::getPoints(SkPoint dst[], int max) const {
581 SkDEBUGCODE(this->validate();) 581 SkDEBUGCODE(this->validate();)
582 582
583 SkASSERT(max >= 0); 583 SkASSERT(max >= 0);
584 SkASSERT(!max || dst); 584 SkASSERT(!max || dst);
585 int count = SkMin32(max, fPathRef->countPoints()); 585 int count = SkMin32(max, fPathRef->countPoints());
586 memcpy(dst, fPathRef->points(), count * sizeof(SkPoint)); 586 sk_careful_memcpy(dst, fPathRef->points(), count * sizeof(SkPoint));
587 return fPathRef->countPoints(); 587 return fPathRef->countPoints();
588 } 588 }
589 589
590 SkPoint SkPath::getPoint(int index) const { 590 SkPoint SkPath::getPoint(int index) const {
591 if ((unsigned)index < (unsigned)fPathRef->countPoints()) { 591 if ((unsigned)index < (unsigned)fPathRef->countPoints()) {
592 return fPathRef->atPoint(index); 592 return fPathRef->atPoint(index);
593 } 593 }
594 return SkPoint::Make(0, 0); 594 return SkPoint::Make(0, 0);
595 } 595 }
596 596
(...skipping 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2836 break; 2836 break;
2837 } 2837 }
2838 return SkToBool(w); 2838 return SkToBool(w);
2839 } 2839 }
2840 2840
2841 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, 2841 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2,
2842 SkScalar w, SkPoint pts[], int pow2) { 2842 SkScalar w, SkPoint pts[], int pow2) {
2843 const SkConic conic(p0, p1, p2, w); 2843 const SkConic conic(p0, p1, p2, w);
2844 return conic.chopIntoQuadsPOW2(pts, pow2); 2844 return conic.chopIntoQuadsPOW2(pts, pow2);
2845 } 2845 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698