Closed namse closed 8 months ago
Hmm. the problem is very complex here.
rgba_idx
could be negative if the layer's top and left is negative. It's not considered in code.
@chinedufn
I think you have to make a decision about the design of rgba_idx
.
Here are my suggestion,
rgba_idx
returns signed integer and user check it's negativergba_idx
returns Option<usize>
to prevent negative indexI put the change that fn rgba_idx(...)
returns Option<usize>
at commit e4a008b.
Thanks for working on this! Will review this over the weekend.
I haven't looked at the code yet, but if you haven't already please add test(s) for the things that you fixed.
These tests should have failed before your fixes and pass after your fixes.
I see, I have a psd file that makes error with previous code. Give me some time to put test. :)
@namse I created a PR to add tests to your branch https://github.com/namse/psd/pull/1
@chinedufn this PR seems to fix few issues #45 #26 #43 and would be good to get in for a release
@namse @chinedufn I have created a new PR at #52 which contains all the changes from this PR with the test cases. We can close this in favor of #52
Added a commit with both of you as co authors https://github.com/chinedufn/psd/commit/a57f32fc5d300e3a5398aa313b74cb4461907f69
closes https://github.com/chinedufn/psd/issues/45
Other little code changes by rust-analyzer and rustfmt automatically.