Changeset 106408 in webkit


Ignore:
Timestamp:
Jan 31, 2012 3:36:06 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Add contains() test to Region
https://bugs.webkit.org/show_bug.cgi?id=72294

Patch by Dana Jansens <danakj@chromium.org> on 2012-01-31
Reviewed by Anders Carlsson.

  • platform/graphics/Region.cpp:

(WebCore::Region::contains):
(WebCore):

  • platform/graphics/Region.h:

(Region):
(Shape):
(WebCore::operator==):
(WebCore):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106406 r106408  
     12012-01-31  Dana Jansens  <danakj@chromium.org>
     2
     3        Add contains() test to Region
     4        https://bugs.webkit.org/show_bug.cgi?id=72294
     5
     6        Reviewed by Anders Carlsson.
     7
     8        * platform/graphics/Region.cpp:
     9        (WebCore::Region::contains):
     10        (WebCore):
     11        * platform/graphics/Region.h:
     12        (Region):
     13        (Shape):
     14        (WebCore::operator==):
     15        (WebCore):
     16
    1172012-01-31  Sami Kyostila  <skyostil@chromium.org>
    218
  • trunk/Source/WebCore/platform/graphics/Region.cpp

    r95901 r106408  
    6666}
    6767
     68bool Region::contains(const Region& region) const
     69{
     70    return WebCore::intersect(region, *this) == region;
     71}
     72
    6873Region::Shape::Shape()
    6974{
  • trunk/Source/WebCore/platform/graphics/Region.h

    r95901 r106408  
    4747
    4848    void translate(const IntSize&);
     49
     50    // Returns true if the query region is a subset of this region.
     51    bool contains(const Region&) const;
    4952
    5053#ifndef NDEBUG
     
    105108        bool canCoalesce(SegmentIterator begin, SegmentIterator end);
    106109
    107         // FIXME: These vectors should have inline sizes. Figure out a good optimal value.
    108         Vector<int> m_segments;
    109         Vector<Span> m_spans;       
     110        Vector<int, 32> m_segments;
     111        Vector<Span, 16> m_spans;
     112
     113        friend bool operator==(const Shape&, const Shape&);
    110114    };
    111115
    112116    IntRect m_bounds;
    113117    Shape m_shape;
     118
     119    friend bool operator==(const Region&, const Region&);
     120    friend bool operator==(const Shape&, const Shape&);
     121    friend bool operator==(const Span&, const Span&);
    114122};
    115123
     
    138146}
    139147
     148inline bool operator==(const Region& a, const Region& b)
     149{
     150    return a.m_bounds == b.m_bounds && a.m_shape == b.m_shape;
     151}
     152
     153inline bool operator==(const Region::Shape& a, const Region::Shape& b)
     154{
     155    return a.m_spans == b.m_spans && a.m_segments == b.m_segments;
     156}
     157
     158inline bool operator==(const Region::Span& a, const Region::Span& b)
     159{
     160    return a.y == b.y && a.segmentIndex == b.segmentIndex;
     161}
     162
    140163} // namespace WebCore
    141164
Note: See TracChangeset for help on using the changeset viewer.