| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 | 150 |
| 151 return *m_marginIntervals; | 151 return *m_marginIntervals; |
| 152 } | 152 } |
| 153 | 153 |
| 154 LineSegment RasterShape::getExcludedInterval(LayoutUnit logicalTop, LayoutUnit l
ogicalHeight) const | 154 LineSegment RasterShape::getExcludedInterval(LayoutUnit logicalTop, LayoutUnit l
ogicalHeight) const |
| 155 { | 155 { |
| 156 const RasterShapeIntervals& intervals = marginIntervals(); | 156 const RasterShapeIntervals& intervals = marginIntervals(); |
| 157 if (intervals.isEmpty()) | 157 if (intervals.isEmpty()) |
| 158 return LineSegment(); | 158 return LineSegment(); |
| 159 | 159 |
| 160 int y1 = logicalTop; | 160 int y1 = logicalTop.toInt(); |
| 161 int y2 = logicalTop + logicalHeight; | 161 int y2 = (logicalTop + logicalHeight).toInt(); |
| 162 ASSERT(y2 >= y1); | 162 ASSERT(y2 >= y1); |
| 163 if (y2 < intervals.bounds().y() || y1 >= intervals.bounds().maxY()) | 163 if (y2 < intervals.bounds().y() || y1 >= intervals.bounds().maxY()) |
| 164 return LineSegment(); | 164 return LineSegment(); |
| 165 | 165 |
| 166 y1 = std::max(y1, intervals.bounds().y()); | 166 y1 = std::max(y1, intervals.bounds().y()); |
| 167 y2 = std::min(y2, intervals.bounds().maxY()); | 167 y2 = std::min(y2, intervals.bounds().maxY()); |
| 168 IntShapeInterval excludedInterval; | 168 IntShapeInterval excludedInterval; |
| 169 | 169 |
| 170 if (y1 == y2) { | 170 if (y1 == y2) { |
| 171 excludedInterval = intervals.intervalAt(y1); | 171 excludedInterval = intervals.intervalAt(y1); |
| 172 } else { | 172 } else { |
| 173 for (int y = y1; y < y2; y++) | 173 for (int y = y1; y < y2; y++) |
| 174 excludedInterval.unite(intervals.intervalAt(y)); | 174 excludedInterval.unite(intervals.intervalAt(y)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Note: |marginIntervals()| returns end-point exclusive | 177 // Note: |marginIntervals()| returns end-point exclusive |
| 178 // intervals. |excludedInterval.x2()| contains the left-most pixel | 178 // intervals. |excludedInterval.x2()| contains the left-most pixel |
| 179 // offset to the right of the calculated union. | 179 // offset to the right of the calculated union. |
| 180 return LineSegment(excludedInterval.x1(), excludedInterval.x2()); | 180 return LineSegment(excludedInterval.x1(), excludedInterval.x2()); |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |