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

generateTexture signature is inconsistent #2304

Closed
LukaszGrela opened this issue Jan 21, 2016 · 7 comments
Closed

generateTexture signature is inconsistent #2304

LukaszGrela opened this issue Jan 21, 2016 · 7 comments

Comments

@LukaszGrela
Copy link

I've noticed that:

DisplayObject.prototype.generateTexture = function (renderer, scaleMode, resolution)
and
Container.prototype.generateTexture = function (renderer, resolution, scaleMode)
or
Graphics.prototype.generateTexture = function (resolution, scaleMode)

have different order of arguments (or number), there is no real need to do this and also this upsets the google-closure-compiler which reports following error:

Running "closure-compiler:dev" (closure-compiler) task
>> grunt-google-closure-compiler: src/externs/pixi-3.0.8-externs.js:2745: WARNING - mismatch of the generateTexture property type and the type of the property it overrides from superclass PIXI.DisplayObject
>> original: function (this:PIXI.DisplayObject, (PIXI.CanvasRenderer|PIXI.WebGLRenderer|null), number, number=): (PIXI.Texture|null)
>> override: function (this:PIXI.Container, (PIXI.CanvasRenderer|PIXI.WebGLRenderer|null), number, number): (PIXI.Texture|null)
>> PIXI.Container.prototype.generateTexture = function (renderer, resolution, scaleMode) {};
>> ^
>>
>> src/externs/pixi-3.0.8-externs.js:3360: WARNING - mismatch of the generateTexture property type and the type of the property it overrides from superclass PIXI.DisplayObject
>> original: function (this:PIXI.Container, (PIXI.CanvasRenderer|PIXI.WebGLRenderer|null), number, number): (PIXI.Texture|null)                                                                                                                 >> override: function (this:PIXI.Graphics, number, number, number=): (PIXI.Texture|null)
>> PIXI.Graphics.prototype.generateTexture = function (resolution, scaleMode) {};
>> ^
>
@englercj
Copy link
Collaborator

https://github.com/pixijs/pixi.js/search?utf8=%E2%9C%93&q=generateTexture

Looks like the DO one matches the RenderTexture param order:

https://github.com/pixijs/pixi.js/blob/962f5bdff1ed2d96cfeaef22897ed83b7cce79bd/src/core/display/DisplayObject.js#L483

The others in that case seem "backwards". Unfortunately changing it to be correct would be backwards incompatible at this point.

@LukaszGrela
Copy link
Author

Hmm, yes, I assume it is not worth to have a type test and swap the params for "old" use?

probably resolution and scaleMode can't be recognised from eachother?

@englercj
Copy link
Collaborator

both are numbers :(

@LukaszGrela
Copy link
Author

maybe based on the valid ranges? surely there is distinct difference between resolution and scaleMode?

@englercj
Copy link
Collaborator

scaleMode is a constant value in the range [0, 5] and the resolution is generally in the range [1,3].

Hard to tell the difference...

@GoodBoyDigital
Copy link
Member

Thanks for highlighting @LukaszGrela ! generateTexture has been moved to the renderer now for v4. This means all objects get rendered through a single function 👍

@lock
Copy link

lock bot commented Feb 25, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants