Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5832)

Issue 6850059: add two rect detector to path (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by caryclark1
Modified:
12 years ago
Reviewers:
reed1
CC:
skia-review_googlegroups.com
Base URL:
http://skia.googlecode.com/svn/trunk/
Visibility:
Public.

Description

add two nested rect detector to path Tease apart existing one rect path detector so that a new variant can detect two nested rects as well. Add tests to verify that both one and two rect detectors both work and return the correct results. Suppress other warnings in PathTest. Committed: https://code.google.com/p/skia/source/detail?r=6475

Patch Set 1 #

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+256 lines, -11 lines) Patch
M include/core/SkPath.h View 1 2 2 chunks +12 lines, -0 lines 0 comments Download
M src/core/SkPath.cpp View 1 2 3 chunks +48 lines, -8 lines 0 comments Download
M tests/PathTest.cpp View 1 2 7 chunks +196 lines, -3 lines 0 comments Download

Messages

Total messages: 6
caryclark1
12 years, 1 month ago (2012-11-15 16:33:58 UTC) #1
reed1
The need that came up was for concentric rects, where one contains the other. Seems ...
12 years, 1 month ago (2012-11-15 17:31:36 UTC) #2
caryclark1
Done. On 2012/11/15 17:31:36, reed1 wrote: > The need that came up was for concentric ...
12 years, 1 month ago (2012-11-15 18:28:39 UTC) #3
reed1
lgtm what happens if both or the inner rect is empty? I wonder what we ...
12 years ago (2012-11-15 20:10:54 UTC) #4
caryclark1
I'm confused. SkRect::contains() returns true iff both are not empty. What does an empty rectangle ...
12 years ago (2012-11-15 21:13:51 UTC) #5
reed1
12 years ago (2012-11-15 21:27:56 UTC) #6
Good point about contains returning false for empty.

Yes, I was trying to avoid two diff calls when classifying a path.

SkRect storage[2];
int n = path.isNestedRects(storage);
switch (n) {
   case 0:
       // not anything I can specialize on
   case 1:
       // same as isRect(&storage[0]), treat as single rect
   case 2:
       // new donut case
}

I don't have any interesting use in mind for more than two. I guess we
could take a max parameter if we wanted to keep that possibility open
(isNested(SkRect [], int maxRects)) but I'd be fine to not do that now.


On Thu, Nov 15, 2012 at 4:13 PM, <caryclark@google.com> wrote:

> I'm confused. SkRect::contains() returns true iff both are not empty.
> What does an empty rectangle in a path look like? The absence of another
> contour? A single moveTo point? A line? Would an empty path return true,
> and 0 rects?
>
> If the purpose of your thought-experiment is to avoid calling both
> isRect() and isNestedRects(), then perhaps it would make sense to
> include something like
>
> int SkPath::isRects(SkTDArray<**SkRect>& rectArray);
>
> that could return [0..n] for the number of rects in the path, and return
> -1 if the SkPath contains a contour which is not a rect.
>
>
> On 2012/11/15 20:10:54, reed1 wrote:
>
>> lgtm
>>
>
>  what happens if both or the inner rect is empty? I wonder what we
>>
> *want* to
>
>> happen in that case...?
>>
>
>  1. nothing, let the caller check
>> 2. return an int-count of the number of nested rects found [0..2], so
>>
> this guy
>
>> sort of subsumes isRect as well.
>>
>
>  Not meant to hold up checking this in, just thinking.
>>
>
>
>
>
https://codereview.appspot.**com/6850059/<https://codereview.appspot.com/6850...
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b