Fix some memory leaks

This commit is contained in:
Henrik Rydgård committed 2018-02-04 13:39:10 +01:00
1 parent d6e888a39b
commit 8438defb24
3 files changed
+14 -3

No files matched your search

+11 -3
View File
@@ -336,17 +336,25 @@ bool DrawContext::CreatePresets() {
return vsPresets_[VS_TEXTURE_COLOR_2D] && vsPresets_[VS_COLOR_2D] && fsPresets_[FS_TEXTURE_COLOR_2D] && fsPresets_[FS_COLOR_2D];
}
DrawContext::~DrawContext() {
void DrawContext::DestroyPresets() {
for (int i = 0; i < VS_MAX_PRESET; i++) {
if (vsPresets_[i])
if (vsPresets_[i]) {
vsPresets_[i]->Release();
vsPresets_[i] = nullptr;
}
}
for (int i = 0; i < FS_MAX_PRESET; i++) {
if (fsPresets_[i])
if (fsPresets_[i]) {
fsPresets_[i]->Release();
fsPresets_[i] = nullptr;
}
}
}
DrawContext::~DrawContext() {
DestroyPresets();
}
// TODO: SSE/NEON
// Could also make C fake-simd for 64-bit, two 8888 pixels fit in a register :)
void ConvertFromRGBA8888(uint8_t *dst, const uint8_t *src, uint32_t dstStride, uint32_t srcStride, uint32_t width, uint32_t height, DataFormat format) {