FX_RECT CFX_FloatRect::GetClosestRect() const {
    CFX_FloatRect rect1 = *this;
    FX_RECT rect;
    _MatchFloatRange(rect1.left, rect1.right, rect.left, rect.right);
    _MatchFloatRange(rect1.bottom, rect1.top, rect.top, rect.bottom);
    rect.Normalize();
    return rect;
}
void FX_RECT::Union(const FX_RECT& other_rect) {
    Normalize();
    FX_RECT other = other_rect;
    other.Normalize();
    left = left < other.left ? left : other.left;
    right = right > other.right ? right : other.right;
    bottom = bottom > other.bottom ? bottom : other.bottom;
    top = top < other.top ? top : other.top;
}
FX_RECT CFX_FloatRect::GetInnerRect() const {
    CFX_FloatRect rect1 = *this;
    FX_RECT rect;
    rect.left = (int)FXSYS_ceil(rect1.left);
    rect.right = (int)FXSYS_floor(rect1.right);
    rect.top = (int)FXSYS_ceil(rect1.bottom);
    rect.bottom = (int)FXSYS_floor(rect1.top);
    rect.Normalize();
    return rect;
}
FX_RECT _FXDIB_SwapClipBox(FX_RECT& clip, int width, int height, FX_BOOL bFlipX, FX_BOOL bFlipY)
{
    FX_RECT rect;
    if (bFlipY) {
        rect.left = height - clip.top;
        rect.right = height - clip.bottom;
    } else {
        rect.left = clip.top;
        rect.right = clip.bottom;
    }
    if (bFlipX) {
        rect.top = width - clip.left;
        rect.bottom = width - clip.right;
    } else {
        rect.top = clip.left;
        rect.bottom = clip.right;
    }
    rect.Normalize();
    return rect;
}