mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2024-11-24 09:15:42 +01:00
Add a lot of comments and code cleanup
This commit is contained in:
parent
f1f1294b2e
commit
fc1baea05f
@ -62,7 +62,7 @@ class TCMutex;
|
||||
|
||||
struct BlockStat {
|
||||
friend class BlockStatManager;
|
||||
public:
|
||||
public:
|
||||
BlockStat(const CHAR *statName, int);
|
||||
BlockStat(const CHAR *statName, double stat);
|
||||
|
||||
@ -71,7 +71,7 @@ public:
|
||||
|
||||
void ToString(CHAR *buf, int bufSz) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
const enum Type {
|
||||
eType_Float,
|
||||
eType_Int,
|
||||
@ -95,8 +95,14 @@ class BlockStatManager {
|
||||
BlockStatManager &operator=(const BlockStatManager &);
|
||||
~BlockStatManager();
|
||||
|
||||
// A thread-safe version that returns a list index for recording
|
||||
// block statistics.
|
||||
uint32 BeginBlock();
|
||||
|
||||
// Add a stat for a given block. This is thread-safe
|
||||
void AddStat(uint32 blockIdx, const BlockStat &stat);
|
||||
|
||||
// Write the statistics to a file.
|
||||
void ToFile(const CHAR *filename);
|
||||
|
||||
private:
|
||||
|
@ -66,6 +66,10 @@ class CompressedImage {
|
||||
void InitData(const unsigned char *withData);
|
||||
public:
|
||||
CompressedImage();
|
||||
|
||||
// Create a compressed image from the given data according to
|
||||
// the passed format. The size of the data is expected to conform
|
||||
// to the width, height, and format specified.
|
||||
CompressedImage(
|
||||
const unsigned int width,
|
||||
const unsigned int height,
|
||||
@ -79,6 +83,10 @@ class CompressedImage {
|
||||
CompressedImage( const CompressedImage &other );
|
||||
~CompressedImage();
|
||||
|
||||
// Decompress the compressed image data into outBuf. outBufSz is expected
|
||||
// to be the proper size determined by the width, height, and format.
|
||||
// !FIXME! We should have a function to explicitly return the in/out buf
|
||||
// size for a given compressed image.
|
||||
bool DecompressImage(unsigned char *outBuf, unsigned int outBufSz) const;
|
||||
};
|
||||
|
||||
|
@ -47,15 +47,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
|
||||
#include "FileStream.h"
|
||||
#include "Thread.h"
|
||||
|
||||
template <typename T>
|
||||
static T max(const T &a, const T &b) {
|
||||
return (a > b)? a : b;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// BlockStat implementation
|
||||
@ -150,7 +146,7 @@ BlockStatManager &BlockStatManager::operator=(const BlockStatManager &other) {
|
||||
}
|
||||
|
||||
BlockStatManager::BlockStatManager(int nBlocks)
|
||||
: m_BlockStatListSz(max(nBlocks, 0))
|
||||
: m_BlockStatListSz(std::max(nBlocks, 0))
|
||||
, m_NextBlock(0)
|
||||
, m_Mutex(new TCMutex)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user