Skip to content

Image class wrongly set mips flags inside the constructor #1883

Closed
@Ali-RS

Description

@Ali-RS

These two constructors on Image class behave differently!

public Image(Format format, int width, int height, int depth, ArrayList<ByteBuffer> data,
int[] mipMapSizes, ColorSpace colorSpace) {
this();
if (mipMapSizes != null) {
if (mipMapSizes.length <= 1) {
mipMapSizes = null;
} else {
needGeneratedMips = false;
mipsWereGenerated = true;
}
}

public Image(Format format, int width, int height, ByteBuffer data,
int[] mipMapSizes, ColorSpace colorSpace) {
this();
if (mipMapSizes != null && mipMapSizes.length <= 1) {
mipMapSizes = null;
} else {
needGeneratedMips = false;
mipsWereGenerated = true;
}

Look at needGeneratedMips and mipsWereGenerated flags, if mipMapSizes is null the first one won't modify the flags but the second one will do (I belive it is wrongly setting mipsWereGenerated = true)

Forum post:
https://hub.jmonkeyengine.org/t/issue-in-image-class-bug/46297

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that is supposed to work, but doesn't. More severe than a "defect".

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions