On 14 October 2016 at 18:12, Nikolay Sivov nsivov@codeweavers.com wrote:
- if (!pixel_size && size)
- {
texture_desc.Width = ceilf((size->width * parent_target->desc.dpiX) / 96.0f);
texture_desc.Height = ceilf((size->height * parent_target->desc.dpiY) / 96.0f);
dxgi_rt_desc.dpiX = (texture_desc.Width * 96.0f) / size->width;
dxgi_rt_desc.dpiY = (texture_desc.Height * 96.0f) / size->height;
- }
- else if (pixel_size && !size)
- {
texture_desc.Width = pixel_size->width;
texture_desc.Height = pixel_size->height;
dxgi_rt_desc.dpiX = parent_target->desc.dpiX;
dxgi_rt_desc.dpiY = parent_target->desc.dpiY;
- }
- else if (pixel_size && size)
- {
texture_desc.Width = pixel_size->width;
texture_desc.Height = pixel_size->height;
dxgi_rt_desc.dpiX = (pixel_size->width * 96.0f) / size->width;
dxgi_rt_desc.dpiY = (pixel_size->height * 96.0f) / size->height;
- }
- else
- {
texture_desc.Width = parent_target->pixel_size.width;
texture_desc.Height = parent_target->pixel_size.height;
dxgi_rt_desc.dpiX = parent_target->desc.dpiX;
dxgi_rt_desc.dpiY = parent_target->desc.dpiY;
- }
It may just be taste, but I think this is a bit harder to follow than it needs to be. What do you think about the following?
if (pixel_size) { texture_desc.Width = pixel_size->width; texture_desc.Height = pixel_size->height; } else if (size) { texture_desc.Width = ceilf((size->width * parent_target->desc.dpiX) / 96.0f); texture_desc.Height = ceilf((size->height * parent_target->desc.dpiY) / 96.0f); } else { texture_desc.Width = parent_target->pixel_size.width; texture_desc.Height = parent_target->pixel_size.height; }
if (size) { dxgi_rt_desc.dpiX = (texture_desc.Width * 96.0f) / size->width; dxgi_rt_desc.dpiY = (texture_desc.Height * 96.0f) / size->height; } else { dxgi_rt_desc.dpiX = parent_target->desc.dpiX; dxgi_rt_desc.dpiY = parent_target->desc.dpiY; }
On 10/19/2016 01:13 PM, Henri Verbeet wrote:
On 14 October 2016 at 18:12, Nikolay Sivov nsivov@codeweavers.com wrote:
- if (!pixel_size && size)
- {
texture_desc.Width = ceilf((size->width * parent_target->desc.dpiX) / 96.0f);
texture_desc.Height = ceilf((size->height * parent_target->desc.dpiY) / 96.0f);
dxgi_rt_desc.dpiX = (texture_desc.Width * 96.0f) / size->width;
dxgi_rt_desc.dpiY = (texture_desc.Height * 96.0f) / size->height;
- }
- else if (pixel_size && !size)
- {
texture_desc.Width = pixel_size->width;
texture_desc.Height = pixel_size->height;
dxgi_rt_desc.dpiX = parent_target->desc.dpiX;
dxgi_rt_desc.dpiY = parent_target->desc.dpiY;
- }
- else if (pixel_size && size)
- {
texture_desc.Width = pixel_size->width;
texture_desc.Height = pixel_size->height;
dxgi_rt_desc.dpiX = (pixel_size->width * 96.0f) / size->width;
dxgi_rt_desc.dpiY = (pixel_size->height * 96.0f) / size->height;
- }
- else
- {
texture_desc.Width = parent_target->pixel_size.width;
texture_desc.Height = parent_target->pixel_size.height;
dxgi_rt_desc.dpiX = parent_target->desc.dpiX;
dxgi_rt_desc.dpiY = parent_target->desc.dpiY;
- }
It may just be taste, but I think this is a bit harder to follow than it needs to be. What do you think about the following?
Sure, just sent v2. Initially I did it in the same orderit's documented.