summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-09-28 10:17:38 +0200
committerGitHub <noreply@github.com>2020-09-28 10:17:38 +0200
commite66013a6f1704c299591ceb279f2d03fa974996b (patch)
tree0700d0cf515f81a698ddd953293b30d7efcff719 /modules
parent1a8dfcd97b6d95d67aa00221196cdcc26b585e97 (diff)
parent313006adb81a859662cf25e86c6e1b3b98c5f6f0 (diff)
Merge pull request #42262 from akien-mga/ios-pvrtc-fixes
iOS: Fix multiple issues with PVRTC import, disable ETC1
Diffstat (limited to 'modules')
-rw-r--r--modules/pvr/texture_loader_pvr.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/pvr/texture_loader_pvr.cpp b/modules/pvr/texture_loader_pvr.cpp
index 36c0913f62..050dce1aab 100644
--- a/modules/pvr/texture_loader_pvr.cpp
+++ b/modules/pvr/texture_loader_pvr.cpp
@@ -213,10 +213,12 @@ static void _compress_pvrtc4(Image *p_img) {
int ofs, size, w, h;
img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::RgbaBitmap bm(w, h);
+ void *dst = (void *)bm.GetData();
+ copymem(dst, &r[ofs], size);
+ Javelin::ColorRgba<unsigned char> *dp = bm.GetData();
for (int j = 0; j < size / 4; j++) {
- Javelin::ColorRgba<unsigned char> *dp = bm.GetData();
- /* red and Green colors are swapped. */
- new (dp) Javelin::ColorRgba<unsigned char>(r[ofs + 4 * j + 2], r[ofs + 4 * j + 1], r[ofs + 4 * j], r[ofs + 4 * j + 3]);
+ /* red and blue colors are swapped. */
+ SWAP(dp[j].r, dp[j].b);
}
new_img->get_mipmap_offset_size_and_dimensions(i, ofs, size, w, h);
Javelin::PvrTcEncoder::EncodeRgba4Bpp(&wr[ofs], bm);