Modified: branches/subpixellayout/Source/WebCore/platform/graphics/Region.cpp (98647 => 98648)
--- branches/subpixellayout/Source/WebCore/platform/graphics/Region.cpp 2011-10-27 22:19:14 UTC (rev 98647)
+++ branches/subpixellayout/Source/WebCore/platform/graphics/Region.cpp 2011-10-27 22:25:24 UTC (rev 98648)
@@ -40,25 +40,25 @@
{
}
-Region::Region(const IntRect& rect)
+Region::Region(const LayoutRect& rect)
: m_bounds(rect)
, m_shape(rect)
{
}
-Vector<IntRect> Region::rects() const
+Vector<LayoutRect> Region::rects() const
{
- Vector<IntRect> rects;
+ Vector<LayoutRect> rects;
for (Shape::SpanIterator span = m_shape.spans_begin(), end = m_shape.spans_end(); span != end && span + 1 != end; ++span) {
- int y = span->y;
- int height = (span + 1)->y - y;
+ LayoutUnit y = span->y;
+ LayoutUnit height = (span + 1)->y - y;
for (Shape::SegmentIterator segment = m_shape.segments_begin(span), end = m_shape.segments_end(span); segment != end && segment + 1 != end; segment += 2) {
- int x = *segment;
- int width = *(segment + 1) - x;
+ LayoutUnit x = *segment;
+ LayoutUnit width = *(segment + 1) - x;
- rects.append(IntRect(x, y, width, height));
+ rects.append(LayoutRect(x, y, width, height));
}
}
@@ -69,7 +69,7 @@
{
}
-Region::Shape::Shape(const IntRect& rect)
+Region::Shape::Shape(const LayoutRect& rect)
{
appendSpan(rect.y());
appendSegment(rect.x());
@@ -77,7 +77,7 @@
appendSpan(rect.maxY());
}
-void Region::Shape::appendSpan(int y)
+void Region::Shape::appendSpan(LayoutUnit y)
{
m_spans.append(Span(y, m_segments.size()));
}
@@ -102,7 +102,7 @@
return true;
}
-void Region::Shape::appendSpan(int y, SegmentIterator begin, SegmentIterator end)
+void Region::Shape::appendSpan(LayoutUnit y, SegmentIterator begin, SegmentIterator end)
{
if (canCoalesce(begin, end))
return;
@@ -117,7 +117,7 @@
appendSpan(it->y, shape.segments_begin(it), shape.segments_end(it));
}
-void Region::Shape::appendSegment(int x)
+void Region::Shape::appendSegment(LayoutUnit x)
{
m_segments.append(x);
}
@@ -164,10 +164,10 @@
void Region::Shape::dump() const
{
for (Shape::SpanIterator span = spans_begin(), end = spans_end(); span != end; ++span) {
- printf("%6d: (", span->y);
+ printf("%6d: (", span->y.toInt());
for (Shape::SegmentIterator segment = segments_begin(span), end = segments_end(span); segment != end; ++segment)
- printf("%d ", *segment);
+ printf("%d ", segment->toInt());
printf(")\n");
}
@@ -175,19 +175,19 @@
}
#endif
-IntRect Region::Shape::bounds() const
+LayoutRect Region::Shape::bounds() const
{
if (isEmpty())
- return IntRect();
+ return LayoutRect();
SpanIterator span = spans_begin();
- int minY = span->y;
+ LayoutUnit minY = span->y;
SpanIterator lastSpan = spans_end() - 1;
- int maxY = lastSpan->y;
+ LayoutUnit maxY = lastSpan->y;
- int minX = std::numeric_limits<int>::max();
- int maxX = std::numeric_limits<int>::min();
+ LayoutUnit minX = std::numeric_limits<LayoutUnit>::max();
+ LayoutUnit maxX = std::numeric_limits<LayoutUnit>::min();
while (span != lastSpan) {
SegmentIterator firstSegment = segments_begin(span);
@@ -209,10 +209,10 @@
ASSERT(minX <= maxX);
ASSERT(minY <= maxY);
- return IntRect(minX, minY, maxX - minX, maxY - minY);
+ return LayoutRect(minX, minY, maxX - minX, maxY - minY);
}
-void Region::Shape::translate(const IntSize& offset)
+void Region::Shape::translate(const LayoutSize& offset)
{
for (size_t i = 0; i < m_segments.size(); ++i)
m_segments[i] += offset.width();
@@ -255,8 +255,8 @@
// Iterate over all spans.
while (spans1 != spans1End && spans2 != spans2End) {
- int y = 0;
- int test = spans1->y - spans2->y;
+ LayoutUnit y = 0;
+ LayoutUnit test = spans1->y - spans2->y;
if (test <= 0) {
y = spans1->y;
@@ -279,12 +279,12 @@
SegmentIterator s1 = segments1;
SegmentIterator s2 = segments2;
- Vector<int> segments;
+ Vector<LayoutUnit> segments;
// Now iterate over the segments in each span and construct a new vector of segments.
while (s1 != segments1End && s2 != segments2End) {
- int test = *s1 - *s2;
- int x;
+ LayoutUnit test = *s1 - *s2;
+ LayoutUnit x;
if (test <= 0) {
x = *s1;
@@ -410,7 +410,7 @@
void Region::dump() const
{
printf("Bounds: (%d, %d, %d, %d)\n",
- m_bounds.x(), m_bounds.y(), m_bounds.width(), m_bounds.height());
+ m_bounds.x().toInt(), m_bounds.y().toInt(), m_bounds.width().toInt(), m_bounds.height().toInt());
m_shape.dump();
}
#endif
@@ -419,7 +419,7 @@
{
if (!m_bounds.intersects(region.m_bounds)) {
m_shape = Shape();
- m_bounds = IntRect();
+ m_bounds = LayoutRect();
return;
}
@@ -445,7 +445,7 @@
m_bounds = m_shape.bounds();
}
-void Region::translate(const IntSize& offset)
+void Region::translate(const LayoutSize& offset)
{
m_bounds.move(offset);
m_shape.translate(offset);
Modified: branches/subpixellayout/Source/WebCore/platform/graphics/Region.h (98647 => 98648)
--- branches/subpixellayout/Source/WebCore/platform/graphics/Region.h 2011-10-27 22:19:14 UTC (rev 98647)
+++ branches/subpixellayout/Source/WebCore/platform/graphics/Region.h 2011-10-27 22:25:24 UTC (rev 98648)
@@ -26,7 +26,7 @@
#ifndef Region_h
#define Region_h
-#include "IntRect.h"
+#include "LayoutTypes.h"
#include <wtf/Vector.h>
namespace WebCore {
@@ -34,18 +34,18 @@
class Region {
public:
Region();
- Region(const IntRect&);
+ Region(const LayoutRect&);
- IntRect bounds() const { return m_bounds; }
+ LayoutRect bounds() const { return m_bounds; }
bool isEmpty() const { return m_bounds.isEmpty(); }
- Vector<IntRect> rects() const;
+ Vector<LayoutRect> rects() const;
void unite(const Region&);
void intersect(const Region&);
void subtract(const Region&);
- void translate(const IntSize&);
+ void translate(const LayoutSize&);
#ifndef NDEBUG
void dump() const;
@@ -53,28 +53,28 @@
private:
struct Span {
- Span(int y, size_t segmentIndex)
+ Span(LayoutUnit y, size_t segmentIndex)
: y(y), segmentIndex(segmentIndex)
{
}
- int y;
+ LayoutUnit y;
size_t segmentIndex;
};
class Shape {
public:
Shape();
- Shape(const IntRect&);
+ Shape(const LayoutRect&);
- IntRect bounds() const;
+ LayoutRect bounds() const;
bool isEmpty() const { return m_spans.isEmpty(); }
typedef const Span* SpanIterator;
SpanIterator spans_begin() const;
SpanIterator spans_end() const;
- typedef const int* SegmentIterator;
+ typedef const LayoutUnit* SegmentIterator;
SegmentIterator segments_begin(SpanIterator) const;
SegmentIterator segments_end(SpanIterator) const;
@@ -82,7 +82,7 @@
static Shape intersectShapes(const Shape& shape1, const Shape& shape2);
static Shape subtractShapes(const Shape& shape1, const Shape& shape2);
- void translate(const IntSize&);
+ void translate(const LayoutSize&);
void swap(Shape&);
#ifndef NDEBUG
@@ -97,19 +97,19 @@
template<typename Operation>
static Shape shapeOperation(const Shape& shape1, const Shape& shape2);
- void appendSegment(int x);
- void appendSpan(int y);
- void appendSpan(int y, SegmentIterator begin, SegmentIterator end);
+ void appendSegment(LayoutUnit x);
+ void appendSpan(LayoutUnit y);
+ void appendSpan(LayoutUnit y, SegmentIterator begin, SegmentIterator end);
void appendSpans(const Shape&, SpanIterator begin, SpanIterator end);
bool canCoalesce(SegmentIterator begin, SegmentIterator end);
// FIXME: These vectors should have inline sizes. Figure out a good optimal value.
- Vector<int> m_segments;
+ Vector<LayoutUnit> m_segments;
Vector<Span> m_spans;
};
- IntRect m_bounds;
+ LayoutRect m_bounds;
Shape m_shape;
};
@@ -129,7 +129,7 @@
return result;
}
-static inline Region translate(const Region& region, const IntSize& offset)
+static inline Region translate(const Region& region, const LayoutSize& offset)
{
Region result(region);
result.translate(offset);