Ejemplo n.º 1
0
IntRect TilingData::overlappedTileIndices(const WebCore::IntRect &srcRect) const
{
    int x = tileXIndexFromSrcCoord(srcRect.x());
    int y = tileYIndexFromSrcCoord(srcRect.y());
    int r = tileXIndexFromSrcCoord(srcRect.maxX());
    int b = tileYIndexFromSrcCoord(srcRect.maxY());
    return IntRect(x, y, r - x, b - y);
}
Ejemplo n.º 2
0
// Returns two point ranges (<left, width> pairs) at row 'canvasY', that belong to 'src' but not 'dst'.
// A point range is empty if the corresponding width is 0.
inline void findBlendRangeAtRow(const WebCore::IntRect& src, const WebCore::IntRect& dst, int canvasY, int& left1, int& width1, int& left2, int& width2)
{
    ASSERT_WITH_SECURITY_IMPLICATION(canvasY >= src.y() && canvasY < src.maxY());
    left1 = -1;
    width1 = 0;
    left2 = -1;
    width2 = 0;

    if (canvasY < dst.y() || canvasY >= dst.maxY() || src.x() >= dst.maxX() || src.maxX() <= dst.x()) {
        left1 = src.x();
        width1 = src.width();
        return;
    }

    if (src.x() < dst.x()) {
        left1 = src.x();
        width1 = dst.x() - src.x();
    }

    if (src.maxX() > dst.maxX()) {
        left2 = dst.maxX();
        width2 = src.maxX() - dst.maxX();
    }
}