Exemple #1
0
void ExclusionPolygon::getIncludedIntervals(float logicalTop, float logicalHeight, SegmentList& result) const
{
    if (isEmpty())
        return;

    float y1 = minYForLogicalLine(logicalTop, logicalHeight);
    float y2 = maxYForLogicalLine(logicalTop, logicalHeight);

    Vector<ExclusionInterval> y1XIntervals, y2XIntervals;
    computeXIntersections(y1, true, y1XIntervals);
    computeXIntersections(y2, false, y2XIntervals);

    Vector<ExclusionInterval> commonIntervals;
    intersectExclusionIntervals(y1XIntervals, y2XIntervals, commonIntervals);

    Vector<ExclusionInterval> edgeIntervals;
    computeEdgeIntersections(y1, y2, edgeIntervals);

    Vector<ExclusionInterval> includedIntervals;
    subtractExclusionIntervals(commonIntervals, edgeIntervals, includedIntervals);

    for (unsigned i = 0; i < includedIntervals.size(); i++) {
        ExclusionInterval interval = includedIntervals[i];
        result.append(LineSegment(interval.x1, interval.x2));
    }
}
void ExclusionRectangle::getExcludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
    float y1 = minYForLogicalLine(logicalTop, logicalBottom);
    float y2 = maxYForLogicalLine(logicalTop, logicalBottom);

    if (y2 < m_y || y1 >= m_y + m_height)
        return;

    float x1 = m_x;
    float x2 = m_x + m_width;

    if (m_ry > 0) {
        if (y2 < m_y + m_ry) {
            float yi = y2 - m_y - m_ry;
            float xi = ellipseXIntercept(yi, m_rx, m_ry);
            x1 = m_x + m_rx - xi;
            x2 = m_x + m_width - m_rx + xi;
        } else if (y1 > m_y + m_height - m_ry) {
            float yi =  y1 - (m_y + m_height - m_ry);
            float xi = ellipseXIntercept(yi, m_rx, m_ry);
            x1 = m_x + m_rx - xi;
            x2 = m_x + m_width - m_rx + xi;
        }
    }

    result.append(LineSegment(x1, x2));
}
Exemple #3
0
bool ExclusionPolygon::firstIncludedIntervalLogicalTop(float minLogicalIntervalTop, const FloatSize& minLogicalIntervalSize, float& result) const
{
    // FIXME: This is just a temporary stub, https://bugs.webkit.org/show_bug.cgi?id=103429

    if (minLogicalIntervalSize.width() > m_boundingBox.width())
        return false;

    float minY = minYForLogicalLine(minLogicalIntervalTop, minLogicalIntervalSize.height());
    float maxY = maxYForLogicalLine(minLogicalIntervalTop, minLogicalIntervalSize.height());
    if (minY < m_boundingBox.y() || maxY > m_boundingBox.maxY())
        return false;

    result = minLogicalIntervalTop;
    return true;
}
void ExclusionRectangle::getIncludedIntervals(float logicalTop, float logicalBottom, SegmentList& result) const
{
    float y1 = minYForLogicalLine(logicalTop, logicalBottom);
    float y2 = maxYForLogicalLine(logicalTop, logicalBottom);

    if (y1 < m_y || y2 > m_y + m_height)
        return;

    float x1 = m_x;
    float x2 = m_x + m_width;

    if (m_ry > 0) {
        bool y1InterceptsCorner = y1 < m_y + m_ry;
        bool y2InterceptsCorner = y2 > m_y + m_height - m_ry;
        float xi = 0;

        if (y1InterceptsCorner && y2InterceptsCorner) {
            if  (y1 < m_height + 2*m_y - y2) {
                float yi = y1 - m_y - m_ry;
                xi = ellipseXIntercept(yi, m_rx, m_ry);
            } else {
                float yi =  y2 - (m_y + m_height - m_ry);
                xi = ellipseXIntercept(yi, m_rx, m_ry);
            }
        } else if (y1InterceptsCorner) {
            float yi = y1 - m_y - m_ry;
            xi = ellipseXIntercept(yi, m_rx, m_ry);
        } else if (y2InterceptsCorner) {
            float yi =  y2 - (m_y + m_height - m_ry);
            xi = ellipseXIntercept(yi, m_rx, m_ry);
        }

        if (y1InterceptsCorner || y2InterceptsCorner) {
            x1 = m_x + m_rx - xi;
            x2 = m_x + m_width - m_rx + xi;
        }
    }

    result.append(LineSegment(x1, x2));
}