-
Notifications
You must be signed in to change notification settings - Fork 53
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 functions for color replacement for sprites (M0 and M1) and example (issue #14) #69
Conversation
Add sprite color replace functions
…into colorreplace
* Change windows backlashes into standard slashes * Change some comments to better explain code * Make code conformant to code standards * Use macros where calculations can be done in compile time * Use macro constants to clarify code (like hardware colours) * Some other minor details
* Converting project to latest CPCtelera project version * Using spaces instead of tabs for indenting
* Shorter and faster version * Completely reviewed documentation
@lronaldo : done using spaces instead of tabs for indent in asm and example |
…into Arnaud6128-colorreplace
I'm proceeding now to accept your pullrequest and will review it in its new branch. I will probably make changes and addons to documentation. Please, stay tuned to merge-back new changes to your own repo. |
* Root cpctelera/src folder is added to include folders
I have added new function cpct_setReplaceColorsM0 to perform colors computation and update other functions to only perform color replacement. |
@Arnaud6128 I'm reviewing the code now and doing and in-depth analysis. It's a bad moment to add new stuff to the pull request, even worse if the stuff is changing what I'm reviewing. It's better if we go step by step. Just let me perform an in-depth review (it will take me time) and then we will be able to discuss future changes to this feature. In the meantime, it's better if you continue with other features or examples. That will let us paralelize work without collision. |
Just a cuestion. Is there any particular reason to design Colorize functions with an output pointer (colorizeSprite)? I mean, does that have any particular advantage? I see that half the functions will be easily improved by just performing Colorize over the same input sprite (modifying it) without having to perform a copy to a new place at the same time. If you want a copy, you may perform a cpct_memcpy first, then a Colorize, and you would get same results. Unless there is a particular reason for performing Colorize+Copy on the same function you have in mind, I think it would be better to split them out. |
* One function sets colours, the other does the replacement
@Arnaud6128 I've pushed a suggested version for cpct_spriteColourizeM0_f along with cpct_setSpriteColourizeM0_f. Both of them have the _f postfix from "fast" just to differentiate them. I've also modified your colourReplace example to use and test these two functions. Please, have a look at the code and interface and let me know what your think. Is this okay for you? Is there any use case or feature missing? I think this illustrates the concept we've been discussing past days. It also shows how the code gets simplified, it does not require IX or alternate register set, it has no problems if Firmware is on, is faster under same circumstances and can be even faster if you want to do same colour replacement for multiple sprites. With respect to the conflicts under this branch, it is safer if you undo your commit |
@Arnaud6128 I'm reviewing the code now and doing and in-depth analysis. It's a bad moment to add new stuff to the pull request, even worse if the stuff is changing what I'm reviewing.
@Arnaud6128 Just a cuestion. Is there any particular reason to design Colorize functions with an output pointer (colorizeSprite)?
@Arnaud6128 I've pushed a suggested version for cpct_spriteColourizeM0_f along with cpct_setSpriteColourizeM0_f. Both of them have the f postfix from "fast" just to differentiate them. I've also modified your colourReplace example to use and test these two functions.
|
No problem, man. Sometimes it's complicated to properly coordinate remotely :) In this particular case, I think it will be better keeping just the _f version, as there is no propper advantage for the previous version. Same functionality to the previous version can easily be achieved with a macro that takes all the parameters and performs the 3 calls. I haven't had a look to M1 functions yet. If you want, yo may try to apply same idea to equivalent M1 function and see how it goes. From now on, its better if we go one function at a time and take time to consider them thoroughly. It will take us time, but we will deliver the best quality possible, as always :) |
Revert done. OK, if i understand well, from now i'll apply same modifications of cpct_setSpriteColourizeM0_f and cpct_spriteColourizeM0_f for Mode 1 and you'll continue to take a look on others colourize M0 functions. |
Yes, while you apply changes to M1 functions and see how it goes, I will continue reviewing the other functions and completing documentation. |
Add cpct_setSpriteColourizeM1 and update cpct_spriteColourizeM1 |
Merged into Please, check your editor under Windows: it keeps changing unix line-endings into ms-dos line endings, then |
|
@Arnaud6128 using same
As this is clearly undesired behaviour, it is much preferable to have one set function for each Colourize function. |
Ok i'll do that. Is cpct_setSpriteMaskedColourizeM0 is to be created or it is simply missing in repo ? |
@Arnaud6128 Please, merge and check my latest commits. I've reviewed your new functions and added M0 version is still to be created, yet I have included it on the header file. As always, nice work man 😄 |
Added cpct_setSpriteMaskedColourizeM0 and update example to use it When i compile the example i have multiple definition error :
|
@Arnaud6128 I've checked your branch to a local one and have had no problem compiling it. It might be due to a bad incremental compilation of the library. Please, try |
No description provided.