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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 : m_xIntercepts[xInterceptsIndex]; | 70 : m_xIntercepts[xInterceptsIndex]; |
71 return IntShapeInterval(m_x1 - dx, m_x2 + dx); | 71 return IntShapeInterval(m_x1 - dx, m_x2 + dx); |
72 } | 72 } |
73 | 73 |
74 std::unique_ptr<RasterShapeIntervals> | 74 std::unique_ptr<RasterShapeIntervals> |
75 RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const { | 75 RasterShapeIntervals::computeShapeMarginIntervals(int shapeMargin) const { |
76 int marginIntervalsSize = (offset() > shapeMargin) | 76 int marginIntervalsSize = (offset() > shapeMargin) |
77 ? size() | 77 ? size() |
78 : size() - offset() * 2 + shapeMargin * 2; | 78 : size() - offset() * 2 + shapeMargin * 2; |
79 std::unique_ptr<RasterShapeIntervals> result = | 79 std::unique_ptr<RasterShapeIntervals> result = |
80 wrapUnique(new RasterShapeIntervals(marginIntervalsSize, | 80 WTF::wrapUnique(new RasterShapeIntervals( |
81 std::max(shapeMargin, offset()))); | 81 marginIntervalsSize, std::max(shapeMargin, offset()))); |
82 MarginIntervalGenerator marginIntervalGenerator(shapeMargin); | 82 MarginIntervalGenerator marginIntervalGenerator(shapeMargin); |
83 | 83 |
84 for (int y = bounds().y(); y < bounds().maxY(); ++y) { | 84 for (int y = bounds().y(); y < bounds().maxY(); ++y) { |
85 const IntShapeInterval& intervalAtY = intervalAt(y); | 85 const IntShapeInterval& intervalAtY = intervalAt(y); |
86 if (intervalAtY.isEmpty()) | 86 if (intervalAtY.isEmpty()) |
87 continue; | 87 continue; |
88 | 88 |
89 marginIntervalGenerator.set(y, intervalAtY); | 89 marginIntervalGenerator.set(y, intervalAtY); |
90 int marginY0 = std::max(minY(), y - shapeMargin); | 90 int marginY0 = std::max(minY(), y - shapeMargin); |
91 int marginY1 = std::min(maxY(), y + shapeMargin + 1); | 91 int marginY1 = std::min(maxY(), y + shapeMargin + 1); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 excludedInterval.unite(intervals.intervalAt(y)); | 177 excludedInterval.unite(intervals.intervalAt(y)); |
178 } | 178 } |
179 | 179 |
180 // Note: |marginIntervals()| returns end-point exclusive | 180 // Note: |marginIntervals()| returns end-point exclusive |
181 // intervals. |excludedInterval.x2()| contains the left-most pixel | 181 // intervals. |excludedInterval.x2()| contains the left-most pixel |
182 // offset to the right of the calculated union. | 182 // offset to the right of the calculated union. |
183 return LineSegment(excludedInterval.x1(), excludedInterval.x2()); | 183 return LineSegment(excludedInterval.x1(), excludedInterval.x2()); |
184 } | 184 } |
185 | 185 |
186 } // namespace blink | 186 } // namespace blink |
OLD | NEW |