Exemple #1
0
Mat3
SubRectMat3(const gfx::IntRect& subrect, const gfx::IntSize& size)
{
    return SubRectMat3(float(subrect.X()) / size.width,
                       float(subrect.Y()) / size.height,
                       float(subrect.Width()) / size.width,
                       float(subrect.Height()) / size.height);
}
Exemple #2
0
Mat3
SubRectMat3(const gfx::IntRect& bigSubrect, const gfx::IntSize& smallSize,
            const gfx::IntSize& divisors)
{
    const float x = float(bigSubrect.X()) / divisors.width;
    const float y = float(bigSubrect.Y()) / divisors.height;
    const float w = float(bigSubrect.Width()) / divisors.width;
    const float h = float(bigSubrect.Height()) / divisors.height;
    return SubRectMat3(x / smallSize.width,
                       y / smallSize.height,
                       w / smallSize.width,
                       h / smallSize.height);
}