Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test image scale support. #519

Merged
merged 3 commits into from
Jun 23, 2022
Merged

Conversation

xStrom
Copy link
Member

@xStrom xStrom commented Jun 22, 2022

The current test image code has a constant size which is hardcoded to expect a scale factor of 2.0.

This PR changes the test image code to specify the logical size that the code actually uses, and then the platform code that actually generates the image and chooses the scale factor will also choose the proper image size.

Results remain unchanged for the scale factor of 2.0 but this reduces confusion and helps enable a future potential of doing snapshot testing with multiple different scale factors.

@xStrom xStrom added maintenance cleanup and refactoring blocked labels Jun 22, 2022
@xStrom
Copy link
Member Author

xStrom commented Jun 22, 2022

Some test images have even more hardcoded 2.0 expectations. I'll need to address those as well.

@xStrom xStrom removed the blocked label Jun 22, 2022
@xStrom
Copy link
Member Author

xStrom commented Jun 22, 2022

Okay, I think I managed to remove the last bits of hardcoded scale calculations.

Copy link
Member

@cmyr cmyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, happy to have this be a bit more coherent. There's no good explanation behind the original approach, it was basically carried forward from the very first sample code in raph's first cut of piet, uh, several years ago. 😬

@xStrom xStrom merged commit 25ae6b0 into linebender:master Jun 23, 2022
@xStrom xStrom deleted the test-scale branch June 23, 2022 14:13
x3ro pushed a commit to x3ro/piet that referenced this pull request Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance cleanup and refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants