Example #1
0
//----------------------------------------------------------------------------//
void Image::updateScaledSize(const Sizef& renderer_display_size)
{
    glm::vec2 scaleFactors;

    computeScalingFactors(d_autoScaled, renderer_display_size, d_nativeResolution,
        scaleFactors.x, scaleFactors.y);

    d_scaledSize = d_imageArea.getSize() * scaleFactors;
}
Example #2
0
//----------------------------------------------------------------------------//
void Image::updateScaledOffset(const Sizef& renderer_display_size)
{
    glm::vec2 scaleFactors;

    computeScalingFactors(d_autoScaled, renderer_display_size, d_nativeResolution,
        scaleFactors.x, scaleFactors.y);

    d_scaledOffset = d_pixelOffset * scaleFactors;
}
Example #3
0
//----------------------------------------------------------------------------//
void BasicImage::notifyDisplaySizeChanged(const Sizef& size)
{
    // TODO: This could be cleaned up by adding some more operators to
    // Sizef and Vector2f

    float x_scale;
    float y_scale;

    computeScalingFactors(d_autoScaled, size, d_nativeResolution,
                          x_scale, y_scale);

    d_scaledSize.d_width = d_pixelSize.d_width * x_scale;
    d_scaledSize.d_height = d_pixelSize.d_height * y_scale;
    d_scaledOffset.d_x = d_pixelOffset.d_x * x_scale;
    d_scaledOffset.d_y = d_pixelOffset.d_y * y_scale;
}