mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
try, try again
This commit is contained in:
parent
a26f9c7887
commit
ac2bc39a27
1 changed files with 5 additions and 3 deletions
|
@ -39,9 +39,11 @@ StoragePointer Storage::toFileStorage(const QString& filename) const {
|
|||
}
|
||||
|
||||
MemoryStorage::MemoryStorage(size_t size, const uint8_t* data) : _size(size) {
|
||||
// alloc smallest number of 4-byte chunks that will cover size bytes. The buffer is padded out to a multiple
|
||||
// of 4 to force an alignment that glTextureSubImage2D can later use.
|
||||
_data.resize((size + 3) & ~0x3);
|
||||
// we end up calling glCompressedTextureSubImage2D with this, and the rows of the image are expected
|
||||
// to be word aligned. This is fine in all cases except for 1x1 images and 2x2 images. For 1x1,
|
||||
// there is only one row, so the problem is avoided. For 2x2, we add 2 extra bytes so there's
|
||||
// room for the second row.
|
||||
_data.resize(size == 4 ? 6 : size);
|
||||
if (data) {
|
||||
memcpy(_data.data(), data, size);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue