mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 00:41:26 +12:00
rsx: Fix image scaling
- Specifically fixes a corner case where double transforms are required. Technically this can be made more readable using transformation matrices: * M1 = transform_virtual_to_physical() * M2 = transform_image_to_virtual() * M3 = M1 * M2 * Result = Input * M3 But we don't use a CPU-side matrix library and it is not reasonable to do this on the GPU.
This commit is contained in:
parent
c8d4a0dcdc
commit
22a7b026e7
5 changed files with 100 additions and 73 deletions
|
@ -623,14 +623,12 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
|
|||
QImage img(sshot_data_alpha.data(), sshot_width, sshot_height, sshot_width * 4, QImage::Format_RGBA8888);
|
||||
|
||||
// Scale image if necessary
|
||||
int new_width = img.width();
|
||||
int new_height = img.height();
|
||||
auto& avconf = g_fxo->get<rsx::avconf>();
|
||||
avconf.upscale_to_aspect_ratio(new_width, new_height);
|
||||
const auto& avconf = g_fxo->get<rsx::avconf>();
|
||||
auto new_size = avconf.aspect_convert_dimensions(size2u{ u32(img.width()), u32(img.height()) });
|
||||
|
||||
if (new_width != img.width() || new_height != img.height())
|
||||
if (new_size.width != img.width() || new_size.height != img.height())
|
||||
{
|
||||
img = img.scaled(QSize(new_width, new_height), Qt::AspectRatioMode::IgnoreAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
||||
img = img.scaled(QSize(new_size.width, new_size.height), Qt::AspectRatioMode::IgnoreAspectRatio, Qt::TransformationMode::SmoothTransformation);
|
||||
img.convertTo(QImage::Format_RGBA8888); // The current Qt version changes the image format during smooth scaling, so we have to change it back.
|
||||
}
|
||||
|
||||
|
@ -679,11 +677,9 @@ void gs_frame::take_screenshot(std::vector<u8> data, const u32 sshot_width, cons
|
|||
// We need to scale the overlay if our resolution scaling causes the image to have a different size.
|
||||
|
||||
// Scale the resolution first (as seen before with the image)
|
||||
new_width = avconf.resolution_x;
|
||||
new_height = avconf.resolution_y;
|
||||
avconf.upscale_to_aspect_ratio(new_width, new_height);
|
||||
new_size = avconf.aspect_convert_dimensions(size2u{ avconf.resolution_x, avconf.resolution_y });
|
||||
|
||||
if (new_width != img.width() || new_height != img.height())
|
||||
if (new_size.width != img.width() || new_size.height != img.height())
|
||||
{
|
||||
const int scale = rsx::get_resolution_scale_percent();
|
||||
const int x = (scale * manager.overlay_offset_x) / 100;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue