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

Add Image::fill_rect method #52456

Merged
merged 2 commits into from
Nov 24, 2021
Merged

Conversation

kleonc
Copy link
Member

@kleonc kleonc commented Sep 7, 2021

Resolves godotengine/godot-proposals#3259.

Made the p_rect parameter Rect2 instead of Rect2i to make it consistent with other Image's methods like blit_rect(), blend_rect() etc. (if changing Rect2 to Rect2i is wanted it can be made in a separate PR).

@kleonc kleonc requested a review from a team as a code owner September 7, 2021 08:40
@kleonc kleonc force-pushed the image-fill-rect branch 2 times, most recently from 7f6d7d3 to 905567a Compare September 7, 2021 09:20
@kleonc kleonc requested a review from a team as a code owner September 7, 2021 09:20
core/io/image.cpp Outdated Show resolved Hide resolved
core/io/image.cpp Outdated Show resolved Hide resolved
doc/classes/Image.xml Outdated Show resolved Hide resolved
core/io/image.cpp Outdated Show resolved Hide resolved
@kleonc
Copy link
Member Author

kleonc commented Sep 8, 2021

I've added a second commit changing these methods to use memcpy(), as @LightningAA suggested. Didn't squash it for now for easier comparison or in case such change is not wanted.

Copy link
Contributor

@AaronRecord AaronRecord left a comment

Choose a reason for hiding this comment

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

Looks pretty good to me, just one knit pick.

core/io/image.cpp Outdated Show resolved Hide resolved
core/io/image.cpp Outdated Show resolved Hide resolved
Copy link
Contributor

@AaronRecord AaronRecord left a comment

Choose a reason for hiding this comment

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

Tested using the 3.x version (my computer doesn't support vulkan), everything seemed to work fine, no obvious regressions. Looks good to me 😃

Copy link
Contributor

@AaronRecord AaronRecord left a comment

Choose a reason for hiding this comment

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

Actually, just remembered one more small thing (sorry), it might be a good idea to add some tests for fill_rect(...) in tests/test_image.h. There's already a test for fill(...)

@kleonc
Copy link
Member Author

kleonc commented Sep 10, 2021

Actually, just remembered one more small thing (sorry), it might be a good idea to add some tests for fill_rect(...) in tests/test_image.h. There's already a test for fill(...)

Done.

tests/test_image.h Outdated Show resolved Hide resolved
@akien-mga
Copy link
Member

Needs a rebase.

@akien-mga akien-mga merged commit b1bf82d into godotengine:master Nov 24, 2021
@akien-mga
Copy link
Member

Thanks!

@kleonc kleonc deleted the image-fill-rect branch November 24, 2021 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add fill_rect() method to Image class
4 participants