121c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com/*
221c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com * Copyright 2012 Google Inc.
321c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com *
421c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com * Use of this source code is governed by a BSD-style license that can be
521c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com * found in the LICENSE file.
621c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com */
721c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#ifndef SkReduceOrder_DEFINED
821c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#define SkReduceOrder_DEFINED
921c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
1021c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#include "SkPath.h"
1121c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#include "SkPathOpsCubic.h"
1221c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#include "SkPathOpsLine.h"
1321c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#include "SkPathOpsQuad.h"
14b36bcb965cc651ee0c215d439b7fbfdb52516c00caryclark@google.com#include "SkTArray.h"
1521c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
1621c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.comunion SkReduceOrder {
1721c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    enum Quadratics {
1821c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com        kNo_Quadratics,
1921c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com        kAllow_Quadratics
2021c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    };
2121c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
2287c9e7f295c6797de8123477d570d4fb8d2c195fcaryclark@google.com    int reduce(const SkDCubic& cubic, Quadratics);
2321c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    int reduce(const SkDLine& line);
2487c9e7f295c6797de8123477d570d4fb8d2c195fcaryclark@google.com    int reduce(const SkDQuad& quad);
2521c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
2646e3086c1837da6ab13b48f852bd7bfbab3dc44fcaryclark@google.com    static SkPath::Verb Cubic(const SkPoint pts[4], SkPoint* reducePts);
2746e3086c1837da6ab13b48f852bd7bfbab3dc44fcaryclark@google.com    static SkPath::Verb Quad(const SkPoint pts[3], SkPoint* reducePts);
2821c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
2921c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    SkDLine fLine;
3021c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    SkDQuad fQuad;
3121c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com    SkDCubic fCubic;
3221c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com};
3321c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com
3421c2924b178f0d4c298d6631e568401473ed8d16caryclark@google.com#endif
35