mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
parent
9cb094a99a
commit
e8522e7034
|
@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
#include "TextureFilters.h"
|
||||
#include "TxUtil.h"
|
||||
|
||||
|
@ -745,7 +746,8 @@ void deposterizeV(uint32* data, uint32* out, int w, int h, int l, int u) {
|
|||
|
||||
static
|
||||
void DePosterize(uint32* source, uint32* dest, int width, int height) {
|
||||
uint32 * buf = (uint32*)TxMemBuf::getInstance()->get(3);
|
||||
std::vector<uint32> tmpvec(width*height);
|
||||
uint32 * buf = tmpvec.data();
|
||||
deposterizeH(source, buf, width, 0, height);
|
||||
deposterizeV(buf, dest, width, height, 0, height);
|
||||
deposterizeH(dest, buf, width, 0, height);
|
||||
|
@ -753,8 +755,10 @@ void DePosterize(uint32* source, uint32* dest, int width, int height) {
|
|||
}
|
||||
|
||||
void filter_8888(uint32 *src, uint32 srcwidth, uint32 srcheight, uint32 *dest, uint32 filter) {
|
||||
std::vector<uint32> tmpvec;
|
||||
if (filter & DEPOSTERIZE) {
|
||||
uint32 * tex = (uint32*)TxMemBuf::getInstance()->get(2);
|
||||
tmpvec.resize(srcwidth * srcheight);
|
||||
uint32 * tex = tmpvec.data();
|
||||
DePosterize(src, tex, srcwidth, srcheight);
|
||||
src = tex;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
if (ident && wcscmp(ident, wst("DEFAULT")) != 0)
|
||||
_ident.assign(ident);
|
||||
|
||||
if (TxMemBuf::getInstance()->init(_maxwidth, _maxheight, (_options & DEPOSTERIZE) ? 1 : 0)) {
|
||||
if (TxMemBuf::getInstance()->init(_maxwidth, _maxheight)) {
|
||||
if (!_tex1)
|
||||
_tex1 = TxMemBuf::getInstance()->get(0);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "TxDbg.h"
|
||||
#include <zlib.h>
|
||||
#include <malloc.h>
|
||||
#include <assert.h>
|
||||
|
||||
#if defined (OS_MAC_OS_X)
|
||||
#include <sys/param.h>
|
||||
|
@ -530,7 +531,7 @@ TxUtil::getNumberofProcessors()
|
|||
TxMemBuf::TxMemBuf()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
_tex[i] = nullptr;
|
||||
_size[i] = 0;
|
||||
}
|
||||
|
@ -542,10 +543,9 @@ TxMemBuf::~TxMemBuf()
|
|||
}
|
||||
|
||||
boolean
|
||||
TxMemBuf::init(int maxwidth, int maxheight, boolean deposterize)
|
||||
TxMemBuf::init(int maxwidth, int maxheight)
|
||||
{
|
||||
_numBufs = deposterize ? 4 : 2;
|
||||
for (uint32 i = 0; i < _numBufs; i++) {
|
||||
for (uint32 i = 0; i < 2; i++) {
|
||||
if (!_tex[i]) {
|
||||
_tex[i] = (uint8 *)malloc(maxwidth * maxheight * 4);
|
||||
_size[i] = maxwidth * maxheight * 4;
|
||||
|
@ -563,7 +563,7 @@ void
|
|||
TxMemBuf::shutdown()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < _numBufs; i++) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (_tex[i]) free(_tex[i]);
|
||||
_tex[i] = nullptr;
|
||||
_size[i] = 0;
|
||||
|
@ -573,13 +573,15 @@ TxMemBuf::shutdown()
|
|||
uint8*
|
||||
TxMemBuf::get(unsigned int num)
|
||||
{
|
||||
return ((num < _numBufs) ? _tex[num] : nullptr);
|
||||
assert(num < 2);
|
||||
return _tex[num];
|
||||
}
|
||||
|
||||
uint32
|
||||
TxMemBuf::size_of(unsigned int num)
|
||||
{
|
||||
return ((num < _numBufs) ? _size[num] : 0);
|
||||
assert(num < 2);
|
||||
return _size[num];
|
||||
}
|
||||
|
||||
void setTextureFormat(uint16 internalFormat, GHQTexInfo * info)
|
||||
|
|
|
@ -56,9 +56,8 @@ public:
|
|||
class TxMemBuf
|
||||
{
|
||||
private:
|
||||
uint8 *_tex[4];
|
||||
uint32 _size[4];
|
||||
uint32 _numBufs;
|
||||
uint8 *_tex[2];
|
||||
uint32 _size[2];
|
||||
TxMemBuf();
|
||||
public:
|
||||
static TxMemBuf* getInstance() {
|
||||
|
@ -66,7 +65,7 @@ public:
|
|||
return &txMemBuf;
|
||||
}
|
||||
~TxMemBuf();
|
||||
boolean init(int maxwidth, int maxheight, boolean deposterize);
|
||||
boolean init(int maxwidth, int maxheight);
|
||||
void shutdown(void);
|
||||
uint8 *get(unsigned int num);
|
||||
uint32 size_of(unsigned int num);
|
||||
|
|
Loading…
Reference in New Issue
Block a user