mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-12-14 03:59:36 +00:00
Cygwin port
This commit is contained in:
@@ -8,61 +8,10 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
// TODO: This is not gamma correct...
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
#if 0
|
||||
void AntiAliasTable::GenerateForPalette(const RGBAColor &baseColorRef, const RGBAColor *colors, size_t numColors)
|
||||
{
|
||||
const RGBAColor baseColor = baseColorRef;
|
||||
|
||||
if (numColors > 256)
|
||||
numColors = 256;
|
||||
|
||||
unsigned int baseCh[3] = { baseColor.r, baseColor.g, baseColor.b };
|
||||
|
||||
for (size_t i = 0; i < numColors; i++)
|
||||
{
|
||||
const RGBAColor existingColor = colors[i];
|
||||
|
||||
unsigned int existingCh[3] = { existingColor.r, existingColor.g, existingColor.b };
|
||||
|
||||
// 0 alpha is always the same color
|
||||
m_aaTranslate[i][0] = static_cast<uint8_t>(i);
|
||||
|
||||
for (unsigned int b = 1; b < 16; b++)
|
||||
{
|
||||
unsigned int newCh[3];
|
||||
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
newCh[ch] = (15 - b) * existingCh[ch] + b * baseCh[ch];
|
||||
|
||||
uint32_t bestError = 0xffffffffU;
|
||||
size_t bestColor = 0;
|
||||
for (size_t cmp = 0; cmp < numColors; cmp++)
|
||||
{
|
||||
int16_t existingChScaled[3] = { colors[cmp].r * 15, colors[cmp].g * 15, colors[cmp].b * 15 };
|
||||
|
||||
uint32_t error = 0;
|
||||
for (unsigned int ch = 0; ch < 3; ch++)
|
||||
{
|
||||
int16_t delta = static_cast<int16_t>(newCh[ch]) - existingChScaled[ch];
|
||||
error += static_cast<uint32_t>(delta * delta);
|
||||
}
|
||||
|
||||
if (error < bestError)
|
||||
{
|
||||
bestError = error;
|
||||
bestColor = cmp;
|
||||
}
|
||||
}
|
||||
|
||||
m_aaTranslate[i][b] = static_cast<uint8_t>(bestColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
bool AntiAliasTable::LoadFromCache(const char *cacheFileName)
|
||||
{
|
||||
GpIOStream *stream = PLDrivers::GetFileSystem()->OpenFile(PortabilityLayer::VirtualDirectories::kFontCache, cacheFileName, false, GpFileCreationDispositions::kOpenExisting);
|
||||
@@ -203,5 +152,4 @@ namespace PortabilityLayer
|
||||
if (cacheable)
|
||||
SaveToCache(cacheFileName);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
class GpIOStream;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "VirtualDirectory.h"
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "PLSysCalls.h"
|
||||
|
||||
#include <vector>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "HostSuspendCallID.h"
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#define __PL_MEMORY_MANAGER_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
template<class T>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
template<class T>
|
||||
class ArrayViewIterator;
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include <limits.h>
|
||||
|
||||
class PLMainThreadRelay final : public IGpThreadRelay
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
struct Rect;
|
||||
class GpIOStream;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "ScanlineMaskDataStorage.h"
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include "Vec2i.h"
|
||||
|
||||
class PLPasStr;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "DataTypes.h"
|
||||
#include "SmallestInt.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
class PLPasStr;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_XMODEMCRC_H__
|
||||
#define __PL_XMODEMCRC_H__
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "DataTypes.h"
|
||||
|
||||
@@ -9,5 +9,3 @@ namespace PortabilityLayer
|
||||
{
|
||||
uint16_t XModemCRC(const void *bytes, size_t size, uint16_t initialValue);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user