2010-04-25 00:31:27 +00:00
|
|
|
/*
|
2009-02-09 21:15:56 +00:00
|
|
|
* Copyright (C) 2007-2009 Gabest
|
|
|
|
* http://www.gabest.org
|
|
|
|
*
|
|
|
|
* This Program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* This Program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2010-04-25 00:31:27 +00:00
|
|
|
*
|
2009-02-09 21:15:56 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with GNU Make; see the file COPYING. If not, write to
|
2012-09-09 18:16:11 +00:00
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
2009-02-09 21:15:56 +00:00
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-02-19 03:36:30 +00:00
|
|
|
#include "stdafx.h"
|
2009-02-09 21:15:56 +00:00
|
|
|
#include "GSVector.h"
|
|
|
|
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector4i GSVector4i::m_xff[17];
|
|
|
|
GSVector4i GSVector4i::m_x0f[17];
|
|
|
|
|
|
|
|
void GSVector4i::InitVectors()
|
2012-01-19 04:53:36 +00:00
|
|
|
{
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector4i xff[17] =
|
|
|
|
{
|
|
|
|
GSVector4i(0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x000000ff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0000ffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x00ffffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0x000000ff, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0x0000ffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0x00ffffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0x000000ff, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0xffffffff, 0x00000000),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff),
|
|
|
|
GSVector4i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff),
|
|
|
|
};
|
|
|
|
|
|
|
|
GSVector4i x0f[17] =
|
|
|
|
{
|
|
|
|
GSVector4i(0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0000000f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x00000f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x000f0f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f),
|
|
|
|
GSVector4i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f),
|
|
|
|
};
|
|
|
|
|
|
|
|
for (size_t n = 0; n < countof(xff); ++n)
|
|
|
|
m_xff[n] = xff[n];
|
|
|
|
|
|
|
|
for (size_t n = 0; n < countof(x0f); ++n)
|
|
|
|
m_x0f[n] = x0f[n];
|
|
|
|
}
|
|
|
|
|
|
|
|
GSVector4 GSVector4::m_ps0123;
|
|
|
|
GSVector4 GSVector4::m_ps4567;
|
|
|
|
GSVector4 GSVector4::m_half;
|
|
|
|
GSVector4 GSVector4::m_one;
|
|
|
|
GSVector4 GSVector4::m_two;
|
|
|
|
GSVector4 GSVector4::m_four;
|
|
|
|
GSVector4 GSVector4::m_x4b000000;
|
|
|
|
GSVector4 GSVector4::m_x4f800000;
|
|
|
|
GSVector4 GSVector4::m_max;
|
|
|
|
GSVector4 GSVector4::m_min;
|
|
|
|
|
|
|
|
void GSVector4::InitVectors()
|
2012-01-19 04:53:36 +00:00
|
|
|
{
|
2016-07-06 23:21:31 +00:00
|
|
|
m_ps0123 = GSVector4(0.0f, 1.0f, 2.0f, 3.0f);
|
|
|
|
m_ps4567 = GSVector4(4.0f, 5.0f, 6.0f, 7.0f);
|
|
|
|
m_half = GSVector4(0.5f);
|
|
|
|
m_one = GSVector4(1.0f);
|
|
|
|
m_two = GSVector4(2.0f);
|
|
|
|
m_four = GSVector4(4.0f);
|
|
|
|
m_x4b000000 = GSVector4(_mm_castsi128_ps(_mm_set1_epi32(0x4b000000)));
|
|
|
|
m_x4f800000 = GSVector4(_mm_castsi128_ps(_mm_set1_epi32(0x4f800000)));
|
|
|
|
m_max = GSVector4(FLT_MAX);
|
|
|
|
m_min = GSVector4(FLT_MIN);
|
|
|
|
}
|
2009-02-09 21:15:56 +00:00
|
|
|
|
2013-06-10 15:56:11 +00:00
|
|
|
#if _M_SSE >= 0x500
|
|
|
|
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector8 GSVector8::m_half;
|
|
|
|
GSVector8 GSVector8::m_one;
|
|
|
|
GSVector8 GSVector8::m_x7fffffff;
|
|
|
|
GSVector8 GSVector8::m_x80000000;
|
|
|
|
GSVector8 GSVector8::m_x4b000000;
|
|
|
|
GSVector8 GSVector8::m_x4f800000;
|
|
|
|
GSVector8 GSVector8::m_max;
|
|
|
|
GSVector8 GSVector8::m_min;
|
|
|
|
|
|
|
|
void GSVector8::InitVectors()
|
|
|
|
{
|
|
|
|
m_half = GSVector8(0.5f);
|
|
|
|
m_one = GSVector8(1.0f);
|
|
|
|
m_x7fffffff = GSVector8(_mm256_castsi256_ps(_mm256_set1_epi32(0x7fffffff)));
|
|
|
|
m_x80000000 = GSVector8(_mm256_castsi256_ps(_mm256_set1_epi32(0x80000000)));
|
|
|
|
m_x4b000000 = GSVector8(_mm256_castsi256_ps(_mm256_set1_epi32(0x4b000000)));
|
|
|
|
m_x4f800000 = GSVector8(_mm256_castsi256_ps(_mm256_set1_epi32(0x4f800000)));
|
|
|
|
m_max = GSVector8(FLT_MAX);
|
|
|
|
m_min = GSVector8(FLT_MIN);
|
|
|
|
}
|
2013-06-10 15:56:11 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if _M_SSE >= 0x501
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector8i GSVector8i::m_xff[33];
|
|
|
|
GSVector8i GSVector8i::m_x0f[33];
|
2013-06-10 15:56:11 +00:00
|
|
|
|
2016-07-06 23:21:31 +00:00
|
|
|
void GSVector8i::InitVectors()
|
2013-06-10 15:56:11 +00:00
|
|
|
{
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector8i xff[33] =
|
|
|
|
{
|
|
|
|
GSVector8i(0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x000000ff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0x000000ff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0x000000ff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x000000ff),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00ffffff),
|
|
|
|
GSVector8i(0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff),
|
|
|
|
};
|
2013-06-10 15:56:11 +00:00
|
|
|
|
2016-07-06 23:21:31 +00:00
|
|
|
GSVector8i x0f[33] =
|
|
|
|
{
|
|
|
|
GSVector8i(0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x00000f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x000f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000000),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0000000f),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x00000f0f),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x000f0f0f),
|
|
|
|
GSVector8i(0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f, 0x0f0f0f0f),
|
|
|
|
};
|
|
|
|
|
|
|
|
for (size_t n = 0; n < countof(xff); ++n)
|
|
|
|
m_xff[n] = xff[n];
|
|
|
|
|
|
|
|
for (size_t n = 0; n < countof(x0f); ++n)
|
|
|
|
m_x0f[n] = x0f[n];
|
|
|
|
}
|
2013-06-10 15:56:11 +00:00
|
|
|
#endif
|
|
|
|
|
2009-05-14 16:41:52 +00:00
|
|
|
GSVector4i GSVector4i::fit(int arx, int ary) const
|
|
|
|
{
|
|
|
|
GSVector4i r = *this;
|
|
|
|
|
|
|
|
if(arx > 0 && ary > 0)
|
|
|
|
{
|
|
|
|
int w = width();
|
|
|
|
int h = height();
|
|
|
|
|
|
|
|
if(w * ary > h * arx)
|
|
|
|
{
|
2009-05-15 11:11:26 +00:00
|
|
|
w = h * arx / ary;
|
|
|
|
r.left = (r.left + r.right - w) >> 1;
|
2009-05-14 16:41:52 +00:00
|
|
|
if(r.left & 1) r.left++;
|
2009-05-15 11:11:26 +00:00
|
|
|
r.right = r.left + w;
|
2009-05-14 16:41:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2009-05-15 11:11:26 +00:00
|
|
|
h = w * ary / arx;
|
|
|
|
r.top = (r.top + r.bottom - h) >> 1;
|
2009-05-14 16:41:52 +00:00
|
|
|
if(r.top & 1) r.top++;
|
2009-05-15 11:11:26 +00:00
|
|
|
r.bottom = r.top + h;
|
2009-05-14 16:41:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
r = r.rintersect(*this);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r = *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2011-02-16 03:19:36 +00:00
|
|
|
static const int s_ar[][2] = {{0, 0}, {4, 3}, {16, 9}};
|
|
|
|
|
2009-05-14 16:41:52 +00:00
|
|
|
GSVector4i GSVector4i::fit(int preset) const
|
|
|
|
{
|
|
|
|
GSVector4i r;
|
|
|
|
|
2014-05-06 07:25:00 +00:00
|
|
|
if(preset > 0 && preset < (int)countof(s_ar))
|
2009-05-14 16:41:52 +00:00
|
|
|
{
|
2011-02-16 03:19:36 +00:00
|
|
|
r = fit(s_ar[preset][0], s_ar[preset][1]);
|
2009-05-14 16:41:52 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
r = *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
return r;
|
2013-06-17 04:11:10 +00:00
|
|
|
}
|