Fix quad convexity with only one backward dir

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2465253008

Review-Url: https://codereview.chromium.org/2465253008
This commit is contained in:
liyuqian 2016-11-03 11:40:19 -07:00 committed by Commit bot
parent 6b059bdc40
commit bdabcc4cb8
2 changed files with 7 additions and 2 deletions

View File

@ -2405,8 +2405,9 @@ private:
break;
case kBackwards_DirChange:
if (fIsCurve) {
fConvexity = SkPath::kConcave_Convexity;
fFirstDirection = SkPathPriv::kUnknown_FirstDirection;
// If any of the subsequent dir is non-backward, it'll be concave.
// Otherwise, it's still convex.
fExpectedDir = dir;
}
fLastVec = vec;
break;

View File

@ -1496,6 +1496,10 @@ static void test_convexity(skiatest::Reporter* reporter) {
check_convexity(reporter, path, SkPath::kConvex_Convexity);
REPORTER_ASSERT(reporter, SkPathPriv::CheapIsFirstDirection(path, SkPathPriv::kCW_FirstDirection));
path.reset();
path.quadTo(100, 100, 50, 50); // This is a convex path from GM:convexpaths
check_convexity(reporter, path, SkPath::kConvex_Convexity);
static const struct {
const char* fPathStr;
SkPath::Convexity fExpectedConvexity;