mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-24 07:06:36 +00:00
Add Roboto font, misc icons and text things
This commit is contained in:
@@ -1,71 +1,71 @@
|
||||
#include "FileManager.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostMemoryBuffer.h"
|
||||
#include "MemReaderStream.h"
|
||||
#include "MacBinary2.h"
|
||||
#include "MacFileMem.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class VirtualFile;
|
||||
|
||||
class FileManagerImpl final : public FileManager
|
||||
{
|
||||
public:
|
||||
bool FileExists(uint32_t dirID, const PLPasStr &filename) override;
|
||||
|
||||
int OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
int OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
#include "FileManager.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostMemoryBuffer.h"
|
||||
#include "MemReaderStream.h"
|
||||
#include "MacBinary2.h"
|
||||
#include "MacFileMem.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "PLErrorCodes.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class VirtualFile;
|
||||
|
||||
class FileManagerImpl final : public FileManager
|
||||
{
|
||||
public:
|
||||
bool FileExists(uint32_t dirID, const PLPasStr &filename) override;
|
||||
|
||||
int OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
int OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, short *outRefNum) override;
|
||||
bool ReadFileProperties(uint32_t dirID, const PLPasStr &filename, MacFileProperties &properties) override;
|
||||
IOStream *GetFileStream(int fileID) override;
|
||||
|
||||
int RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
int RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
|
||||
static FileManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
typedef char ExtendedFileName_t[64 + 4];
|
||||
|
||||
struct OpenedFile
|
||||
{
|
||||
EVirtualDirectory m_dirID;
|
||||
PascalStr<64> m_fileName;
|
||||
|
||||
IOStream *m_stream;
|
||||
};
|
||||
|
||||
int OpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, short *outRefNum);
|
||||
int RawOpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, bool ignoreMeta, IOStream **outStream);
|
||||
|
||||
static bool ConstructFilename(ExtendedFileName_t& extFN, const PLPasStr &fn, const char *extension);
|
||||
|
||||
std::vector<OpenedFile> m_refs;
|
||||
|
||||
static FileManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
bool FileManagerImpl::FileExists(uint32_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
ExtendedFileName_t extFN;
|
||||
if (!ConstructFilename(extFN, filename, ".gpf"))
|
||||
return false;
|
||||
|
||||
return HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN);
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
return OpenFileFork(dirID, filename, ".gpd", permission, outRefNum);
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
return OpenFileFork(dirID, filename, ".gpr", permission, outRefNum);
|
||||
IOStream *GetFileStream(int fileID) override;
|
||||
|
||||
int RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
int RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission filePermission, bool ignoreMeta, IOStream **outStream) override;
|
||||
|
||||
static FileManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
typedef char ExtendedFileName_t[64 + 4];
|
||||
|
||||
struct OpenedFile
|
||||
{
|
||||
EVirtualDirectory m_dirID;
|
||||
PascalStr<64> m_fileName;
|
||||
|
||||
IOStream *m_stream;
|
||||
};
|
||||
|
||||
int OpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, short *outRefNum);
|
||||
int RawOpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, bool ignoreMeta, IOStream **outStream);
|
||||
|
||||
static bool ConstructFilename(ExtendedFileName_t& extFN, const PLPasStr &fn, const char *extension);
|
||||
|
||||
std::vector<OpenedFile> m_refs;
|
||||
|
||||
static FileManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
bool FileManagerImpl::FileExists(uint32_t dirID, const PLPasStr &filename)
|
||||
{
|
||||
ExtendedFileName_t extFN;
|
||||
if (!ConstructFilename(extFN, filename, ".gpf"))
|
||||
return false;
|
||||
|
||||
return HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN);
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
return OpenFileFork(dirID, filename, ".gpd", permission, outRefNum);
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
return OpenFileFork(dirID, filename, ".gpr", permission, outRefNum);
|
||||
}
|
||||
|
||||
bool FileManagerImpl::ReadFileProperties(uint32_t dirID, const PLPasStr &filename, MacFileProperties &properties)
|
||||
@@ -82,150 +82,150 @@ namespace PortabilityLayer
|
||||
if (readOk)
|
||||
serialized.Deserialize(properties);
|
||||
|
||||
return readOk;
|
||||
return readOk;
|
||||
}
|
||||
|
||||
IOStream *FileManagerImpl::GetFileStream(int fileID)
|
||||
{
|
||||
return m_refs[fileID].m_stream;
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
return RawOpenFileFork(dirID, filename, ".gpd", permission, ignoreMeta, outStream);
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
return RawOpenFileFork(dirID, filename, ".gpr", permission, ignoreMeta, outStream);
|
||||
}
|
||||
|
||||
FileManagerImpl *FileManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *extension, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
const size_t numRefs = m_refs.size();
|
||||
size_t refIndex = m_refs.size();
|
||||
for (size_t i = 0; i < numRefs; i++)
|
||||
{
|
||||
if (m_refs[i].m_stream == nullptr)
|
||||
{
|
||||
refIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (refIndex == 0x8000)
|
||||
return tmfoErr;
|
||||
|
||||
IOStream *stream = nullptr;
|
||||
int openError = RawOpenFileFork(dirID, filename, extension, permission, false, &stream);
|
||||
if (openError != 0)
|
||||
return openError;
|
||||
|
||||
if (refIndex == numRefs)
|
||||
m_refs.push_back(OpenedFile());
|
||||
|
||||
OpenedFile &of = m_refs[refIndex];
|
||||
of.m_stream = stream;
|
||||
of.m_dirID = static_cast<EVirtualDirectory>(dirID);
|
||||
of.m_fileName.Set(filename.Length(), filename.Chars());
|
||||
|
||||
*outRefNum = static_cast<short>(refIndex);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
ExtendedFileName_t gpfExtFN;
|
||||
ExtendedFileName_t extFN;
|
||||
|
||||
if (filename.Length() > 63)
|
||||
return bdNamErr;
|
||||
|
||||
if (!ignoreMeta)
|
||||
{
|
||||
if (!ConstructFilename(gpfExtFN, filename, ".gpf"))
|
||||
return bdNamErr;
|
||||
|
||||
if (!HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), gpfExtFN))
|
||||
return fnfErr;
|
||||
}
|
||||
|
||||
if (!ConstructFilename(extFN, filename, ext))
|
||||
return bdNamErr;
|
||||
|
||||
const bool needToCreate = !(ignoreMeta || HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN));
|
||||
|
||||
IOStream *fstream = nullptr;
|
||||
switch (permission)
|
||||
{
|
||||
case EFilePermission_Any:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, true, needToCreate);
|
||||
if (fstream)
|
||||
permission = EFilePermission_ReadWrite;
|
||||
else
|
||||
{
|
||||
permission = EFilePermission_Read;
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, false, needToCreate);
|
||||
}
|
||||
break;
|
||||
case EFilePermission_Read:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, false, needToCreate);
|
||||
break;
|
||||
case EFilePermission_ReadWrite:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, true, needToCreate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fstream)
|
||||
return permErr;
|
||||
|
||||
*outStream = fstream;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
bool FileManagerImpl::ConstructFilename(ExtendedFileName_t& extFN, const PLPasStr &fn, const char *extension)
|
||||
{
|
||||
const size_t fnameSize = fn.Length();
|
||||
if (fnameSize >= 64)
|
||||
return false;
|
||||
|
||||
memcpy(extFN, fn.Chars(), fnameSize);
|
||||
memcpy(extFN + fnameSize, extension, strlen(extension) + 1);
|
||||
|
||||
for (size_t i = 0; i < fnameSize; i++)
|
||||
{
|
||||
const char c = extFN[i];
|
||||
if (c >= '0' && c <= '9')
|
||||
continue;
|
||||
|
||||
if (c == '_' || c == '.' || c == '\'')
|
||||
continue;
|
||||
|
||||
if (c == ' ' && i != 0 && i != fnameSize - 1)
|
||||
continue;
|
||||
|
||||
if (c >= 'a' && c <= 'z')
|
||||
continue;
|
||||
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FileManagerImpl FileManagerImpl::ms_instance;
|
||||
|
||||
FileManager *FileManager::GetInstance()
|
||||
{
|
||||
return FileManagerImpl::GetInstance();
|
||||
}
|
||||
}
|
||||
return m_refs[fileID].m_stream;
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileDF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
return RawOpenFileFork(dirID, filename, ".gpd", permission, ignoreMeta, outStream);
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileRF(uint32_t dirID, const PLPasStr &filename, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
return RawOpenFileFork(dirID, filename, ".gpr", permission, ignoreMeta, outStream);
|
||||
}
|
||||
|
||||
FileManagerImpl *FileManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
int FileManagerImpl::OpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *extension, EFilePermission permission, short *outRefNum)
|
||||
{
|
||||
const size_t numRefs = m_refs.size();
|
||||
size_t refIndex = m_refs.size();
|
||||
for (size_t i = 0; i < numRefs; i++)
|
||||
{
|
||||
if (m_refs[i].m_stream == nullptr)
|
||||
{
|
||||
refIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (refIndex == 0x8000)
|
||||
return tmfoErr;
|
||||
|
||||
IOStream *stream = nullptr;
|
||||
int openError = RawOpenFileFork(dirID, filename, extension, permission, false, &stream);
|
||||
if (openError != 0)
|
||||
return openError;
|
||||
|
||||
if (refIndex == numRefs)
|
||||
m_refs.push_back(OpenedFile());
|
||||
|
||||
OpenedFile &of = m_refs[refIndex];
|
||||
of.m_stream = stream;
|
||||
of.m_dirID = static_cast<EVirtualDirectory>(dirID);
|
||||
of.m_fileName.Set(filename.Length(), filename.Chars());
|
||||
|
||||
*outRefNum = static_cast<short>(refIndex);
|
||||
|
||||
return noErr;
|
||||
}
|
||||
|
||||
int FileManagerImpl::RawOpenFileFork(uint32_t dirID, const PLPasStr &filename, const char *ext, EFilePermission permission, bool ignoreMeta, IOStream **outStream)
|
||||
{
|
||||
ExtendedFileName_t gpfExtFN;
|
||||
ExtendedFileName_t extFN;
|
||||
|
||||
if (filename.Length() > 63)
|
||||
return bdNamErr;
|
||||
|
||||
if (!ignoreMeta)
|
||||
{
|
||||
if (!ConstructFilename(gpfExtFN, filename, ".gpf"))
|
||||
return bdNamErr;
|
||||
|
||||
if (!HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), gpfExtFN))
|
||||
return fnfErr;
|
||||
}
|
||||
|
||||
if (!ConstructFilename(extFN, filename, ext))
|
||||
return bdNamErr;
|
||||
|
||||
const bool needToCreate = !(ignoreMeta || HostFileSystem::GetInstance()->FileExists(static_cast<EVirtualDirectory>(dirID), extFN));
|
||||
|
||||
IOStream *fstream = nullptr;
|
||||
switch (permission)
|
||||
{
|
||||
case EFilePermission_Any:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, true, needToCreate);
|
||||
if (fstream)
|
||||
permission = EFilePermission_ReadWrite;
|
||||
else
|
||||
{
|
||||
permission = EFilePermission_Read;
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, false, needToCreate);
|
||||
}
|
||||
break;
|
||||
case EFilePermission_Read:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, false, needToCreate);
|
||||
break;
|
||||
case EFilePermission_ReadWrite:
|
||||
fstream = HostFileSystem::GetInstance()->OpenFile(static_cast<EVirtualDirectory>(dirID), extFN, true, needToCreate);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fstream)
|
||||
return permErr;
|
||||
|
||||
*outStream = fstream;
|
||||
return noErr;
|
||||
}
|
||||
|
||||
bool FileManagerImpl::ConstructFilename(ExtendedFileName_t& extFN, const PLPasStr &fn, const char *extension)
|
||||
{
|
||||
const size_t fnameSize = fn.Length();
|
||||
if (fnameSize >= 64)
|
||||
return false;
|
||||
|
||||
memcpy(extFN, fn.Chars(), fnameSize);
|
||||
memcpy(extFN + fnameSize, extension, strlen(extension) + 1);
|
||||
|
||||
for (size_t i = 0; i < fnameSize; i++)
|
||||
{
|
||||
const char c = extFN[i];
|
||||
if (c >= '0' && c <= '9')
|
||||
continue;
|
||||
|
||||
if (c == '_' || c == '.' || c == '\'')
|
||||
continue;
|
||||
|
||||
if (c == ' ' && i != 0 && i != fnameSize - 1)
|
||||
continue;
|
||||
|
||||
if (c >= 'a' && c <= 'z')
|
||||
continue;
|
||||
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
continue;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
FileManagerImpl FileManagerImpl::ms_instance;
|
||||
|
||||
FileManager *FileManager::GetInstance()
|
||||
{
|
||||
return FileManagerImpl::GetInstance();
|
||||
}
|
||||
}
|
||||
|
95
PortabilityLayer/FontFamily.cpp
Normal file
95
PortabilityLayer/FontFamily.cpp
Normal file
@@ -0,0 +1,95 @@
|
||||
#include "FontFamily.h"
|
||||
#include "IOStream.h"
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "HostFont.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
void FontFamily::AddFont(int flags, const char *path, FontHacks fontHacks)
|
||||
{
|
||||
PortabilityLayer::IOStream *sysFontStream = PortabilityLayer::HostFileSystem::GetInstance()->OpenFile(PortabilityLayer::EVirtualDirectory_Fonts, path, false, false);
|
||||
if (!sysFontStream)
|
||||
return;
|
||||
|
||||
PortabilityLayer::HostFontHandler *fontHandler = PortabilityLayer::HostFontHandler::GetInstance();
|
||||
|
||||
PortabilityLayer::HostFont *font = fontHandler->LoadFont(sysFontStream);
|
||||
|
||||
if (!fontHandler->KeepStreamOpen())
|
||||
sysFontStream->Close();
|
||||
|
||||
if (!font)
|
||||
return;
|
||||
|
||||
m_fonts[flags] = font;
|
||||
m_hacks[flags] = fontHacks;
|
||||
|
||||
if (m_fonts[0] == nullptr)
|
||||
m_defaultVariation = flags;
|
||||
}
|
||||
|
||||
void FontFamily::SetDefaultVariation(int defaultVariation)
|
||||
{
|
||||
if (m_fonts[defaultVariation])
|
||||
m_defaultVariation = defaultVariation;
|
||||
}
|
||||
|
||||
int FontFamily::GetVariationForFlags(int variation) const
|
||||
{
|
||||
if (m_fonts[variation])
|
||||
return variation;
|
||||
|
||||
if (m_fonts[0])
|
||||
return 0;
|
||||
|
||||
return m_defaultVariation;
|
||||
}
|
||||
|
||||
PortabilityLayer::HostFont *FontFamily::GetFontForVariation(int variation) const
|
||||
{
|
||||
return m_fonts[variation];
|
||||
}
|
||||
|
||||
PortabilityLayer::FontHacks FontFamily::GetHacksForVariation(int variation) const
|
||||
{
|
||||
return m_hacks[variation];
|
||||
}
|
||||
|
||||
FontFamily *FontFamily::Create()
|
||||
{
|
||||
void *storage = malloc(sizeof(FontFamily));
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
return new (storage) FontFamily();
|
||||
}
|
||||
|
||||
void FontFamily::Destroy()
|
||||
{
|
||||
this->~FontFamily();
|
||||
free(this);
|
||||
}
|
||||
|
||||
FontFamily::FontFamily()
|
||||
: m_defaultVariation(0)
|
||||
{
|
||||
for (unsigned int i = 0; i < kNumVariations; i++)
|
||||
{
|
||||
m_fonts[i] = nullptr;
|
||||
m_hacks[i] = FontHacks_None;
|
||||
}
|
||||
}
|
||||
|
||||
FontFamily::~FontFamily()
|
||||
{
|
||||
for (unsigned int i = 0; i < kNumVariations; i++)
|
||||
{
|
||||
if (PortabilityLayer::HostFont *font = m_fonts[i])
|
||||
font->Destroy();
|
||||
}
|
||||
}
|
||||
}
|
44
PortabilityLayer/FontFamily.h
Normal file
44
PortabilityLayer/FontFamily.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "FontHacks.h"
|
||||
#include <stdint.h>
|
||||
|
||||
class PLPasStr;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class HostFont;
|
||||
|
||||
enum FontFamilyFlags
|
||||
{
|
||||
FontFamilyFlag_None = 0,
|
||||
|
||||
FontFamilyFlag_Bold = 1,
|
||||
|
||||
FontFamilyFlag_All = 1,
|
||||
};
|
||||
|
||||
class FontFamily final
|
||||
{
|
||||
public:
|
||||
static const unsigned int kNumVariations = FontFamilyFlag_All + 1;
|
||||
|
||||
void AddFont(int flags, const char *path, FontHacks fontHacks);
|
||||
void SetDefaultVariation(int defaultVariation);
|
||||
|
||||
int GetVariationForFlags(int variation) const;
|
||||
PortabilityLayer::HostFont *GetFontForVariation(int variation) const;
|
||||
PortabilityLayer::FontHacks GetHacksForVariation(int variation) const;
|
||||
|
||||
static FontFamily *Create();
|
||||
void Destroy();
|
||||
|
||||
private:
|
||||
PortabilityLayer::FontHacks m_hacks[kNumVariations];
|
||||
PortabilityLayer::HostFont *m_fonts[kNumVariations];
|
||||
uint8_t m_defaultVariation;
|
||||
|
||||
FontFamily();
|
||||
~FontFamily();
|
||||
};
|
||||
}
|
10
PortabilityLayer/FontHacks.h
Normal file
10
PortabilityLayer/FontHacks.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
enum FontHacks
|
||||
{
|
||||
FontHacks_None,
|
||||
FontHacks_Roboto,
|
||||
};
|
||||
}
|
@@ -1,45 +1,83 @@
|
||||
#include "FontManager.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontRenderer.h"
|
||||
|
||||
#include "HostFileSystem.h"
|
||||
#include "HostFont.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "IOStream.h"
|
||||
#include "RenderedFont.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void PL_NotYetImplemented();
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
{
|
||||
class FontManagerImpl final : public FontManager
|
||||
{
|
||||
public:
|
||||
void Init() override;
|
||||
void Shutdown() override;
|
||||
|
||||
FontFamily *GetSystemFont(int textSize, int variationFlags) const override;
|
||||
FontFamily *GetApplicationFont(int textSize, int variationFlags) const override;
|
||||
|
||||
RenderedFont *GetRenderedFont(HostFont *font, int size, FontHacks fontHacks) override;
|
||||
|
||||
static FontManagerImpl *GetInstance();
|
||||
|
||||
private:
|
||||
static const unsigned int kNumCachedRenderedFonts = 32;
|
||||
|
||||
struct CachedRenderedFont
|
||||
{
|
||||
RenderedFont *m_rfont;
|
||||
const HostFont *m_font;
|
||||
int m_size;
|
||||
uint32_t m_lastUsage;
|
||||
};
|
||||
|
||||
FontManagerImpl();
|
||||
|
||||
PortabilityLayer::HostFont *m_systemFont;
|
||||
void ResetUsageCounter();
|
||||
static int CRFSortPredicate(const void *a, const void *b);
|
||||
|
||||
FontFamily *m_systemFont;
|
||||
FontFamily *m_applicationFont;
|
||||
uint32_t m_usageCounter;
|
||||
|
||||
CachedRenderedFont m_cachedRenderedFonts[kNumCachedRenderedFonts];
|
||||
|
||||
static FontManagerImpl ms_instance;
|
||||
};
|
||||
|
||||
void FontManagerImpl::Init()
|
||||
{
|
||||
m_systemFont = nullptr;
|
||||
m_systemFont = FontFamily::Create();
|
||||
m_applicationFont = FontFamily::Create();
|
||||
|
||||
if (IOStream *sysFontStream = HostFileSystem::GetInstance()->OpenFile(EVirtualDirectory_Fonts, "virtue.ttf", false, false))
|
||||
if (m_systemFont)
|
||||
m_systemFont->AddFont(FontFamilyFlag_None, "Fonts/Virtue/virtue.ttf", FontHacks_None);
|
||||
|
||||
if (m_applicationFont)
|
||||
{
|
||||
HostFont *font = HostFontHandler::GetInstance()->LoadFont(sysFontStream);
|
||||
sysFontStream->Close();
|
||||
|
||||
m_systemFont = font;
|
||||
m_applicationFont->AddFont(FontFamilyFlag_None, "Fonts/Roboto/Roboto-Regular.ttf", FontHacks_Roboto);
|
||||
m_applicationFont->AddFont(FontFamilyFlag_Bold, "Fonts/Roboto/Roboto-Bold.ttf", FontHacks_Roboto);
|
||||
}
|
||||
|
||||
memset(m_cachedRenderedFonts, 0, sizeof(m_cachedRenderedFonts));
|
||||
}
|
||||
|
||||
void FontManagerImpl::Shutdown()
|
||||
{
|
||||
if (m_systemFont)
|
||||
m_systemFont->Destroy();
|
||||
|
||||
if (m_applicationFont)
|
||||
m_applicationFont->Destroy();
|
||||
|
||||
HostFontHandler *hfh = HostFontHandler::GetInstance();
|
||||
|
||||
if (m_systemFont)
|
||||
@@ -47,6 +85,76 @@ namespace PortabilityLayer
|
||||
m_systemFont->Destroy();
|
||||
m_systemFont = nullptr;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeof(m_cachedRenderedFonts) / sizeof(m_cachedRenderedFonts[0]); i++)
|
||||
{
|
||||
CachedRenderedFont *crf = m_cachedRenderedFonts + i;
|
||||
if (crf->m_rfont)
|
||||
crf->m_rfont->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
FontFamily *FontManagerImpl::GetSystemFont(int textSize, int variationFlags) const
|
||||
{
|
||||
(void)textSize;
|
||||
return m_systemFont;
|
||||
}
|
||||
|
||||
FontFamily *FontManagerImpl::GetApplicationFont(int textSize, int variationFlags) const
|
||||
{
|
||||
if (textSize < 11 && (variationFlags & FontFamilyFlag_Bold) != 0)
|
||||
return m_systemFont; // Roboto Bold below 11pt doesn't even look bold, so use a better font
|
||||
|
||||
return m_applicationFont;
|
||||
}
|
||||
|
||||
RenderedFont *FontManagerImpl::GetRenderedFont(HostFont *font, int size, FontHacks fontHacks)
|
||||
{
|
||||
CachedRenderedFont *newCacheSlot = &m_cachedRenderedFonts[0];
|
||||
|
||||
for (int i = 0; i < kNumCachedRenderedFonts; i++)
|
||||
{
|
||||
CachedRenderedFont &crf = m_cachedRenderedFonts[i];
|
||||
if (crf.m_rfont == nullptr)
|
||||
{
|
||||
newCacheSlot = &crf;
|
||||
break;
|
||||
}
|
||||
|
||||
if (crf.m_font == font && crf.m_size == size)
|
||||
{
|
||||
crf.m_lastUsage = m_usageCounter;
|
||||
RenderedFont *rf = crf.m_rfont;
|
||||
if (m_usageCounter == UINT32_MAX)
|
||||
ResetUsageCounter();
|
||||
else
|
||||
m_usageCounter++;
|
||||
|
||||
return rf;
|
||||
}
|
||||
|
||||
if (newCacheSlot->m_rfont != nullptr && crf.m_lastUsage < newCacheSlot->m_lastUsage)
|
||||
newCacheSlot = &crf;
|
||||
}
|
||||
|
||||
RenderedFont *rfont = FontRenderer::GetInstance()->RenderFont(font, size, fontHacks);
|
||||
if (!rfont)
|
||||
return nullptr;
|
||||
|
||||
if (newCacheSlot->m_rfont)
|
||||
newCacheSlot->m_rfont->Destroy();
|
||||
|
||||
newCacheSlot->m_font = font;
|
||||
newCacheSlot->m_lastUsage = m_usageCounter;
|
||||
newCacheSlot->m_size = size;
|
||||
newCacheSlot->m_rfont = rfont;
|
||||
|
||||
if (m_usageCounter == UINT32_MAX)
|
||||
ResetUsageCounter();
|
||||
else
|
||||
m_usageCounter++;
|
||||
|
||||
return rfont;
|
||||
}
|
||||
|
||||
FontManagerImpl *FontManagerImpl::GetInstance()
|
||||
@@ -59,6 +167,47 @@ namespace PortabilityLayer
|
||||
{
|
||||
}
|
||||
|
||||
void FontManagerImpl::ResetUsageCounter()
|
||||
{
|
||||
// Resets the usage counter if it would overflow by sorting by ascending last usage and then resetting all counts to simple +1 increments
|
||||
qsort(m_cachedRenderedFonts, kNumCachedRenderedFonts, sizeof(CachedRenderedFont), FontManagerImpl::CRFSortPredicate);
|
||||
|
||||
m_usageCounter = 0;
|
||||
|
||||
for (unsigned int i = 0; i < kNumCachedRenderedFonts; i++)
|
||||
{
|
||||
CachedRenderedFont &crf = m_cachedRenderedFonts[i];
|
||||
|
||||
if (!crf.m_rfont)
|
||||
break;
|
||||
|
||||
crf.m_lastUsage = m_usageCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
int FontManagerImpl::CRFSortPredicate(const void *a, const void *b)
|
||||
{
|
||||
const CachedRenderedFont *crfA = static_cast<const CachedRenderedFont *>(a);
|
||||
const CachedRenderedFont *crfB = static_cast<const CachedRenderedFont *>(b);
|
||||
|
||||
if (crfA->m_rfont == nullptr && crfB->m_rfont == nullptr)
|
||||
return 0;
|
||||
|
||||
if (crfA->m_rfont == nullptr && crfB->m_rfont != nullptr)
|
||||
return 1;
|
||||
|
||||
if (crfA->m_rfont != nullptr && crfB->m_rfont == nullptr)
|
||||
return -1;
|
||||
|
||||
if (crfA->m_lastUsage < crfB->m_lastUsage)
|
||||
return -1;
|
||||
|
||||
if (crfA->m_lastUsage > crfB->m_lastUsage)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
FontManagerImpl FontManagerImpl::ms_instance;
|
||||
|
||||
FontManager *FontManager::GetInstance()
|
||||
|
@@ -1,13 +1,24 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "FontHacks.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
{
|
||||
class FontFamily;
|
||||
class HostFont;
|
||||
class RenderedFont;
|
||||
|
||||
class FontManager
|
||||
{
|
||||
public:
|
||||
virtual void Init() = 0;
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual FontFamily *GetSystemFont(int fontSize, int variationFlags) const = 0;
|
||||
virtual FontFamily *GetApplicationFont(int fontSize, int variationFlags) const = 0;
|
||||
|
||||
virtual RenderedFont *GetRenderedFont(HostFont *font, int size, FontHacks fontHacks) = 0;
|
||||
|
||||
static FontManager *GetInstance();
|
||||
};
|
||||
}
|
||||
|
198
PortabilityLayer/FontRenderer.cpp
Normal file
198
PortabilityLayer/FontRenderer.cpp
Normal file
@@ -0,0 +1,198 @@
|
||||
#include "FontRenderer.h"
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "HostFont.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "HostFontRenderedGlyph.h"
|
||||
#include "MacRoman.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <new>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class RenderedFontImpl final : public RenderedFont
|
||||
{
|
||||
public:
|
||||
bool GetGlyph(unsigned int character, const RenderedGlyphMetrics **outMetricsPtr, const void **outData) const override;
|
||||
|
||||
void Destroy() override;
|
||||
|
||||
void SetCharData(unsigned int charID, const void *data, size_t dataOffset, const RenderedGlyphMetrics &metrics);
|
||||
|
||||
static RenderedFontImpl *Create(size_t glyphDataSize);
|
||||
|
||||
private:
|
||||
explicit RenderedFontImpl(void *data);
|
||||
~RenderedFontImpl();
|
||||
|
||||
size_t m_dataOffsets[256];
|
||||
RenderedGlyphMetrics m_metrics[256];
|
||||
|
||||
void *m_data;
|
||||
};
|
||||
|
||||
class FontRendererImpl final : public FontRenderer
|
||||
{
|
||||
public:
|
||||
RenderedFont *RenderFont(HostFont *font, int size, FontHacks fontHacks) override;
|
||||
|
||||
static FontRendererImpl *GetInstance();
|
||||
|
||||
private:
|
||||
static FontRendererImpl ms_instance;
|
||||
};
|
||||
|
||||
bool RenderedFontImpl::GetGlyph(unsigned int character, const RenderedGlyphMetrics **outMetricsPtr, const void **outData) const
|
||||
{
|
||||
const size_t dataOffset = m_dataOffsets[character];
|
||||
if (!dataOffset)
|
||||
return false;
|
||||
|
||||
*outMetricsPtr = m_metrics + character;
|
||||
*outData = static_cast<const uint8_t*>(m_data) + dataOffset;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void RenderedFontImpl::Destroy()
|
||||
{
|
||||
this->~RenderedFontImpl();
|
||||
free(this);
|
||||
}
|
||||
|
||||
void RenderedFontImpl::SetCharData(unsigned int charID, const void *data, size_t dataOffset, const RenderedGlyphMetrics &metrics)
|
||||
{
|
||||
m_dataOffsets[charID] = dataOffset;
|
||||
m_metrics[charID] = metrics;
|
||||
memcpy(static_cast<uint8_t*>(m_data) + dataOffset, data, metrics.m_glyphDataPitch * metrics.m_glyphHeight);
|
||||
}
|
||||
|
||||
RenderedFontImpl *RenderedFontImpl::Create(size_t glyphDataSize)
|
||||
{
|
||||
size_t alignedPrefixSize = sizeof(RenderedFontImpl) + PL_SYSTEM_MEMORY_ALIGNMENT - 1;
|
||||
alignedPrefixSize -= alignedPrefixSize % PL_SYSTEM_MEMORY_ALIGNMENT;
|
||||
|
||||
if (SIZE_MAX - alignedPrefixSize < glyphDataSize)
|
||||
return nullptr;
|
||||
|
||||
const size_t allocSize = alignedPrefixSize + glyphDataSize;
|
||||
|
||||
void *storage = malloc(allocSize);
|
||||
if (!storage)
|
||||
return nullptr;
|
||||
|
||||
memset(storage, 0, allocSize);
|
||||
|
||||
return new (storage) RenderedFontImpl(static_cast<uint8_t*>(storage) + alignedPrefixSize);
|
||||
}
|
||||
|
||||
RenderedFontImpl::RenderedFontImpl(void *data)
|
||||
: m_data(data)
|
||||
{
|
||||
memset(m_metrics, 0, sizeof(m_metrics));
|
||||
memset(m_dataOffsets, 0, sizeof(m_dataOffsets));
|
||||
}
|
||||
|
||||
RenderedFontImpl::~RenderedFontImpl()
|
||||
{
|
||||
}
|
||||
|
||||
RenderedFont *FontRendererImpl::RenderFont(HostFont *font, int size, FontHacks fontHacks)
|
||||
{
|
||||
const unsigned int numCharacters = 256;
|
||||
|
||||
if (size < 1)
|
||||
return nullptr;
|
||||
|
||||
HostFontRenderedGlyph *glyphs[numCharacters];
|
||||
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
glyphs[i] = nullptr;
|
||||
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
{
|
||||
uint16_t unicodeCodePoint = MacRoman::g_toUnicode[i];
|
||||
if (unicodeCodePoint == 0xffff)
|
||||
continue;
|
||||
|
||||
glyphs[i] = font->Render(unicodeCodePoint, size);
|
||||
}
|
||||
|
||||
size_t glyphDataSize = PL_SYSTEM_MEMORY_ALIGNMENT; // So we can use 0 to mean no data
|
||||
size_t numUsedGlyphs = 0;
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
{
|
||||
if (glyphs[i])
|
||||
{
|
||||
const RenderedGlyphMetrics &metrics = glyphs[i]->GetMetrics();
|
||||
glyphDataSize += metrics.m_glyphDataPitch * metrics.m_glyphHeight;
|
||||
}
|
||||
}
|
||||
|
||||
RenderedFontImpl *rfont = RenderedFontImpl::Create(glyphDataSize);
|
||||
if (rfont)
|
||||
{
|
||||
size_t fillOffset = PL_SYSTEM_MEMORY_ALIGNMENT;
|
||||
|
||||
size_t numUsedGlyphs = 0;
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
{
|
||||
if (glyphs[i])
|
||||
{
|
||||
HostFontRenderedGlyph *glyph = glyphs[i];
|
||||
|
||||
RenderedGlyphMetrics metrics = glyph->GetMetrics();
|
||||
const void *data = glyph->GetData();
|
||||
|
||||
if (fontHacks == FontHacks_Roboto)
|
||||
{
|
||||
if (size < 32)
|
||||
{
|
||||
// 'r' is shifted up 1 pixel
|
||||
if (i == 'r' && size < 32)
|
||||
{
|
||||
metrics.m_bearingY--;
|
||||
}
|
||||
|
||||
// ':' doesn't have enough spacing
|
||||
if (i == ':')
|
||||
{
|
||||
metrics.m_bearingX++;
|
||||
metrics.m_advanceX++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rfont->SetCharData(i, data, fillOffset, metrics);
|
||||
|
||||
fillOffset += metrics.m_glyphDataPitch * metrics.m_glyphHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < numCharacters; i++)
|
||||
{
|
||||
if (glyphs[i])
|
||||
glyphs[i]->Destroy();
|
||||
}
|
||||
|
||||
return rfont;
|
||||
}
|
||||
|
||||
FontRendererImpl *FontRendererImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
}
|
||||
|
||||
FontRendererImpl FontRendererImpl::ms_instance;
|
||||
|
||||
FontRenderer *FontRenderer::GetInstance()
|
||||
{
|
||||
return FontRendererImpl::GetInstance();
|
||||
}
|
||||
}
|
17
PortabilityLayer/FontRenderer.h
Normal file
17
PortabilityLayer/FontRenderer.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include "FontHacks.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class RenderedFont;
|
||||
class HostFont;
|
||||
|
||||
class FontRenderer
|
||||
{
|
||||
public:
|
||||
virtual RenderedFont *RenderFont(HostFont *font, int size, FontHacks fontHacks) = 0;
|
||||
|
||||
static FontRenderer *GetInstance();
|
||||
};
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
#ifndef __PL_HOST_DISPLAY_DRIVER_H__
|
||||
#define __PL_HOST_DISPLAY_DRIVER_H__
|
||||
|
||||
#include "PixelFormat.h"
|
||||
#include "GpPixelFormat.h"
|
||||
#include "EGpStandardCursor.h"
|
||||
|
||||
struct IGpColorCursor;
|
||||
@@ -12,7 +12,7 @@ namespace PortabilityLayer
|
||||
class HostDisplayDriver
|
||||
{
|
||||
public:
|
||||
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height, PixelFormat *pixelFormat) = 0;
|
||||
virtual void GetDisplayResolution(unsigned int *width, unsigned int *height, GpPixelFormat_t *pixelFormat) = 0;
|
||||
virtual IGpColorCursor *LoadColorCursor(int id) = 0;
|
||||
virtual void SetColorCursor(IGpColorCursor *colorCursor) = 0;
|
||||
virtual void SetStandardCursor(EGpStandardCursor_t standardCursor) = 0;
|
||||
|
@@ -1,10 +1,15 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
{
|
||||
class HostFontRenderedGlyph;
|
||||
|
||||
class HostFont
|
||||
{
|
||||
public:
|
||||
virtual void Destroy() = 0;
|
||||
virtual HostFontRenderedGlyph *Render(uint32_t unicodeCodePoint, unsigned int size) = 0;
|
||||
};
|
||||
}
|
||||
|
@@ -1,16 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream;
|
||||
class HostFont;
|
||||
|
||||
|
||||
class HostFontHandler
|
||||
{
|
||||
public:
|
||||
virtual void Shutdown() = 0;
|
||||
|
||||
virtual HostFont *LoadFont(IOStream *stream) = 0;
|
||||
virtual bool KeepStreamOpen() const = 0;
|
||||
|
||||
static void SetInstance(HostFontHandler *instance);
|
||||
static HostFontHandler *GetInstance();
|
||||
|
14
PortabilityLayer/HostFontRenderedGlyph.h
Normal file
14
PortabilityLayer/HostFontRenderedGlyph.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedGlyphMetrics;
|
||||
|
||||
class HostFontRenderedGlyph
|
||||
{
|
||||
public:
|
||||
virtual const RenderedGlyphMetrics &GetMetrics() const = 0;
|
||||
virtual const void *GetData() const = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
}
|
@@ -1,29 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_IOTREAM_H__
|
||||
#define __PL_IOTREAM_H__
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef __PL_IOTREAM_H__
|
||||
#define __PL_IOTREAM_H__
|
||||
|
||||
#include "DataTypes.h"
|
||||
#include "FilePos.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream
|
||||
{
|
||||
public:
|
||||
virtual size_t Read(void *bytesOut, size_t size) = 0;
|
||||
virtual size_t Write(const void *bytes, size_t size) = 0;
|
||||
virtual bool IsSeekable() const = 0;
|
||||
virtual bool IsReadOnly() const = 0;
|
||||
virtual bool IsWriteOnly() const = 0;
|
||||
virtual bool SeekStart(UFilePos_t loc) = 0;
|
||||
virtual bool SeekCurrent(FilePos_t loc) = 0;
|
||||
virtual bool SeekEnd(UFilePos_t loc) = 0;
|
||||
virtual bool Truncate(UFilePos_t loc) = 0;
|
||||
virtual UFilePos_t Size() const = 0;
|
||||
virtual UFilePos_t Tell() const = 0;
|
||||
virtual void Close() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
#include "FilePos.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class IOStream
|
||||
{
|
||||
public:
|
||||
virtual size_t Read(void *bytesOut, size_t size) = 0;
|
||||
virtual size_t Write(const void *bytes, size_t size) = 0;
|
||||
virtual bool IsSeekable() const = 0;
|
||||
virtual bool IsReadOnly() const = 0;
|
||||
virtual bool IsWriteOnly() const = 0;
|
||||
virtual bool SeekStart(UFilePos_t loc) = 0;
|
||||
virtual bool SeekCurrent(FilePos_t loc) = 0;
|
||||
virtual bool SeekEnd(UFilePos_t loc) = 0;
|
||||
virtual bool Truncate(UFilePos_t loc) = 0;
|
||||
virtual UFilePos_t Size() const = 0;
|
||||
virtual UFilePos_t Tell() const = 0;
|
||||
virtual void Close() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -1,95 +0,0 @@
|
||||
#include "MacLatin.h"
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
namespace MacLatin
|
||||
{
|
||||
const uint16_t g_toUnicode[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1, 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8, // 8
|
||||
0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3, 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc, // 9
|
||||
0x00dd, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x00d7, 0x00b6, 0x00df, 0x00ae, 0x00a9, 0x00b2, 0x00b4, 0x00a8, 0x00b3, 0x00c6, 0x00d8, // 10
|
||||
0x00b9, 0x00b1, 0x00bc, 0x00bd, 0x00a5, 0x00b5, 0xffff, 0xffff, 0xffff, 0xffff, 0x00be, 0x00aa, 0x00ba, 0xffff, 0x00e6, 0x00f8, // 11
|
||||
0x00bf, 0x00a1, 0x00ac, 0x0141, 0x0192, 0x02cb, 0xffff, 0x00ab, 0x00bb, 0x00a6, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153, // 12
|
||||
0x00ad, 0xffff, 0xffff, 0xffff, 0x0142, 0xffff, 0x00f7, 0xffff, 0x00ff, 0x0178, 0xffff, 0x00a4, 0x00d0, 0x00f0, 0x00de, 0x00fe, // 13
|
||||
0x00fd, 0x00b7, 0xffff, 0xffff, 0xffff, 0x00c2, 0x00ca, 0x00c1, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4, // 14
|
||||
0xffff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc, 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7, // 15
|
||||
};
|
||||
|
||||
const uint8_t g_stripDiacritic[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
'A', 'A', 'C', 'E', 'N', 'O', 'U', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', // 8
|
||||
'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', // 9
|
||||
'Y', 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 'O', // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 'o', // b
|
||||
192, 193, 194, 'L', 196, 197, 198, 199, 200, 201, 202, 'A', 'A', 'O', 206, 207, // c
|
||||
208, 209, 210, 211, 'l', 213, 214, 215, 'y', 'Y', 218, 219, 220, 221, 222, 223, // d
|
||||
224, 225, 226, 227, 228, 'A', 'E', 'A', 'E', 'E', 'I', 'I', 'I', 'I', 'O', 'O', // e
|
||||
240, 'O', 'U', 'U', 'U', 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
|
||||
const uint8_t g_toUpper[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, // 4
|
||||
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, // 5
|
||||
96, 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', // 6
|
||||
'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 123, 124, 125, 126, 127, // 7
|
||||
|
||||
128, 129, 130, 131, 132, 133, 134, 231, 203, 229, 128, 204, 129, 130, 131, 143, // 8
|
||||
230, 232, 234, 237, 235, 236, 132, 238, 241, 239, 133, 205, 242, 244, 243, 134, // 9
|
||||
160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 174, 175, // b
|
||||
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 206, // c
|
||||
208, 209, 210, 211, 195, 213, 214, 215, 217, 217, 218, 219, 220, 220, 222, 222, // d
|
||||
160, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, // e
|
||||
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
|
||||
const uint8_t g_toLower[256] =
|
||||
{
|
||||
// 0 1 2 3 4 5 6 7 8 9 a b c d e f
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, // 0
|
||||
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, // 1
|
||||
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, // 2
|
||||
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, // 3
|
||||
64, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', // 4
|
||||
'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 91, 92, 93, 94, 95, // 5
|
||||
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, // 6
|
||||
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, // 7
|
||||
|
||||
138, 140, 141, 142, 150, 154, 159, 135, 136, 137, 138, 139, 140, 141, 142, 143, // 8
|
||||
144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, // 9
|
||||
224, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 190, 191, // a
|
||||
176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, // b
|
||||
192, 193, 194, 212, 196, 197, 198, 199, 200, 201, 202, 136, 139, 155, 207, 207, // c
|
||||
208, 209, 210, 211, 212, 213, 214, 215, 216, 216, 218, 219, 221, 221, 223, 223, // d
|
||||
224, 225, 226, 227, 228, 137, 144, 135, 145, 143, 146, 148, 149, 147, 151, 153, // e
|
||||
240, 152, 156, 158, 157, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, // f
|
||||
};
|
||||
}
|
||||
}
|
88
PortabilityLayer/MacRoman.cpp
Normal file
88
PortabilityLayer/MacRoman.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
#include "MacRoman.h"
|
||||
|
||||
// This file is automatically generated by the ImportCharSet tool. DO NOT MODIFY THIS BY HAND.
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
namespace MacRoman
|
||||
{
|
||||
const uint16_t g_toUnicode[256] =
|
||||
{
|
||||
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
|
||||
0x0010, 0x2318, 0x21e7, 0x2325, 0x2303, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f,
|
||||
0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f,
|
||||
0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f,
|
||||
0x0040, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f,
|
||||
0x0050, 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f,
|
||||
0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
|
||||
0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x007b, 0x007c, 0x007d, 0x007e, 0xffff,
|
||||
0x00c4, 0x00c5, 0x00c7, 0x00c9, 0x00d1, 0x00d6, 0x00dc, 0x00e1, 0x00e0, 0x00e2, 0x00e4, 0x00e3, 0x00e5, 0x00e7, 0x00e9, 0x00e8,
|
||||
0x00ea, 0x00eb, 0x00ed, 0x00ec, 0x00ee, 0x00ef, 0x00f1, 0x00f3, 0x00f2, 0x00f4, 0x00f6, 0x00f5, 0x00fa, 0x00f9, 0x00fb, 0x00fc,
|
||||
0x2020, 0x00b0, 0x00a2, 0x00a3, 0x00a7, 0x2022, 0x00b6, 0x00df, 0x00ae, 0x00a9, 0x2122, 0x00b4, 0x00a8, 0x2260, 0x00c6, 0x00d8,
|
||||
0x221e, 0x00b1, 0x2264, 0x2265, 0x00a5, 0x00b5, 0x2202, 0x2211, 0x220f, 0x03c0, 0x222b, 0x00aa, 0x00ba, 0x03a9, 0x00e6, 0x00f8,
|
||||
0x00bf, 0x00a1, 0x00ac, 0x221a, 0x0192, 0x2248, 0x2206, 0x00ab, 0x00bb, 0x2026, 0x00a0, 0x00c0, 0x00c3, 0x00d5, 0x0152, 0x0153,
|
||||
0x2013, 0x2014, 0x201c, 0x201d, 0x2018, 0x2019, 0x00f7, 0x25ca, 0x00ff, 0x0178, 0x2044, 0x20ac, 0x2039, 0x203a, 0xfb01, 0xfb02,
|
||||
0x2021, 0x00b7, 0x201a, 0x201e, 0x2030, 0x00c2, 0x00ca, 0x00c1, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00d3, 0x00d4,
|
||||
0xf8ff, 0x00d2, 0x00da, 0x00db, 0x00d9, 0x0131, 0x02c6, 0x02dc, 0x00af, 0x02d8, 0x02d9, 0x02da, 0x00b8, 0x02dd, 0x02db, 0x02c7,
|
||||
};
|
||||
|
||||
const uint8_t g_toUpper[256] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0xe7, 0xcb, 0xe5, 0x80, 0xcc, 0x81, 0x82, 0x83, 0xe9,
|
||||
0xe6, 0xe8, 0xea, 0xed, 0xeb, 0xec, 0x84, 0xee, 0xf1, 0xef, 0x85, 0xcd, 0xf2, 0xf4, 0xf3, 0x86,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xae, 0xaf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xce,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd9, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
|
||||
0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
};
|
||||
|
||||
const uint8_t g_toLower[256] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x8a, 0x8c, 0x8d, 0x8e, 0x96, 0x9a, 0x9f, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xbe, 0xbf,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0x88, 0x8b, 0x9b, 0xcf, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd8, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x89, 0x90, 0x87, 0x91, 0x8f, 0x92, 0x94, 0x95, 0x93, 0x97, 0x99,
|
||||
0xf0, 0x98, 0x9c, 0x9e, 0x9d, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
};
|
||||
|
||||
const uint8_t g_stripDiacritic[256] =
|
||||
{
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
||||
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
|
||||
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
|
||||
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
|
||||
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
|
||||
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
|
||||
0x41, 0x41, 0x43, 0x45, 0x4e, 0x4f, 0x55, 0x61, 0x61, 0x61, 0x61, 0x61, 0x61, 0x63, 0x65, 0x65,
|
||||
0x65, 0x65, 0x69, 0x69, 0x69, 0x69, 0x6e, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x75, 0x75, 0x75, 0x75,
|
||||
0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0x73, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0x41, 0x4f,
|
||||
0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0x61, 0x6f,
|
||||
0xc0, 0xc1, 0xc2, 0xc3, 0x66, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0x41, 0x41, 0x4f, 0xce, 0xcf,
|
||||
0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0x79, 0x59, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
|
||||
0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x41, 0x45, 0x41, 0x45, 0x45, 0x49, 0x49, 0x49, 0x49, 0x4f, 0x4f,
|
||||
0xf0, 0x4f, 0x55, 0x55, 0x55, 0x64, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||
};
|
||||
}
|
||||
}
|
@@ -1,10 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
namespace MacLatin
|
||||
namespace MacRoman
|
||||
{
|
||||
extern const uint16_t g_toUnicode[256];
|
||||
extern const uint8_t g_stripDiacritic[256];
|
@@ -10,6 +10,8 @@ struct MenuItem
|
||||
uint8_t key;
|
||||
uint8_t submenuID;
|
||||
uint8_t textStyle;
|
||||
bool enabled;
|
||||
bool checked;
|
||||
};
|
||||
|
||||
struct Menu
|
||||
@@ -18,7 +20,7 @@ struct Menu
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint16_t commandID;
|
||||
uint32_t itemEnabledMask;
|
||||
bool enabled;
|
||||
|
||||
PortabilityLayer::MMHandleBlock *stringBlobHandle;
|
||||
|
||||
@@ -27,7 +29,7 @@ struct Menu
|
||||
|
||||
size_t numMenuItems;
|
||||
MenuItem menuItems[1];
|
||||
};
|
||||
};
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
@@ -43,6 +45,9 @@ namespace PortabilityLayer
|
||||
void InsertMenuAfter(Menu **insertingMenu, Menu **existingMenu) override;
|
||||
void InsertMenuAtEnd(Menu **insertingMenu) override;
|
||||
void InsertMenuAtBeginning(Menu **insertingMenu) override;
|
||||
void SetMenuEnabled(Menu **menuHandle, bool enabled) override;
|
||||
void SetItemEnabled(Menu **menu, unsigned int index, bool enabled) override;
|
||||
void SetItemChecked(Menu **menu, unsigned int index, bool checked) override;
|
||||
|
||||
static MenuManagerImpl *GetInstance();
|
||||
|
||||
@@ -109,18 +114,22 @@ namespace PortabilityLayer
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t enableFlags = header.enableFlags;
|
||||
|
||||
Menu *menu = static_cast<Menu*>(menuData->m_contents);
|
||||
menu->menuID = header.menuID;
|
||||
menu->width = header.width;
|
||||
menu->height = header.height;
|
||||
menu->commandID = header.commandID;
|
||||
menu->itemEnabledMask = header.enableFlags;
|
||||
menu->enabled = ((enableFlags & 1) != 0);
|
||||
|
||||
uint8_t *stringDataStart = static_cast<uint8_t*>(stringData->m_contents);
|
||||
uint8_t *stringDest = stringDataStart;
|
||||
memcpy(stringDest, resBytes + 14, 1 + resBytes[14]);
|
||||
stringDest += 1 + resBytes[14];
|
||||
|
||||
enableFlags >>= 1;
|
||||
|
||||
MenuItem *currentItem = menu->menuItems;
|
||||
for (const uint8_t *menuItemStart = menuDataStart; *menuItemStart; menuItemStart += 5 + (*menuItemStart))
|
||||
{
|
||||
@@ -132,7 +141,11 @@ namespace PortabilityLayer
|
||||
currentItem->key = menuItemStart[2 + itemNameLength];
|
||||
currentItem->submenuID = menuItemStart[3 + itemNameLength];
|
||||
currentItem->textStyle = menuItemStart[4 + itemNameLength];
|
||||
currentItem->nameOffsetInStringBlob = stringDest - stringDataStart;
|
||||
currentItem->nameOffsetInStringBlob = static_cast<uint32_t>(stringDest - stringDataStart);
|
||||
currentItem->enabled = ((enableFlags & 1) != 0);
|
||||
currentItem->checked = false;
|
||||
|
||||
enableFlags >>= 1;
|
||||
|
||||
currentItem++;
|
||||
stringDest += 1 + (*menuItemStart);
|
||||
@@ -215,6 +228,33 @@ namespace PortabilityLayer
|
||||
m_firstMenu = insertingMenu;
|
||||
}
|
||||
|
||||
void MenuManagerImpl::SetMenuEnabled(Menu **menuHandle, bool enabled)
|
||||
{
|
||||
Menu *menu = *menuHandle;
|
||||
|
||||
menu->enabled = enabled;
|
||||
}
|
||||
|
||||
void MenuManagerImpl::SetItemEnabled(Menu **menuHandle, unsigned int index, bool enabled)
|
||||
{
|
||||
Menu *menu = *menuHandle;
|
||||
|
||||
if (index >= menu->numMenuItems)
|
||||
return;
|
||||
|
||||
menu->menuItems[index].enabled = enabled;
|
||||
}
|
||||
|
||||
void MenuManagerImpl::SetItemChecked(Menu **menuHandle, unsigned int index, bool checked)
|
||||
{
|
||||
Menu *menu = *menuHandle;
|
||||
|
||||
if (index >= menu->numMenuItems)
|
||||
return;
|
||||
|
||||
menu->menuItems[index].checked = checked;
|
||||
}
|
||||
|
||||
MenuManagerImpl *MenuManagerImpl::GetInstance()
|
||||
{
|
||||
return &ms_instance;
|
||||
|
@@ -13,6 +13,9 @@ namespace PortabilityLayer
|
||||
virtual void InsertMenuAfter(Menu **insertingMenu, Menu **existingMenu) = 0;
|
||||
virtual void InsertMenuAtEnd(Menu **insertingMenu) = 0;
|
||||
virtual void InsertMenuAtBeginning(Menu **insertingMenu) = 0;
|
||||
virtual void SetMenuEnabled(Menu **menuHandle, bool enabled) = 0;
|
||||
virtual void SetItemEnabled(Menu **menu, unsigned int index, bool enabled) = 0;
|
||||
virtual void SetItemChecked(Menu **menu, unsigned int index, bool checked) = 0;
|
||||
|
||||
static MenuManager *GetInstance();
|
||||
};
|
||||
|
@@ -59,25 +59,34 @@ void DrawMenuBar()
|
||||
|
||||
void HiliteMenu(int menu)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Menus");
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
||||
void EnableMenuItem(MenuHandle menu, int index)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Menus");
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
if (index == 0)
|
||||
mm->SetMenuEnabled(menu, true);
|
||||
else
|
||||
mm->SetItemEnabled(menu, index - 1, true);
|
||||
}
|
||||
|
||||
void DisableMenuItem(MenuHandle menu, int index)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Menus");
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
if (index == 0)
|
||||
mm->SetMenuEnabled(menu, false);
|
||||
else
|
||||
mm->SetItemEnabled(menu, index - 1, false);
|
||||
}
|
||||
|
||||
void CheckMenuItem(MenuHandle menu, int index, Boolean checked)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Menus");
|
||||
PortabilityLayer::MenuManager *mm = PortabilityLayer::MenuManager::GetInstance();
|
||||
mm->SetItemChecked(menu, index - 1, checked != 0);
|
||||
}
|
||||
|
||||
void SetMenuItemText(MenuHandle menu, int index, const PLPasStr &text)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Menus");
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
|
@@ -129,7 +129,7 @@ namespace PortabilityLayer
|
||||
|
||||
void *imageData = m_pixMap->GetPixelData();
|
||||
|
||||
if (m_pixMap->GetPixelFormat() == PixelFormat_8BitStandard)
|
||||
if (m_pixMap->GetPixelFormat() == GpPixelFormats::k8BitStandard)
|
||||
{
|
||||
switch (m_blitType)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ void DrawPicture(PicHandle pict, Rect *bounds)
|
||||
|
||||
switch (pixMap->GetPixelFormat())
|
||||
{
|
||||
case PortabilityLayer::PixelFormat_8BitStandard:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
PortabilityLayer::PixMapBlitEmitter blitEmitter(PortabilityLayer::Vec2i(bounds->left, bounds->top), pixMap);
|
||||
PortabilityLayer::QDPictDecoder decoder;
|
||||
|
@@ -2,8 +2,14 @@
|
||||
#include "QDManager.h"
|
||||
#include "QDState.h"
|
||||
#include "DisplayDeviceManager.h"
|
||||
#include "FontFamily.h"
|
||||
#include "FontManager.h"
|
||||
#include "MMHandleBlock.h"
|
||||
#include "MemoryManager.h"
|
||||
#include "HostFontHandler.h"
|
||||
#include "PLPasStr.h"
|
||||
#include "RenderedFont.h"
|
||||
#include "RenderedGlyphMetrics.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "ResTypeID.h"
|
||||
#include "RGBAColor.h"
|
||||
@@ -13,6 +19,7 @@
|
||||
#include "QDPixMap.h"
|
||||
#include "QDUtils.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h>
|
||||
|
||||
void GetPort(GrafPtr *graf)
|
||||
@@ -213,8 +220,8 @@ void Index2Color(int index, RGBColor *color)
|
||||
|
||||
PortabilityLayer::QDManager::GetInstance()->GetPort(&port, nullptr);
|
||||
|
||||
PortabilityLayer::PixelFormat pf = port->GetPixelFormat();
|
||||
if (pf == PortabilityLayer::PixelFormat_8BitCustom)
|
||||
GpPixelFormat_t pf = port->GetPixelFormat();
|
||||
if (pf == GpPixelFormats::k8BitCustom)
|
||||
{
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
@@ -238,9 +245,127 @@ void RGBForeColor(const RGBColor *color)
|
||||
PortabilityLayer::QDManager::GetInstance()->GetState()->SetForeColor(truncatedColor);
|
||||
}
|
||||
|
||||
static void DrawGlyph(PortabilityLayer::QDState *qdState, PixMap *pixMap, const Rect &rect, Point &penPos, const PortabilityLayer::RenderedFont *rfont, unsigned int character)
|
||||
{
|
||||
assert(rect.IsValid());
|
||||
|
||||
const PortabilityLayer::RenderedGlyphMetrics *metrics;
|
||||
const void *data;
|
||||
if (!rfont->GetGlyph(character, &metrics, &data))
|
||||
return;
|
||||
|
||||
const Point originalPoint = penPos;
|
||||
|
||||
penPos.h += metrics->m_advanceX;
|
||||
|
||||
const int32_t leftCoord = originalPoint.h + metrics->m_bearingX;
|
||||
const int32_t topCoord = originalPoint.v - metrics->m_bearingY;
|
||||
const int32_t rightCoord = leftCoord + metrics->m_glyphWidth;
|
||||
const int32_t bottomCoord = topCoord + metrics->m_glyphHeight;
|
||||
|
||||
const int32_t clampedLeftCoord = std::max<int32_t>(leftCoord, rect.left);
|
||||
const int32_t clampedTopCoord = std::max<int32_t>(topCoord, rect.top);
|
||||
const int32_t clampedRightCoord = std::min<int32_t>(rightCoord, rect.right);
|
||||
const int32_t clampedBottomCoord = std::min<int32_t>(bottomCoord, rect.bottom);
|
||||
|
||||
if (clampedLeftCoord >= clampedRightCoord || clampedTopCoord >= clampedBottomCoord)
|
||||
return;
|
||||
|
||||
const uint32_t firstOutputRow = clampedTopCoord - rect.top;
|
||||
const uint32_t firstOutputCol = clampedLeftCoord - rect.left;
|
||||
|
||||
const uint32_t firstInputRow = clampedTopCoord - topCoord;
|
||||
const uint32_t firstInputCol = clampedLeftCoord - leftCoord;
|
||||
|
||||
const uint32_t numCols = clampedRightCoord - clampedLeftCoord;
|
||||
const uint32_t numRows = clampedBottomCoord - clampedTopCoord;
|
||||
|
||||
const size_t inputPitch = metrics->m_glyphDataPitch;
|
||||
const size_t outputPitch = pixMap->m_pitch;
|
||||
const uint8_t *firstInputRowData = static_cast<const uint8_t*>(data) + firstInputRow * inputPitch;
|
||||
|
||||
switch (pixMap->m_pixelFormat)
|
||||
{
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
uint8_t *firstOutputRowData = static_cast<uint8_t*>(pixMap->m_data) + firstOutputRow * outputPitch;
|
||||
|
||||
const uint8_t color = qdState->ResolveForeColor8(nullptr, 0);
|
||||
for (uint32_t row = 0; row < numRows; row++)
|
||||
{
|
||||
const uint8_t *inputRowData = firstInputRowData + row * inputPitch;
|
||||
uint8_t *outputRowData = firstOutputRowData + row * outputPitch;
|
||||
|
||||
// It should be possible to speed this up, if needed. The input is guaranteed to be well-aligned and not mutable within this loop.
|
||||
for (uint32_t col = 0; col < numCols; col++)
|
||||
{
|
||||
const size_t inputOffset = firstInputCol + col;
|
||||
if (inputRowData[inputOffset / 8] & (1 << (inputOffset & 0x7)))
|
||||
outputRowData[firstOutputCol + col] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
PL_NotYetImplemented();
|
||||
}
|
||||
}
|
||||
|
||||
void DrawString(const PLPasStr &str)
|
||||
{
|
||||
PL_NotYetImplemented_TODO("Text");
|
||||
PortabilityLayer::QDManager *qdManager = PortabilityLayer::QDManager::GetInstance();
|
||||
|
||||
PortabilityLayer::QDPort *port = nullptr;
|
||||
qdManager->GetPort(&port, nullptr);
|
||||
|
||||
PortabilityLayer::QDState *qdState = qdManager->GetState();
|
||||
|
||||
PortabilityLayer::FontManager *fontManager = PortabilityLayer::FontManager::GetInstance();
|
||||
|
||||
const int textSize = qdState->m_textSize;
|
||||
const int textFace = qdState->m_textFace;
|
||||
const int fontID = qdState->m_fontID;
|
||||
|
||||
int variationFlags = 0;
|
||||
if (textFace & bold)
|
||||
variationFlags |= PortabilityLayer::FontFamilyFlag_Bold;
|
||||
|
||||
const PortabilityLayer::FontFamily *fontFamily = nullptr;
|
||||
|
||||
switch (fontID)
|
||||
{
|
||||
case applFont:
|
||||
fontFamily = fontManager->GetApplicationFont(textSize, variationFlags);
|
||||
break;
|
||||
case systemFont:
|
||||
fontFamily = fontManager->GetSystemFont(textSize, variationFlags);
|
||||
break;
|
||||
default:
|
||||
PL_NotYetImplemented();
|
||||
return;
|
||||
}
|
||||
|
||||
const int realVariation = fontFamily->GetVariationForFlags(variationFlags);
|
||||
PortabilityLayer::HostFont *font = fontFamily->GetFontForVariation(realVariation);
|
||||
|
||||
if (!font)
|
||||
return;
|
||||
|
||||
PortabilityLayer::RenderedFont *rfont = fontManager->GetRenderedFont(font, textSize, fontFamily->GetHacksForVariation(realVariation));
|
||||
|
||||
Point penPos = qdState->m_penPos;
|
||||
const size_t len = str.Length();
|
||||
const uint8_t *chars = str.UChars();
|
||||
|
||||
PixMap *pixMap = *port->GetPixMap();
|
||||
|
||||
const Rect rect = pixMap->m_rect;
|
||||
|
||||
if (!rect.IsValid())
|
||||
return; // ???
|
||||
|
||||
for (size_t i = 0; i < len; i++)
|
||||
DrawGlyph(qdState, pixMap, rect, penPos, rfont, chars[i]);
|
||||
}
|
||||
|
||||
void PaintRect(const Rect *rect)
|
||||
@@ -251,7 +376,7 @@ void PaintRect(const Rect *rect)
|
||||
PortabilityLayer::QDPort *qdPort;
|
||||
PortabilityLayer::QDManager::GetInstance()->GetPort(&qdPort, nullptr);
|
||||
|
||||
PortabilityLayer::PixelFormat pixelFormat = qdPort->GetPixelFormat();
|
||||
GpPixelFormat_t pixelFormat = qdPort->GetPixelFormat();
|
||||
|
||||
Rect constrainedRect = *rect;
|
||||
|
||||
@@ -281,7 +406,7 @@ void PaintRect(const Rect *rect)
|
||||
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case PortabilityLayer::PixelFormat_8BitStandard:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
{
|
||||
const uint8_t color = qdState->ResolveForeColor8(nullptr, 0);
|
||||
|
||||
@@ -417,7 +542,7 @@ void CopyBits(const BitMap *srcBitmap, BitMap *destBitmap, const Rect *srcRect,
|
||||
|
||||
const Rect &srcBounds = srcBitmap->m_rect;
|
||||
const Rect &destBounds = destBitmap->m_rect;
|
||||
const PortabilityLayer::PixelFormat pixelFormat = srcBitmap->m_pixelFormat;
|
||||
const GpPixelFormat_t pixelFormat = srcBitmap->m_pixelFormat;
|
||||
const size_t srcPitch = srcBitmap->m_pitch;
|
||||
const size_t destPitch = destBitmap->m_pitch;
|
||||
|
||||
@@ -462,17 +587,17 @@ void CopyBits(const BitMap *srcBitmap, BitMap *destBitmap, const Rect *srcRect,
|
||||
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case PortabilityLayer::PixelFormat_8BitCustom:
|
||||
case PortabilityLayer::PixelFormat_8BitStandard:
|
||||
case GpPixelFormats::k8BitCustom:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
pixelSizeBytes = 1;
|
||||
break;
|
||||
case PortabilityLayer::PixelFormat_RGB555:
|
||||
case GpPixelFormats::kRGB555:
|
||||
pixelSizeBytes = 2;
|
||||
break;
|
||||
case PortabilityLayer::PixelFormat_RGB24:
|
||||
case GpPixelFormats::kRGB24:
|
||||
pixelSizeBytes = 3;
|
||||
break;
|
||||
case PortabilityLayer::PixelFormat_RGB32:
|
||||
case GpPixelFormats::kRGB32:
|
||||
pixelSizeBytes = 4;
|
||||
break;
|
||||
};
|
||||
@@ -628,7 +753,7 @@ RgnHandle GetGrayRgn()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BitMap::Init(const Rect &rect, PortabilityLayer::PixelFormat pixelFormat, size_t pitch, void *dataPtr)
|
||||
void BitMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
||||
{
|
||||
m_rect = rect;
|
||||
m_pixelFormat = pixelFormat;
|
||||
|
@@ -26,33 +26,12 @@ enum IconSuiteFlags
|
||||
enum TextFlags
|
||||
{
|
||||
bold = 1,
|
||||
italicBit = 2,
|
||||
ulineBit = 4,
|
||||
outlineBit = 8,
|
||||
shadowBit = 16,
|
||||
condenseBit = 32,
|
||||
extendBit = 64,
|
||||
};
|
||||
|
||||
enum SystemFontID
|
||||
{
|
||||
systemFont = 0, // System font
|
||||
applFont = 1, // Application font
|
||||
newYork = 2,
|
||||
geneva = 3,
|
||||
monaco = 4,
|
||||
venice = 5,
|
||||
london = 6,
|
||||
athens = 7,
|
||||
sanFran = 8,
|
||||
toronto = 9,
|
||||
cairo = 11,
|
||||
losAngeles = 12,
|
||||
times = 20,
|
||||
helvetica = 21,
|
||||
courier = 22,
|
||||
symbol = 23,
|
||||
mobile = 24,
|
||||
};
|
||||
|
||||
enum SystemColorID
|
||||
@@ -88,11 +67,11 @@ struct CIcon
|
||||
struct BitMap
|
||||
{
|
||||
Rect m_rect;
|
||||
PortabilityLayer::PixelFormat m_pixelFormat;
|
||||
GpPixelFormat_t m_pixelFormat;
|
||||
size_t m_pitch;
|
||||
void *m_data;
|
||||
|
||||
void Init(const Rect &rect, PortabilityLayer::PixelFormat pixelFormat, size_t pitch, void *dataPtr);
|
||||
void Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr);
|
||||
};
|
||||
|
||||
struct RGBColor
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#include "PLStringCompare.h"
|
||||
#include "MacLatin.h"
|
||||
#include "MacRoman.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
Boolean EqualString(const PLPasStr &string1, const PLPasStr &string2, Boolean caseSensitive, Boolean diacriticSensitive)
|
||||
|
||||
Boolean EqualString(const PLPasStr &string1, const PLPasStr &string2, Boolean caseSensitive, Boolean diacriticSensitive)
|
||||
{
|
||||
const size_t len = string1.Length();
|
||||
if (len != string2.Length())
|
||||
@@ -16,55 +16,55 @@ Boolean EqualString(const PLPasStr &string1, const PLPasStr &string2, Boolean ca
|
||||
{
|
||||
// Case sensitive
|
||||
if (diacriticSensitive)
|
||||
{
|
||||
{
|
||||
// Diacritic sensitive
|
||||
return memcmp(chars1, chars2, len) ? PL_FALSE : PL_TRUE;
|
||||
return memcmp(chars1, chars2, len) ? PL_FALSE : PL_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Diacritic insensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = chars1[i];
|
||||
const uint8_t c2 = chars2[i];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_stripDiacritic[c1] != PortabilityLayer::MacLatin::g_stripDiacritic[c2])
|
||||
return PL_FALSE;
|
||||
|
||||
if (PortabilityLayer::MacRoman::g_stripDiacritic[c1] != PortabilityLayer::MacRoman::g_stripDiacritic[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
}
|
||||
return PL_TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Case insensitive
|
||||
if (diacriticSensitive)
|
||||
{
|
||||
{
|
||||
// Diacritic sensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = chars1[i];
|
||||
const uint8_t c2 = chars2[i];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_toLower[c1] != PortabilityLayer::MacLatin::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
|
||||
if (PortabilityLayer::MacRoman::g_toLower[c1] != PortabilityLayer::MacRoman::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
return PL_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Diacritic insensitive
|
||||
for (size_t i = 0; i < len; i++)
|
||||
{
|
||||
const uint8_t c1 = PortabilityLayer::MacLatin::g_stripDiacritic[chars1[i]];
|
||||
const uint8_t c2 = PortabilityLayer::MacLatin::g_stripDiacritic[chars2[i]];
|
||||
|
||||
if (PortabilityLayer::MacLatin::g_toLower[c1] != PortabilityLayer::MacLatin::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
const uint8_t c1 = PortabilityLayer::MacRoman::g_stripDiacritic[chars1[i]];
|
||||
const uint8_t c2 = PortabilityLayer::MacRoman::g_stripDiacritic[chars2[i]];
|
||||
|
||||
if (PortabilityLayer::MacRoman::g_toLower[c1] != PortabilityLayer::MacRoman::g_toLower[c2])
|
||||
return PL_FALSE;
|
||||
}
|
||||
|
||||
return PL_TRUE;
|
||||
}
|
||||
}
|
||||
return PL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,15 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
enum PixelFormat
|
||||
{
|
||||
PixelFormat_Invalid,
|
||||
|
||||
PixelFormat_8BitStandard,
|
||||
PixelFormat_8BitCustom,
|
||||
PixelFormat_RGB555,
|
||||
PixelFormat_RGB24,
|
||||
PixelFormat_RGB32,
|
||||
};
|
||||
}
|
@@ -137,13 +137,16 @@
|
||||
<ClInclude Include="FileManager.h" />
|
||||
<ClInclude Include="FilePermission.h" />
|
||||
<ClInclude Include="FilePos.h" />
|
||||
<ClInclude Include="FontFamily.h" />
|
||||
<ClInclude Include="FontManager.h" />
|
||||
<ClInclude Include="FontRenderer.h" />
|
||||
<ClInclude Include="GpAppInterface.h" />
|
||||
<ClInclude Include="HostAudioChannel.h" />
|
||||
<ClInclude Include="HostAudioDriver.h" />
|
||||
<ClInclude Include="HostDirectoryCursor.h" />
|
||||
<ClInclude Include="HostFont.h" />
|
||||
<ClInclude Include="HostFontHandler.h" />
|
||||
<ClInclude Include="HostFontRenderedGlyph.h" />
|
||||
<ClInclude Include="HostInputDriver.h" />
|
||||
<ClInclude Include="HostMutex.h" />
|
||||
<ClInclude Include="HostSuspendCallArgument.h" />
|
||||
@@ -159,7 +162,7 @@
|
||||
<ClInclude Include="MacFileMem.h" />
|
||||
<ClInclude Include="MacFileInfo.h" />
|
||||
<ClInclude Include="MacFileWriteableMem.h" />
|
||||
<ClInclude Include="MacLatin.h" />
|
||||
<ClInclude Include="MacRoman.h" />
|
||||
<ClInclude Include="MacRsrcHeader.h" />
|
||||
<ClInclude Include="MacRsrcMap.h" />
|
||||
<ClInclude Include="MemoryManager.h" />
|
||||
@@ -201,6 +204,7 @@
|
||||
<ClInclude Include="QDUtils.h" />
|
||||
<ClInclude Include="RandomNumberGenerator.h" />
|
||||
<ClInclude Include="Rect2i.h" />
|
||||
<ClInclude Include="RenderedFont.h" />
|
||||
<ClInclude Include="ResourceCompiledRef.h" />
|
||||
<ClInclude Include="ResourceCompiledTypeList.h" />
|
||||
<ClInclude Include="ResourceFile.h" />
|
||||
@@ -242,7 +246,9 @@
|
||||
<ClCompile Include="CFileStream.cpp" />
|
||||
<ClCompile Include="DisplayDeviceManager.cpp" />
|
||||
<ClCompile Include="FileManager.cpp" />
|
||||
<ClCompile Include="FontFamily.cpp" />
|
||||
<ClCompile Include="FontManager.cpp" />
|
||||
<ClCompile Include="FontRenderer.cpp" />
|
||||
<ClCompile Include="HostAudioDriver.cpp" />
|
||||
<ClCompile Include="HostDisplayDriver.cpp" />
|
||||
<ClCompile Include="HostFileSystem.cpp" />
|
||||
@@ -254,7 +260,7 @@
|
||||
<ClCompile Include="MacBinary2.cpp" />
|
||||
<ClCompile Include="MacFileInfo.cpp" />
|
||||
<ClCompile Include="MacFileMem.cpp" />
|
||||
<ClCompile Include="MacLatin1.cpp" />
|
||||
<ClCompile Include="MacRoman.cpp" />
|
||||
<ClCompile Include="MemoryManager.cpp" />
|
||||
<ClCompile Include="MemReaderStream.cpp" />
|
||||
<ClCompile Include="MenuManager.cpp" />
|
||||
|
@@ -318,9 +318,6 @@
|
||||
<ClInclude Include="HostDirectoryCursor.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MacLatin.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FilePos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -348,6 +345,21 @@
|
||||
<ClInclude Include="PLEventQueue.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FontFamily.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FontRenderer.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="RenderedFont.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HostFontRenderedGlyph.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MacRoman.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CFileStream.cpp">
|
||||
@@ -500,9 +512,6 @@
|
||||
<ClCompile Include="HostAudioDriver.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MacLatin1.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MenuManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -521,5 +530,14 @@
|
||||
<ClCompile Include="PLEventQueue.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FontFamily.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FontRenderer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MacRoman.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "PixelFormat.h"
|
||||
#include "GpPixelFormat.h"
|
||||
#include "QDState.h"
|
||||
#include "QDPort.h"
|
||||
|
||||
@@ -24,7 +24,7 @@ struct CGraf
|
||||
{
|
||||
}
|
||||
|
||||
int Init(const Rect &rect, PortabilityLayer::PixelFormat pixelFormat)
|
||||
int Init(const Rect &rect, GpPixelFormat_t pixelFormat)
|
||||
{
|
||||
if (int errorCode = m_port.Init(rect, pixelFormat))
|
||||
return errorCode;
|
||||
|
@@ -54,18 +54,18 @@ namespace PortabilityLayer
|
||||
|
||||
int QDManagerImpl::NewGWorld(CGraf **gw, int depth, const Rect &bounds, ColorTable **colorTable, GDevice **device, int flags)
|
||||
{
|
||||
PixelFormat pixelFormat;
|
||||
GpPixelFormat_t pixelFormat;
|
||||
|
||||
switch (depth)
|
||||
{
|
||||
case 8:
|
||||
pixelFormat = (colorTable == nullptr) ? PixelFormat_8BitStandard : PixelFormat_8BitCustom;
|
||||
pixelFormat = (colorTable == nullptr) ? GpPixelFormats::k8BitStandard : GpPixelFormats::k8BitCustom;
|
||||
break;
|
||||
case 16:
|
||||
pixelFormat = PixelFormat_RGB555;
|
||||
pixelFormat = GpPixelFormats::kRGB555;
|
||||
break;
|
||||
case 32:
|
||||
pixelFormat = PixelFormat_RGB32;
|
||||
pixelFormat = GpPixelFormats::kRGB32;
|
||||
break;
|
||||
default:
|
||||
return genericErr;
|
||||
|
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
PixMapImpl::PixMapImpl(int16_t left, int16_t top, uint16_t width, uint16_t height, PixelFormat pixelFormat)
|
||||
PixMapImpl::PixMapImpl(int16_t left, int16_t top, uint16_t width, uint16_t height, GpPixelFormat_t pixelFormat)
|
||||
: m_left(left)
|
||||
, m_top(top)
|
||||
, m_width(width)
|
||||
@@ -22,7 +22,7 @@ namespace PortabilityLayer
|
||||
static_cast<PixMap*>(this)->Init(rect, pixelFormat, PitchForWidth(width, pixelFormat), dataPtr);
|
||||
}
|
||||
|
||||
size_t PixMapImpl::SizeForDimensions(uint16_t width, uint16_t height, PixelFormat pixelFormat)
|
||||
size_t PixMapImpl::SizeForDimensions(uint16_t width, uint16_t height, GpPixelFormat_t pixelFormat)
|
||||
{
|
||||
return AlignedSize() + PitchForWidth(width, pixelFormat) * height;
|
||||
}
|
||||
@@ -35,23 +35,23 @@ namespace PortabilityLayer
|
||||
return szAdjusted;
|
||||
}
|
||||
|
||||
size_t PixMapImpl::PitchForWidth(uint16_t width, PixelFormat pixelFormat)
|
||||
size_t PixMapImpl::PitchForWidth(uint16_t width, GpPixelFormat_t pixelFormat)
|
||||
{
|
||||
size_t rowByteCount = 0;
|
||||
|
||||
switch (pixelFormat)
|
||||
{
|
||||
case PixelFormat_8BitCustom:
|
||||
case PixelFormat_8BitStandard:
|
||||
case GpPixelFormats::k8BitCustom:
|
||||
case GpPixelFormats::k8BitStandard:
|
||||
rowByteCount = width;
|
||||
break;
|
||||
case PixelFormat_RGB555:
|
||||
case GpPixelFormats::kRGB555:
|
||||
rowByteCount = width * 2;
|
||||
break;
|
||||
case PixelFormat_RGB24:
|
||||
case GpPixelFormats::kRGB24:
|
||||
rowByteCount = width * 3;
|
||||
break;
|
||||
case PixelFormat_RGB32:
|
||||
case GpPixelFormats::kRGB32:
|
||||
rowByteCount = width * 4;
|
||||
break;
|
||||
default:
|
||||
@@ -65,7 +65,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
void PixMap::Init(const Rect &rect, PortabilityLayer::PixelFormat pixelFormat, size_t pitch, void *dataPtr)
|
||||
void PixMap::Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr)
|
||||
{
|
||||
BitMap::Init(rect, pixelFormat, pitch, dataPtr);
|
||||
}
|
||||
|
@@ -1,65 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLQuickdraw.h"
|
||||
#include "PixelFormat.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct PixMap : public BitMap
|
||||
{
|
||||
void Init(const Rect &rect, PortabilityLayer::PixelFormat pixelFormat, size_t pitch, void *dataPtr);
|
||||
};
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class PixMapImpl final : public PixMap
|
||||
{
|
||||
public:
|
||||
PixMapImpl(int16_t left, int16_t top, uint16_t width, uint16_t height, PixelFormat pixelFormat);
|
||||
|
||||
PixelFormat GetPixelFormat() const;
|
||||
size_t GetPitch() const;
|
||||
void *GetPixelData();
|
||||
const void *GetPixelData() const;
|
||||
size_t GetDataCapacity() const;
|
||||
|
||||
static size_t SizeForDimensions(uint16_t width, uint16_t height, PixelFormat pixelFormat);
|
||||
|
||||
private:
|
||||
static size_t AlignedSize();
|
||||
static size_t PitchForWidth(uint16_t width, PixelFormat pixelFormat);
|
||||
|
||||
int16_t m_left;
|
||||
int16_t m_top;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
#pragma once
|
||||
|
||||
size_t m_dataCapacity;
|
||||
};
|
||||
}
|
||||
|
||||
inline PortabilityLayer::PixelFormat PortabilityLayer::PixMapImpl::GetPixelFormat() const
|
||||
{
|
||||
return m_pixelFormat;
|
||||
}
|
||||
|
||||
inline size_t PortabilityLayer::PixMapImpl::GetPitch() const
|
||||
{
|
||||
return m_pitch;
|
||||
}
|
||||
|
||||
inline void *PortabilityLayer::PixMapImpl::GetPixelData()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
inline const void *PortabilityLayer::PixMapImpl::GetPixelData() const
|
||||
{
|
||||
return m_data;
|
||||
#include "PLBigEndian.h"
|
||||
#include "PLQuickdraw.h"
|
||||
#include "GpPixelFormat.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
struct PixMap : public BitMap
|
||||
{
|
||||
void Init(const Rect &rect, GpPixelFormat_t pixelFormat, size_t pitch, void *dataPtr);
|
||||
};
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
class PixMapImpl final : public PixMap
|
||||
{
|
||||
public:
|
||||
PixMapImpl(int16_t left, int16_t top, uint16_t width, uint16_t height, GpPixelFormat_t pixelFormat);
|
||||
|
||||
GpPixelFormat_t GetPixelFormat() const;
|
||||
size_t GetPitch() const;
|
||||
void *GetPixelData();
|
||||
const void *GetPixelData() const;
|
||||
size_t GetDataCapacity() const;
|
||||
|
||||
static size_t SizeForDimensions(uint16_t width, uint16_t height, GpPixelFormat_t pixelFormat);
|
||||
|
||||
private:
|
||||
static size_t AlignedSize();
|
||||
static size_t PitchForWidth(uint16_t width, GpPixelFormat_t pixelFormat);
|
||||
|
||||
int16_t m_left;
|
||||
int16_t m_top;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
|
||||
size_t m_dataCapacity;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
inline GpPixelFormat_t PortabilityLayer::PixMapImpl::GetPixelFormat() const
|
||||
{
|
||||
return m_pixelFormat;
|
||||
}
|
||||
|
||||
inline size_t PortabilityLayer::PixMapImpl::GetPitch() const
|
||||
{
|
||||
return m_pitch;
|
||||
}
|
||||
|
||||
inline void *PortabilityLayer::PixMapImpl::GetPixelData()
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
inline const void *PortabilityLayer::PixMapImpl::GetPixelData() const
|
||||
{
|
||||
return m_data;
|
||||
}
|
||||
|
||||
inline size_t PortabilityLayer::PixMapImpl::GetDataCapacity() const
|
||||
{
|
||||
return m_dataCapacity;
|
||||
}
|
||||
{
|
||||
return m_dataCapacity;
|
||||
}
|
||||
|
@@ -13,7 +13,7 @@ namespace PortabilityLayer
|
||||
, m_width(0)
|
||||
, m_height(0)
|
||||
, m_pixMap(nullptr)
|
||||
, m_pixelFormat(PixelFormat_Invalid)
|
||||
, m_pixelFormat(GpPixelFormats::kInvalid)
|
||||
, m_dirtyFlags(0)
|
||||
{
|
||||
}
|
||||
@@ -33,7 +33,7 @@ namespace PortabilityLayer
|
||||
}
|
||||
}
|
||||
|
||||
int QDPort::Init(const Rect &rect, PixelFormat pixelFormat)
|
||||
int QDPort::Init(const Rect &rect, GpPixelFormat_t pixelFormat)
|
||||
{
|
||||
m_pixMap = nullptr;
|
||||
m_pixelFormat = pixelFormat;
|
||||
@@ -57,6 +57,8 @@ namespace PortabilityLayer
|
||||
if (!pmBlock)
|
||||
return false;
|
||||
|
||||
memset(pmBlock->m_contents, 0, pixMapSize);
|
||||
|
||||
SetDirty(QDPortDirtyFlag_Size | QDPortDirtyFlag_Contents);
|
||||
|
||||
m_left = rect.left;
|
||||
@@ -103,7 +105,7 @@ namespace PortabilityLayer
|
||||
return &m_state;
|
||||
}
|
||||
|
||||
PixelFormat QDPort::GetPixelFormat() const
|
||||
GpPixelFormat_t QDPort::GetPixelFormat() const
|
||||
{
|
||||
return m_pixelFormat;
|
||||
}
|
||||
|
@@ -1,11 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include "PixelFormat.h"
|
||||
#include "GpPixelFormat.h"
|
||||
#include "QDState.h"
|
||||
|
||||
struct PixMap;
|
||||
struct Rect;
|
||||
struct Rect;
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
@@ -14,28 +14,28 @@ namespace PortabilityLayer
|
||||
QDPortType_Invalid,
|
||||
|
||||
QDPortType_CGraf,
|
||||
QDPortType_Window,
|
||||
QDPortType_Window,
|
||||
};
|
||||
|
||||
enum QDPortDirtyFlag
|
||||
{
|
||||
{
|
||||
QDPortDirtyFlag_Size = 1,
|
||||
QDPortDirtyFlag_Contents = 2,
|
||||
};
|
||||
};
|
||||
|
||||
class QDPort
|
||||
{
|
||||
public:
|
||||
explicit QDPort(QDPortType portType);
|
||||
~QDPort();
|
||||
~QDPort();
|
||||
|
||||
int Init(const Rect &rect, PixelFormat pixelFormat);
|
||||
int Init(const Rect &rect, GpPixelFormat_t pixelFormat);
|
||||
QDPortType GetPortType() const;
|
||||
|
||||
|
||||
PixMap **GetPixMap() const;
|
||||
const QDState *GetState() const;
|
||||
QDState *GetState();
|
||||
PixelFormat GetPixelFormat() const;
|
||||
GpPixelFormat_t GetPixelFormat() const;
|
||||
Rect GetRect() const;
|
||||
|
||||
bool Resize(const Rect &rect);
|
||||
@@ -47,17 +47,17 @@ namespace PortabilityLayer
|
||||
private:
|
||||
void DisposePixMap();
|
||||
|
||||
QDPortType m_portType;
|
||||
QDPortType m_portType;
|
||||
|
||||
QDState m_state;
|
||||
PixMap **m_pixMap;
|
||||
|
||||
int16_t m_left;
|
||||
int16_t m_top;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
QDState m_state;
|
||||
PixMap **m_pixMap;
|
||||
|
||||
int16_t m_left;
|
||||
int16_t m_top;
|
||||
uint16_t m_width;
|
||||
uint16_t m_height;
|
||||
uint32_t m_dirtyFlags;
|
||||
PixelFormat m_pixelFormat;
|
||||
GpPixelFormat_t m_pixelFormat;
|
||||
};
|
||||
|
||||
inline QDPortType QDPort::GetPortType() const
|
||||
|
14
PortabilityLayer/RenderedFont.h
Normal file
14
PortabilityLayer/RenderedFont.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedGlyphMetrics;
|
||||
|
||||
class RenderedFont
|
||||
{
|
||||
public:
|
||||
virtual bool GetGlyph(unsigned int character, const RenderedGlyphMetrics **outMetricsPtr, const void **outData) const = 0;
|
||||
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
}
|
18
PortabilityLayer/RenderedGlyphMetrics.h
Normal file
18
PortabilityLayer/RenderedGlyphMetrics.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace PortabilityLayer
|
||||
{
|
||||
struct RenderedGlyphMetrics
|
||||
{
|
||||
size_t m_glyphDataPitch;
|
||||
|
||||
uint32_t m_glyphWidth;
|
||||
uint32_t m_glyphHeight;
|
||||
|
||||
int16_t m_bearingX;
|
||||
int16_t m_bearingY;
|
||||
int16_t m_advanceX;
|
||||
};
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreDefs.h"
|
||||
#include "GpPixelFormat.h"
|
||||
#include "PLBigEndian.h"
|
||||
#include "PixelFormat.h"
|
||||
#include "RGBAColor.h"
|
||||
|
||||
struct Point
|
||||
@@ -93,7 +93,7 @@ struct BEColorTableItem
|
||||
|
||||
struct GDevice
|
||||
{
|
||||
PortabilityLayer::PixelFormat pixelFormat;
|
||||
GpPixelFormat_t pixelFormat;
|
||||
|
||||
uint8_t paletteStorage[256 * 4 + PL_SYSTEM_MEMORY_ALIGNMENT];
|
||||
uint8_t paletteDataOffset;
|
||||
|
Reference in New Issue
Block a user