OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 2 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above | 8 * 1. Redistributions of source code must retain the above |
9 * copyright notice, this list of conditions and the following | 9 * copyright notice, this list of conditions and the following |
10 * disclaimer. | 10 * disclaimer. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 OwnPtr<RasterShapeIntervals> result = adoptPtr(new RasterShapeIntervals(marg
inIntervalsSize, std::max(shapeMargin, offset()))); | 79 OwnPtr<RasterShapeIntervals> result = adoptPtr(new RasterShapeIntervals(marg
inIntervalsSize, std::max(shapeMargin, offset()))); |
80 MarginIntervalGenerator marginIntervalGenerator(shapeMargin); | 80 MarginIntervalGenerator marginIntervalGenerator(shapeMargin); |
81 | 81 |
82 for (int y = bounds().y(); y < bounds().maxY(); ++y) { | 82 for (int y = bounds().y(); y < bounds().maxY(); ++y) { |
83 const IntShapeInterval& intervalAtY = intervalAt(y); | 83 const IntShapeInterval& intervalAtY = intervalAt(y); |
84 if (intervalAtY.isEmpty()) | 84 if (intervalAtY.isEmpty()) |
85 continue; | 85 continue; |
86 | 86 |
87 marginIntervalGenerator.set(y, intervalAtY); | 87 marginIntervalGenerator.set(y, intervalAtY); |
88 int marginY0 = std::max(minY(), y - shapeMargin); | 88 int marginY0 = std::max(minY(), y - shapeMargin); |
89 int marginY1 = std::min(maxY(), y + shapeMargin); | 89 int marginY1 = std::min(maxY(), y + shapeMargin + 1); |
90 | 90 |
91 for (int marginY = y - 1; marginY >= marginY0; --marginY) { | 91 for (int marginY = y - 1; marginY >= marginY0; --marginY) { |
92 if (marginY > bounds().y() && intervalAt(marginY).contains(intervalA
tY)) | 92 if (marginY > bounds().y() && intervalAt(marginY).contains(intervalA
tY)) |
93 break; | 93 break; |
94 result->intervalAt(marginY).unite(marginIntervalGenerator.intervalAt
(marginY)); | 94 result->intervalAt(marginY).unite(marginIntervalGenerator.intervalAt
(marginY)); |
95 } | 95 } |
96 | 96 |
97 result->intervalAt(y).unite(marginIntervalGenerator.intervalAt(y)); | 97 result->intervalAt(y).unite(marginIntervalGenerator.intervalAt(y)); |
98 | 98 |
99 for (int marginY = y + 1; marginY <= marginY1; ++marginY) { | 99 for (int marginY = y + 1; marginY < marginY1; ++marginY) { |
100 if (marginY < bounds().maxY() && intervalAt(marginY).contains(interv
alAtY)) | 100 if (marginY < bounds().maxY() && intervalAt(marginY).contains(interv
alAtY)) |
101 break; | 101 break; |
102 result->intervalAt(marginY).unite(marginIntervalGenerator.intervalAt
(marginY)); | 102 result->intervalAt(marginY).unite(marginIntervalGenerator.intervalAt
(marginY)); |
103 } | 103 } |
104 } | 104 } |
105 | 105 |
106 result->initializeBounds(); | 106 result->initializeBounds(); |
107 return result.release(); | 107 return result.release(); |
108 } | 108 } |
109 | 109 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 for (int y = y1; y < y2; y++) | 169 for (int y = y1; y < y2; y++) |
170 excludedInterval.unite(intervals.intervalAt(y)); | 170 excludedInterval.unite(intervals.intervalAt(y)); |
171 | 171 |
172 // Note: |marginIntervals()| returns end-point exclusive | 172 // Note: |marginIntervals()| returns end-point exclusive |
173 // intervals. |excludedInterval.x2()| contains the left-most pixel | 173 // intervals. |excludedInterval.x2()| contains the left-most pixel |
174 // offset to the right of the calculated union. | 174 // offset to the right of the calculated union. |
175 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2())); | 175 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2())); |
176 } | 176 } |
177 | 177 |
178 } // namespace WebCore | 178 } // namespace WebCore |
OLD | NEW |