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

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

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (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/core/SkPaint.cpp ('k') | src/core/SkScalerContext.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 /* 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 #include "SkPathEffect.h" 9 #include "SkPathEffect.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 30 matching lines...) Expand all
41 /* 41 /*
42 Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data] 42 Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data]
43 */ 43 */
44 void SkPairPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const { 44 void SkPairPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
45 this->INHERITED::flatten(buffer); 45 this->INHERITED::flatten(buffer);
46 buffer.writeFlattenable(fPE0); 46 buffer.writeFlattenable(fPE0);
47 buffer.writeFlattenable(fPE1); 47 buffer.writeFlattenable(fPE1);
48 } 48 }
49 49
50 SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) { 50 SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) {
51 fPE0 = buffer.readFlattenableT<SkPathEffect>(); 51 fPE0 = buffer.readPathEffect();
52 fPE1 = buffer.readFlattenableT<SkPathEffect>(); 52 fPE1 = buffer.readPathEffect();
53 // either of these may fail, so we have to check for nulls later on 53 // either of these may fail, so we have to check for nulls later on
54 } 54 }
55 55
56 /////////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////////
57 57
58 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src, 58 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
59 SkStrokeRec* rec, const SkRect* cullRect) const { 59 SkStrokeRec* rec, const SkRect* cullRect) const {
60 // we may have failed to unflatten these, so we have to check 60 // we may have failed to unflatten these, so we have to check
61 if (!fPE0 || !fPE1) { 61 if (!fPE0 || !fPE1) {
62 return false; 62 return false;
63 } 63 }
64 64
65 SkPath tmp; 65 SkPath tmp;
66 const SkPath* ptr = &src; 66 const SkPath* ptr = &src;
67 67
68 if (fPE1->filterPath(&tmp, src, rec, cullRect)) { 68 if (fPE1->filterPath(&tmp, src, rec, cullRect)) {
69 ptr = &tmp; 69 ptr = &tmp;
70 } 70 }
71 return fPE0->filterPath(dst, *ptr, rec, cullRect); 71 return fPE0->filterPath(dst, *ptr, rec, cullRect);
72 } 72 }
73 73
74 /////////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////////
75 75
76 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src, 76 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
77 SkStrokeRec* rec, const SkRect* cullRect) const { 77 SkStrokeRec* rec, const SkRect* cullRect) const {
78 // use bit-or so that we always call both, even if the first one succeeds 78 // use bit-or so that we always call both, even if the first one succeeds
79 return fPE0->filterPath(dst, src, rec, cullRect) | 79 return fPE0->filterPath(dst, src, rec, cullRect) |
80 fPE1->filterPath(dst, src, rec, cullRect); 80 fPE1->filterPath(dst, src, rec, cullRect);
81 } 81 }
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkScalerContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698