3 * Copyright 2006 The Android Open Source Project
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
9 #include "SkPathEffect.h"
11 #include "SkFlattenableBuffers.h"
13 ///////////////////////////////////////////////////////////////////////////////
15 void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) const {
19 bool SkPathEffect::asPoints(PointData* results, const SkPath& src,
20 const SkStrokeRec&, const SkMatrix&, const SkRect*) const {
24 ///////////////////////////////////////////////////////////////////////////////
26 SkPairPathEffect::SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1)
27 : fPE0(pe0), fPE1(pe1) {
34 SkPairPathEffect::~SkPairPathEffect() {
40 Format: [oe0-factory][pe1-factory][pe0-size][pe0-data][pe1-data]
42 void SkPairPathEffect::flatten(SkFlattenableWriteBuffer& buffer) const {
43 this->INHERITED::flatten(buffer);
44 buffer.writeFlattenable(fPE0);
45 buffer.writeFlattenable(fPE1);
48 SkPairPathEffect::SkPairPathEffect(SkFlattenableReadBuffer& buffer) {
49 fPE0 = buffer.readPathEffect();
50 fPE1 = buffer.readPathEffect();
51 // either of these may fail, so we have to check for nulls later on
54 ///////////////////////////////////////////////////////////////////////////////
56 bool SkComposePathEffect::filterPath(SkPath* dst, const SkPath& src,
57 SkStrokeRec* rec, const SkRect* cullRect) const {
58 // we may have failed to unflatten these, so we have to check
64 const SkPath* ptr = &src;
66 if (fPE1->filterPath(&tmp, src, rec, cullRect)) {
69 return fPE0->filterPath(dst, *ptr, rec, cullRect);
72 ///////////////////////////////////////////////////////////////////////////////
74 bool SkSumPathEffect::filterPath(SkPath* dst, const SkPath& src,
75 SkStrokeRec* rec, const SkRect* cullRect) const {
76 // use bit-or so that we always call both, even if the first one succeeds
77 return fPE0->filterPath(dst, src, rec, cullRect) |
78 fPE1->filterPath(dst, src, rec, cullRect);