| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 { | 111 { |
| 112 m_bounds = IntRect(); | 112 m_bounds = IntRect(); |
| 113 for (int y = minY(); y < maxY(); ++y) { | 113 for (int y = minY(); y < maxY(); ++y) { |
| 114 const IntShapeInterval& intervalAtY = intervalAt(y); | 114 const IntShapeInterval& intervalAtY = intervalAt(y); |
| 115 if (intervalAtY.isEmpty()) | 115 if (intervalAtY.isEmpty()) |
| 116 continue; | 116 continue; |
| 117 m_bounds.unite(IntRect(intervalAtY.x1(), y, intervalAtY.width(), 1)); | 117 m_bounds.unite(IntRect(intervalAtY.x1(), y, intervalAtY.width(), 1)); |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 void RasterShapeIntervals::buildBoundsPath(Path& path) const |
| 122 { |
| 123 int maxY = bounds().maxY(); |
| 124 for (int y = bounds().y(); y < maxY; y++) { |
| 125 if (intervalAt(y).isEmpty()) |
| 126 continue; |
| 127 |
| 128 IntShapeInterval extent = intervalAt(y); |
| 129 int endY = y + 1; |
| 130 for (; endY < maxY; endY++) { |
| 131 if (intervalAt(endY).isEmpty() || intervalAt(endY) != extent) |
| 132 break; |
| 133 } |
| 134 path.addRect(FloatRect(extent.x1(), y, extent.width(), endY - y)); |
| 135 y = endY - 1; |
| 136 } |
| 137 } |
| 138 |
| 121 const RasterShapeIntervals& RasterShape::marginIntervals() const | 139 const RasterShapeIntervals& RasterShape::marginIntervals() const |
| 122 { | 140 { |
| 123 ASSERT(shapeMargin() >= 0); | 141 ASSERT(shapeMargin() >= 0); |
| 124 if (!shapeMargin()) | 142 if (!shapeMargin()) |
| 125 return *m_intervals; | 143 return *m_intervals; |
| 126 | 144 |
| 127 int shapeMarginInt = clampToPositiveInteger(ceil(shapeMargin())); | 145 int shapeMarginInt = clampToPositiveInteger(ceil(shapeMargin())); |
| 128 int maxShapeMarginInt = std::max(m_marginRectSize.width(), m_marginRectSize.
height()) * sqrtf(2); | 146 int maxShapeMarginInt = std::max(m_marginRectSize.width(), m_marginRectSize.
height()) * sqrtf(2); |
| 129 if (!m_marginIntervals) | 147 if (!m_marginIntervals) |
| 130 m_marginIntervals = m_intervals->computeShapeMarginIntervals(std::min(sh
apeMarginInt, maxShapeMarginInt)); | 148 m_marginIntervals = m_intervals->computeShapeMarginIntervals(std::min(sh
apeMarginInt, maxShapeMarginInt)); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 151 for (int y = y1; y < y2; y++) | 169 for (int y = y1; y < y2; y++) |
| 152 excludedInterval.unite(intervals.intervalAt(y)); | 170 excludedInterval.unite(intervals.intervalAt(y)); |
| 153 | 171 |
| 154 // Note: |marginIntervals()| returns end-point exclusive | 172 // Note: |marginIntervals()| returns end-point exclusive |
| 155 // intervals. |excludedInterval.x2()| contains the left-most pixel | 173 // intervals. |excludedInterval.x2()| contains the left-most pixel |
| 156 // offset to the right of the calculated union. | 174 // offset to the right of the calculated union. |
| 157 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2())); | 175 result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2())); |
| 158 } | 176 } |
| 159 | 177 |
| 160 } // namespace WebCore | 178 } // namespace WebCore |
| OLD | NEW |