libgambatte/bitmap_font: use ptrdiff_t for pitch

This commit is contained in:
sinamas 2013-02-20 20:28:54 +01:00
parent 20abdc825f
commit 05efd9f4af
3 changed files with 7 additions and 9 deletions

View File

@ -291,13 +291,13 @@ class Rgb32Fill {
public:
explicit Rgb32Fill(unsigned long color) : color(color) {}
void operator()(gambatte::uint_least32_t *dest, unsigned /*pitch*/) const {
void operator()(gambatte::uint_least32_t *dest, std::ptrdiff_t /*pitch*/) const {
*dest = color;
}
};
}
void print(gambatte::uint_least32_t *dest, const unsigned pitch, const unsigned long color, const char *chars) {
void print(gambatte::uint_least32_t *dest, std::ptrdiff_t pitch, unsigned long color, const char *chars) {
print(dest, pitch, Rgb32Fill(color), chars);
}

View File

@ -39,11 +39,11 @@ enum { NUMBER_WIDTH = 6 };
std::size_t getWidth(const char *chars);
// struct Fill { void operator()(RandomAccessIterator dest, unsigned pitch) { fill pixels at dest } }
// struct Fill { void operator()(RandomAccessIterator dest, std::ptrdiff_t pitch) { fill pixels at dest } }
template<class RandomAccessIterator, class Fill>
void print(RandomAccessIterator dest, unsigned pitch, Fill fill, const char *chars);
void print(RandomAccessIterator dest, std::ptrdiff_t pitch, Fill fill, const char *chars);
void print(gambatte::uint_least32_t *dest, unsigned pitch, unsigned long color, const char *chars);
void print(gambatte::uint_least32_t *dest, std::ptrdiff_t pitch, unsigned long color, const char *chars);
void utoa(unsigned u, char *a);
// --- INTERFACE END ---
@ -53,17 +53,15 @@ void utoa(unsigned u, char *a);
extern const unsigned char *const font[];
template<class RandomAccessIterator, class Fill>
void print(RandomAccessIterator dest, const unsigned pitch, Fill fill, const char *chars) {
void print(RandomAccessIterator dest, const std::ptrdiff_t pitch, Fill fill, const char *chars) {
while (const int character = *chars++) {
RandomAccessIterator dst = dest;
const unsigned char *s = font[character];
const unsigned width = *s >> 4;
unsigned h = *s++ & 0xF;
while (h--) {
RandomAccessIterator d = dst;
unsigned line = *s++;
if (width > 8)

View File

@ -36,7 +36,7 @@ static const std::size_t stateSavedWidth = getWidth(stateSaved);
class ShadedTextOsdElment : public OsdElement {
struct ShadeFill {
void operator()(uint_least32_t *dest, const unsigned pitch) const {
void operator()(uint_least32_t *dest, const std::ptrdiff_t pitch) const {
dest[2] = dest[1] = dest[0] = 0x000000ul;
dest += pitch;
dest[2] = dest[0] = 0x000000ul;