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

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

Issue 115323004: Improved SkPathRef interface security (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix private pathref test pattern Created 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkPathRef.h ('k') | tests/PathTest.cpp » ('j') | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkOnce.h" 9 #include "SkOnce.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
11 #include "SkPathRef.h" 11 #include "SkPathRef.h"
12 12
13 ////////////////////////////////////////////////////////////////////////////// 13 //////////////////////////////////////////////////////////////////////////////
14 SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>* pathRef, 14 SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>* pathRef,
15 int incReserveVerbs, 15 int incReserveVerbs,
16 int incReservePoints) 16 int incReservePoints)
17 { 17 {
18 if ((*pathRef)->unique()) { 18 if ((*pathRef)->unique()) {
19 (*pathRef)->incReserve(incReserveVerbs, incReservePoints); 19 (*pathRef)->incReserve(incReserveVerbs, incReservePoints);
20 } else { 20 } else {
21 SkPathRef* copy = SkNEW(SkPathRef); 21 SkPathRef* copy = SkNEW(SkPathRef);
22 copy->copy(**pathRef, incReserveVerbs, incReservePoints); 22 copy->copy(**pathRef, incReserveVerbs, incReservePoints);
23 pathRef->reset(copy); 23 pathRef->reset(copy);
24 } 24 }
25 fPathRef = *pathRef; 25 fPathRef = *pathRef;
26 fPathRef->fGenerationID = 0; 26 fPathRef->fGenerationID = 0;
27 fPathRef->fIsOval = false;
28 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);) 27 SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);)
29 } 28 }
30 29
31 ////////////////////////////////////////////////////////////////////////////// 30 //////////////////////////////////////////////////////////////////////////////
32 void SkPathRef::CreateEmptyImpl(SkPathRef** empty) { 31 void SkPathRef::CreateEmptyImpl(SkPathRef** empty) {
33 *empty = SkNEW(SkPathRef); 32 *empty = SkNEW(SkPathRef);
34 (*empty)->computeBounds(); // Preemptively avoid a race to clear fBoundsIsD irty. 33 (*empty)->computeBounds(); // Preemptively avoid a race to clear fBoundsIsD irty.
35 } 34 }
36 35
37 SkPathRef* SkPathRef::CreateEmpty() { 36 SkPathRef* SkPathRef::CreateEmpty() {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 break; 495 break;
497 default: 496 default:
498 SkDEBUGFAIL("Unknown Verb"); 497 SkDEBUGFAIL("Unknown Verb");
499 break; 498 break;
500 } 499 }
501 } 500 }
502 SkASSERT(mask == fSegmentMask); 501 SkASSERT(mask == fSegmentMask);
503 #endif // SK_DEBUG_PATH 502 #endif // SK_DEBUG_PATH
504 } 503 }
505 #endif 504 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathRef.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698