Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Issue 139483002: change isRect to return true for 3-sided rectangular paths (Closed)

Created:
6 years, 11 months ago by reed1
Modified:
6 years, 11 months ago
Reviewers:
yunchao, caryclark
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

change isRect to return true for 3-sided rectangular paths BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=13092

Patch Set 1 #

Total comments: 2

Patch Set 2 : catch case of 4 corners but last segment did not quite reach the start corner #

Patch Set 3 : handle overshoot on a incomplete/overcomplete rect #

Unified diffs Side-by-side diffs Delta from patch set Stats (+55 lines, -19 lines) Patch
M src/core/SkPath.cpp View 1 2 4 chunks +36 lines, -4 lines 0 comments Download
M tests/PathTest.cpp View 1 2 4 chunks +19 lines, -15 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
reed1
6 years, 11 months ago (2014-01-15 15:00:41 UTC) #1
caryclark
https://codereview.chromium.org/139483002/diff/1/tests/PathTest.cpp File tests/PathTest.cpp (right): https://codereview.chromium.org/139483002/diff/1/tests/PathTest.cpp#newcode1528 tests/PathTest.cpp:1528: testIndex = 26; Debugging line left in by accident?
6 years, 11 months ago (2014-01-15 15:07:15 UTC) #2
reed1
6 years, 11 months ago (2014-01-15 15:42:22 UTC) #3
reed1
https://codereview.chromium.org/139483002/diff/1/tests/PathTest.cpp File tests/PathTest.cpp (right): https://codereview.chromium.org/139483002/diff/1/tests/PathTest.cpp#newcode1528 tests/PathTest.cpp:1528: testIndex = 26; On 2014/01/15 15:07:15, caryclark wrote: > ...
6 years, 11 months ago (2014-01-15 15:51:02 UTC) #4
caryclark
lgtm
6 years, 11 months ago (2014-01-15 15:54:57 UTC) #5
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/reed@google.com/139483002/140001
6 years, 11 months ago (2014-01-15 17:06:52 UTC) #6
commit-bot: I haz the power
Change committed as 13092
6 years, 11 months ago (2014-01-15 18:00:59 UTC) #7
yunchao
6 years, 11 months ago (2014-01-23 02:53:17 UTC) #8
Message was sent while issue was closed.
On 2014/01/15 18:00:59, I haz the power (commit-bot) wrote:

I don't think this patch is correct. Because stroke paths are not considered. 
For thess patch: 
(1) 3-sided rect paths
(2) 4 sided but the last edge is not long enough to reach the start
They can be treated as a rect only if it is filled. 

So I think my patch(https://codereview.chromium.org/54523002/) to return 3
states is reasonable: SkNone_PathAsRect, SkFill_PathAsRect, SkStroke_PathAsRect.
for (1) and (2), we should return the caller SkFill_PathAsRect.

And isclosed is a redundant info. I should not take effect. For example, this
case that in BUG=skia:2040
SkPath path;
path.moveTo(0,0);
path.lineTo(8,0);
path.lineTo(8,8);
path.lineTo(0,8);

path.lineTo(0,0);

We should not tell the caller that this path is closed if there is no
path.close(). Because for stroke path, this path is not closed at all. It is a
contour with ends. 
Also, we should return SkFill_PathAsRect too. 

In all, I think add an API SkPath::asRect to return 3 states is better than
SkPath::isRect who return just true or false. The latter can't handle non-closed
paths. We should return SkFill_PathAsRect for this kind paths, not just return
true.

Powered by Google App Engine
This is Rietveld 408576698