aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Texture/ImageConverter.cs
blob: 89529061fd96ee35b2420c90119a757aeab1101c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
namespace Ryujinx.Graphics.Texture
{
    static class ImageConverter
    {
        public static byte[] G8R8ToR8G8(
            byte[] Data,
            int    Width,
            int    Height,
            int    Depth)
        {
            int Texels = Width * Height * Depth;

            byte[] Output = new byte[Texels * 2];

            for (int Texel = 0; Texel < Texels; Texel++)
            {
                Output[Texel * 2 + 0] = Data[Texel * 2 + 1];
                Output[Texel * 2 + 1] = Data[Texel * 2 + 0];
            }

            return Output;
        }
    }
}