Texture vs Sprite scale do not match for getContentScaleFactor != 1

Hi all, I’m developing app relying on design resolution vs screen resolution paradigm to support multiple resolutions.
I’ve noticed if I attempt to use CCSprite* CCSprite::create(const char *pszFileName, const CCRect& rect) when scale factor not equal to 1 i.e. CCDirector::sharedDirector()->getContentScaleFactor() != 1 sprite rect will scale accordingly, but texture will not.

I checked TestCpp project - same story. Please see attached images:
Normal resolution (normal480x320.png) NSRect rect = NSMakeRect(200, 200, 480, 320); in AppController.mm and
scaled resolution (scale800x600.png) NSRect rect = NSMakeRect(200, 200, 800, 600); in AppController.mm, notice how AtlasSprite, on the bottom, includes yellow and “grayish” versions of the texture whereas by design only “grayish” part must be displayed and scaled appropriately.

So my question is - is this bug, or there is another way of creating multiple sprites from single texture that will bypass this peculiarity?

Thanks!

P.S. I meant to attach normal480x320.png first so added “no issue” description, ended up attaching scale800x600 image first, so please disregard discrepancy, scale800x600.png is actually the one that has the issue.


scale800x600.png (79.6 KB)


normal480x320.png (46.6 KB)

If you want a larger texture, load a larger image. Refer to http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support for how to do that.

The thing is, the texture is the same as your image, except it’s in bmp format (for fast drawing). The upscaling takes place after, when cocos render the texture.

In general, upscaling so much (x2) is not advised, as the image in 800x600 is going to be pixelised : you really want to load a different, higher resolution image for that screen size.

Thanks François, although it does not help, the example I used was simply for demonstration.

You are saying upscaling takes place at a later stage - the fact is in the example texture was not scaled at all, compare sizes of AtlasSprite button on each of the attachments - the texture size is the same, but Sprite rect is scaled, therefore instead of seeing big&distorted version of the same button you see new portion of the image cut out from the original texture (attached for reference (from cocos2dx TestCpp example))

So I still inclined to believe this is a bug, unless it is a feature which I do not understand.