1 /* 2 * Copyright 2017 ARM Ltd. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef GrDistanceFieldGenFromVector_DEFINED 9 #define GrDistanceFieldGenFromVector_DEFINED 10 11 #if !defined(SK_ENABLE_OPTIMIZE_SIZE) 12 13 #include "include/core/SkPath.h" 14 15 class SkMatrix; 16 17 /** Given a vector path, generate the associated distance field. 18 19 * @param distanceField The distance field to be generated. Should already be allocated 20 * by the client with the padding defined in "SkDistanceFieldGen.h". 21 * @param path The path we're using to generate the distance field. 22 * @param matrix Transformation matrix for path. 23 * @param width Width of the distance field. 24 * @param height Height of the distance field. 25 * @param rowBytes Size of each row in the distance field, in bytes. 26 */ 27 bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField, 28 const SkPath& path, const SkMatrix& viewMatrix, 29 int width, int height, size_t rowBytes); 30 IsDistanceFieldSupportedFillType(SkPathFillType fFillType)31inline bool IsDistanceFieldSupportedFillType(SkPathFillType fFillType) 32 { 33 return (SkPathFillType::kEvenOdd == fFillType || 34 SkPathFillType::kInverseEvenOdd == fFillType); 35 } 36 37 #endif // SK_ENABLE_OPTIMIZE_SIZE 38 39 #endif // GrDistanceFieldGenFromVector_DEFINED 40