diff options
author | joel.liang <joel.liang@arm.com> | 2017-01-09 18:39:43 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-09 18:39:43 -0800 |
commit | 8cbb4246e58c97e2ac51087d2708795b3b59f5e9 (patch) | |
tree | 809c537951a9ec8c3b3c69ec6d0a3b2d924ebd67 /src/gpu/GrDistanceFieldGenFromVector.h | |
parent | e57194f74d125c7b0ba767ae5357b97d102792ef (diff) |
Generate Signed Distance Field directly from vector path
Add SkGenerateDistanceFieldFromPath API to generate signed distance field directly from SkPath.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1643143002
Committed: https://skia.googlesource.com/skia/+/4de97a64e8829323a7070b623411d9f9ddb0cd0f
Committed: https://skia.googlesource.com/skia/+/e8f0a7b986f1e5583c9bc162efcdd92fd6430549
Committed: https://skia.googlesource.com/skia/+/67c7c81a82b6351e9fbbf235084d7120162d9268
Review-Url: https://codereview.chromium.org/1643143002
Committed: https://skia.googlesource.com/skia/+/64b70b096ac20833d9737758a4bd5f2a51078bc4
Review-Url: https://codereview.chromium.org/1643143002
Committed: https://skia.googlesource.com/skia/+/6d2f73c364d0d823f14d1ddebc88e0bcbc8f0634
Review-Url: https://codereview.chromium.org/1643143002
Diffstat (limited to 'src/gpu/GrDistanceFieldGenFromVector.h')
-rw-r--r-- | src/gpu/GrDistanceFieldGenFromVector.h | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/gpu/GrDistanceFieldGenFromVector.h b/src/gpu/GrDistanceFieldGenFromVector.h new file mode 100644 index 0000000000..48a0784229 --- /dev/null +++ b/src/gpu/GrDistanceFieldGenFromVector.h @@ -0,0 +1,39 @@ +/* + * Copyright 2017 ARM Ltd. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrDistanceFieldGenFromVector_DEFINED +#define GrDistanceFieldGenFromVector_DEFINED + +#include "SkPath.h" + +class SkMatrix; + +#ifndef SK_USE_LEGACY_DISTANCE_FIELDS + #define SK_USE_LEGACY_DISTANCE_FIELDS +#endif + +/** Given a vector path, generate the associated distance field. + + * @param distanceField The distance field to be generated. Should already be allocated + * by the client with the padding defined in "SkDistanceFieldGen.h". + * @param path The path we're using to generate the distance field. + * @param matrix Transformation matrix for path. + * @param width Width of the distance field. + * @param height Height of the distance field. + * @param rowBytes Size of each row in the distance field, in bytes. + */ +bool GrGenerateDistanceFieldFromPath(unsigned char* distanceField, + const SkPath& path, const SkMatrix& viewMatrix, + int width, int height, size_t rowBytes); + +inline bool IsDistanceFieldSupportedFillType(SkPath::FillType fFillType) +{ + return (SkPath::kEvenOdd_FillType == fFillType || + SkPath::kInverseEvenOdd_FillType == fFillType); +} + +#endif |