Let’s say the filename.jpg is 2000x1000 and my destination rectangle is 200x100. So either I scale post-image load. OR I can specify the target dimensions to libjpg (buried deep in CCImage) to pre-scale so that I don’t waste texture memory.
Pre-scale in your asset pipeline/workflow before loading into the game, adding search paths to allow for SD,HD,HDiPad is easiest. You could render to a RenderTexture and apply a sprite scaled down by .1 and then use that texture and unload the original texture. Maybe others have better solutions.
libjpg already does a two pass read on the jpeg file. And it can specify options on target dimensions. So whether it’s cpu time at photoshop end or target device, it’s the same work. Given the transistor density, it reduces my complexity in maintaining artwork for every screen density. Because those are human cycles vs compute cycles.
I do this on Android all the time. If we can expose this function in at least Texture2D ie as simple as
auto texture = Texture2D::create(filename, targetSize);
Actually it’s compute cycles on either end as you should be automating the pre-scale version as well and run through python script with imagemagick or whatever.
Sounds like you already have a solution then? If you want the core engine to change submit a PR with your fixes/changes.