ShapeOps.h revision 31143cf37fa38dc98f71c71e518ecc21c83b5e27
19e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com/* 29e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com * Copyright 2012 Google Inc. 39e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com * 49e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com * Use of this source code is governed by a BSD-style license that can be 59e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com * found in the LICENSE file. 69e49fb63d355446b91d20ff78ad78b297e89a50dcaryclark@google.com */ 7d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.com#include "SkPath.h" 8d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.com 9235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com// region-inspired approach 10d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.comvoid contourBounds(const SkPath& path, SkTDArray<SkRect>& boundsArray); 11d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.comvoid simplify(const SkPath& path, bool asFill, SkPath& simple); 12235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com 13235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com// contour outer edge walking approach 14235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com#ifndef DEFINE_SHAPE_OP 15235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com// FIXME: namespace testing doesn't allow global enums like this 16235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com#define DEFINE_SHAPE_OP 17235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.comenum ShapeOp { 18235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kDifference_Op, 19235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kIntersect_Op, 20235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kUnion_Op, 2131143cf37fa38dc98f71c71e518ecc21c83b5e27caryclark@google.com kXor_Op, 2231143cf37fa38dc98f71c71e518ecc21c83b5e27caryclark@google.com kShapeOp_Count 23235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com}; 24235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com 25235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.comenum ShapeOpMask { 26235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kWinding_Mask = -1, 27235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kNo_Mask = 0, 28235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com kEvenOdd_Mask = 1 29235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com}; 30235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com#endif 31235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.com 32235f56a92f6eb6accbb243e11b3c45e3798f38f2caryclark@google.comvoid operate(const SkPath& one, const SkPath& two, ShapeOp op, SkPath& result); 3365f9f0a1664a9cb38157ccfbcc3e0e936af0a58ecaryclark@google.comvoid simplifyx(const SkPath& path, SkPath& simple); 34d88e0894d0156f4d427b812fec69bfba3eec7a8dcaryclark@google.com 3547580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com// FIXME: remove this section once debugging is complete 3647580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comextern const bool gRunTestsInOneThread; 3747580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com#ifdef SK_DEBUG 3847580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comextern int gDebugMaxWindSum; 3947580694fbe974a065caf7c39c3d2075708c2018caryclark@google.comextern int gDebugMaxWindValue; 4047580694fbe974a065caf7c39c3d2075708c2018caryclark@google.com#endif 41