gfx/skia/trunk/src/core/SkEdgeClipper.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/core/SkEdgeClipper.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2009 The Android Open Source Project
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +
    1.13 +#ifndef SkEdgeClipper_DEFINED
    1.14 +#define SkEdgeClipper_DEFINED
    1.15 +
    1.16 +#include "SkPath.h"
    1.17 +
    1.18 +/** This is basically an iterator. It is initialized with an edge and a clip,
    1.19 +    and then next() is called until it returns kDone_Verb.
    1.20 + */
    1.21 +class SkEdgeClipper {
    1.22 +public:
    1.23 +    bool clipQuad(const SkPoint pts[3], const SkRect& clip);
    1.24 +    bool clipCubic(const SkPoint pts[4], const SkRect& clip);
    1.25 +
    1.26 +    SkPath::Verb next(SkPoint pts[]);
    1.27 +
    1.28 +private:
    1.29 +    SkPoint*        fCurrPoint;
    1.30 +    SkPath::Verb*   fCurrVerb;
    1.31 +
    1.32 +    enum {
    1.33 +        kMaxVerbs = 13,
    1.34 +        kMaxPoints = 32
    1.35 +    };
    1.36 +    SkPoint         fPoints[kMaxPoints];
    1.37 +    SkPath::Verb    fVerbs[kMaxVerbs];
    1.38 +
    1.39 +    void clipMonoQuad(const SkPoint srcPts[3], const SkRect& clip);
    1.40 +    void clipMonoCubic(const SkPoint srcPts[4], const SkRect& clip);
    1.41 +    void appendVLine(SkScalar x, SkScalar y0, SkScalar y1, bool reverse);
    1.42 +    void appendQuad(const SkPoint pts[3], bool reverse);
    1.43 +    void appendCubic(const SkPoint pts[4], bool reverse);
    1.44 +};
    1.45 +
    1.46 +#ifdef SK_DEBUG
    1.47 +    void sk_assert_monotonic_x(const SkPoint pts[], int count);
    1.48 +    void sk_assert_monotonic_y(const SkPoint pts[], int count);
    1.49 +#else
    1.50 +    #define sk_assert_monotonic_x(pts, count)
    1.51 +    #define sk_assert_monotonic_y(pts, count)
    1.52 +#endif
    1.53 +
    1.54 +#endif

mercurial