~ppsspp/ppsspp/ppsspp_1.3.0

« back to all changes in this revision

Viewing changes to GPU/GLES/TextureScaler.cpp

  • Committer: Sérgio Benjamim
  • Date: 2017-01-02 00:12:05 UTC
  • Revision ID: sergio_br2@yahoo.com.br-20170102001205-cxbta9za203nmjwm
1.3.0 source (from ppsspp_1.3.0-r160.p5.l1762.a165.t83~56~ubuntu16.04.1.tar.xz).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) 2012- PPSSPP Project.
 
2
 
 
3
// This program is free software: you can redistribute it and/or modify
 
4
// it under the terms of the GNU General Public License as published by
 
5
// the Free Software Foundation, version 2.0 or later versions.
 
6
 
 
7
// This program is distributed in the hope that it will be useful,
 
8
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
// GNU General Public License 2.0 for more details.
 
11
 
 
12
// A copy of the GPL 2.0 should have been included with the program.
 
13
// If not, see http://www.gnu.org/licenses/
 
14
 
 
15
// Official git repository and contact information can be found at
 
16
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. 
 
17
 
 
18
#if _MSC_VER == 1700
 
19
// Has to be included before TextureScaler.h, else we get those std::bind errors in VS2012.. 
 
20
#include "../native/base/basictypes.h"
 
21
#endif
 
22
 
 
23
#include <algorithm>
 
24
#include "gfx/gl_common.h"
 
25
 
 
26
#include "GPU/Common/TextureScalerCommon.h"
 
27
#include "GPU/GLES/TextureScaler.h"
 
28
#include "Common/ColorConv.h"
 
29
#include "Common/Log.h"
 
30
#include "Common/ThreadPools.h"
 
31
 
 
32
int TextureScalerGL::BytesPerPixel(u32 format) {
 
33
        return (format == GL_UNSIGNED_BYTE) ? 4 : 2;
 
34
}
 
35
 
 
36
u32 TextureScalerGL::Get8888Format() {
 
37
        return GL_UNSIGNED_BYTE;
 
38
}
 
39
 
 
40
void TextureScalerGL::ConvertTo8888(u32 format, u32* source, u32* &dest, int width, int height) {
 
41
        switch(format) {
 
42
        case GL_UNSIGNED_BYTE:
 
43
                dest = source; // already fine
 
44
                break;
 
45
 
 
46
        case GL_UNSIGNED_SHORT_4_4_4_4:
 
47
                GlobalThreadPool::Loop(std::bind(&convert4444_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
 
48
                break;
 
49
 
 
50
        case GL_UNSIGNED_SHORT_5_6_5:
 
51
                GlobalThreadPool::Loop(std::bind(&convert565_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
 
52
                break;
 
53
 
 
54
        case GL_UNSIGNED_SHORT_5_5_5_1:
 
55
                GlobalThreadPool::Loop(std::bind(&convert5551_gl, (u16*)source, dest, width, placeholder::_1, placeholder::_2), 0, height);
 
56
                break;
 
57
 
 
58
        default:
 
59
                dest = source;
 
60
                ERROR_LOG(G3D, "iXBRZTexScaling: unsupported texture format");
 
61
        }
 
62
}