mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Fix a bug in TextureUtil, may help #9248
This commit is contained in:
parent
e59cafe177
commit
acef9af5d4
@ -79,13 +79,12 @@ static bool LoadTextureLevels(const uint8_t *data, size_t size, ImageFileType ty
|
||||
bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, ImageFileType type) {
|
||||
using namespace Draw;
|
||||
|
||||
int width[16], height[16];
|
||||
uint8_t *image[16] = { nullptr };
|
||||
int width[16]{}, height[16]{};
|
||||
uint8_t *image[16]{};
|
||||
|
||||
int num_levels;
|
||||
int zim_flags;
|
||||
int num_levels = 0;
|
||||
int zim_flags = 0;
|
||||
DataFormat fmt;
|
||||
|
||||
if (!LoadTextureLevels(data, dataSize, type, width, height, &num_levels, &fmt, image, &zim_flags)) {
|
||||
return false;
|
||||
}
|
||||
@ -95,8 +94,10 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag
|
||||
num_levels = 1;
|
||||
}
|
||||
|
||||
if (texture_)
|
||||
if (texture_) {
|
||||
delete texture_;
|
||||
texture_ = nullptr;
|
||||
}
|
||||
|
||||
TextureDesc desc{};
|
||||
desc.type = TextureType::LINEAR2D;
|
||||
|
@ -21,6 +21,7 @@ public:
|
||||
}
|
||||
void GLLost() override {
|
||||
delete texture_;
|
||||
texture_ = nullptr;
|
||||
}
|
||||
void GLRestore() override {
|
||||
if (!filename_.empty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user