Bug 52255 - Add a Region class which represents a graphical region
Summary: Add a Region class which represents a graphical region
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Anders Carlsson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-11 15:08 PST by Anders Carlsson
Modified: 2011-01-11 15:40 PST (History)
1 user (show)

See Also:


Attachments
Patch (23.30 KB, patch)
2011-01-11 15:14 PST, Anders Carlsson
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anders Carlsson 2011-01-11 15:08:31 PST
Add a Region class which represents a graphical region
Comment 1 Anders Carlsson 2011-01-11 15:14:34 PST
Created attachment 78607 [details]
Patch
Comment 2 WebKit Review Bot 2011-01-11 15:16:24 PST
Attachment 78607 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'WebKit2/ChangeLog', u'WebKit2/Platform/Reg..." exit_code: 1
WebKit2/Platform/Region.cpp:124:  Region::Shape::spans_begin is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.cpp:129:  Region::Shape::spans_end is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.cpp:134:  Region::Shape::segments_begin is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.cpp:146:  Region::Shape::segments_end is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.h:76:  spans_begin is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.h:77:  spans_end is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.h:80:  segments_begin is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
WebKit2/Platform/Region.h:81:  segments_end is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 8 in 4 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Sam Weinig 2011-01-11 15:35:08 PST
Comment on attachment 78607 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=78607&action=review

We should consider moving this to WebCore at some point.

> WebKit2/Platform/Region.cpp:131
> +    return m_spans.data() + m_spans.size();

This could be m_spans.end(). Same with begin.

> WebKit2/Platform/Region.cpp:137
> +    assert(it >= m_spans.data());
> +    assert(it < m_spans.data() + m_spans.size());

Wrong assert style.

> WebKit2/Platform/Region.cpp:149


Also wrong assert.

> WebKit2/Platform/Region.cpp:155
> +    assert(it + 1 < m_spans.data() + m_spans.size());

Wrong assert.

> WebKit2/Platform/Region.cpp:170
> +void Region::Shape::dump() const
> +{
> +    for (Shape::SpanIterator span = spans_begin(), end = spans_end(); span != end; ++span) {
> +        printf("%6d: (", span->y);
> +        for (Shape::SegmentIterator segment = segments_begin(span), end = segments_end(span); segment != end; ++segment)
> +            printf("%d ", *segment);
> +        printf(")\n");
> +    }
> +
> +    printf("\n");
> +}

This should be debug only.

> WebKit2/Platform/Region.cpp:191
> +            assert(firstSegment != lastSegment);

Wrong assert style.

> WebKit2/Platform/Region.cpp:204
> +    assert(minX <= maxX);
> +    assert(minY <= maxY);

Wrong assert style.

> WebKit2/Platform/Region.cpp:226
> +enum {
> +    Shape1,
> +    Shape2,
> +};

These are dead code.

> WebKit2/Platform/Region.cpp:231
> +    // FIXME: These should be static asserts.

THEY ARE!

> WebKit2/Platform/Region.cpp:251
> +    SegmentIterator segments2 = 0;
> +    SegmentIterator segments2End = 0;
> +
> +    

Extra new line.

> WebKit2/Platform/Region.cpp:278
> +        std::vector<int> segments;

Please use WTF::Vector instead.

> WebKit2/Platform/Region.cpp:392
> +    static const int opCode = 1;

This makes me sad. Name it!
Comment 4 Anders Carlsson 2011-01-11 15:40:34 PST
Committed r75562: <http://trac.webkit.org/changeset/75562>