Exemple #1
0
static mozilla::gfx::IntRect
TransformRect(const mozilla::gfx::IntRect& aRect, const mozilla::gfx::Matrix4x4& aTransform)
{
    if (aRect.IsEmpty()) {
        return mozilla::gfx::IntRect();
    }

    mozilla::gfx::RectDouble rect(aRect.x, aRect.y, aRect.width, aRect.height);
    rect = aTransform.TransformAndClipBounds(rect, mozilla::gfx::RectDouble::MaxIntRect());
    rect.RoundOut();

    mozilla::gfx::IntRect intRect;
    if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) {
        return mozilla::gfx::IntRect();
    }

    return intRect;
}
Exemple #2
0
static mozilla::gfx::IntRect
TransformRect(const mozilla::gfx::IntRect& aRect, const gfx3DMatrix& aTransform)
{
    if (aRect.IsEmpty()) {
        return mozilla::gfx::IntRect();
    }

    gfxRect rect(aRect.x, aRect.y, aRect.width, aRect.height);
    rect = aTransform.TransformBounds(rect);
    rect.RoundOut();

    mozilla::gfx::IntRect intRect;
    if (!gfxUtils::GfxRectToIntRect(rect, &intRect)) {
        return mozilla::gfx::IntRect();
    }

    return intRect;
}