* Start protecting FTBuffer members using getters and setters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
diff --git a/src/FTFont/FTBufferFont.cpp b/src/FTFont/FTBufferFont.cpp
index 29e3058..1ea6a4b 100644
--- a/src/FTFont/FTBufferFont.cpp
+++ b/src/FTFont/FTBufferFont.cpp
@@ -277,7 +277,7 @@ inline FTPoint FTBufferFontImpl::RenderI(const T* string, const int len,
buffer->width = texWidth;
buffer->height = texHeight;
buffer->pitch = texWidth;
- buffer->pos = FTPoint(padding, padding) - bbox.Lower();
+ buffer->Pos(FTPoint(padding, padding) - bbox.Lower());
advanceCache[cacheIndex] =
FTFontImpl::Render(string, len, FTPoint(), spacing, renderMode);
diff --git a/src/FTGL/FTBuffer.h b/src/FTGL/FTBuffer.h
index 384bbd0..fa11ea9 100644
--- a/src/FTGL/FTBuffer.h
+++ b/src/FTGL/FTBuffer.h
@@ -45,10 +45,30 @@
class FTGL_EXPORT FTBuffer
{
public:
+ /**
+ * Default constructor.
+ */
FTBuffer();
+
+ /**
+ * Destructor
+ */
~FTBuffer();
+
+ inline FTPoint Pos() const
+ {
+ return pos;
+ }
+
+ inline void Pos(FTPoint arg)
+ {
+ pos = arg;
+ }
+
int width, height, pitch;
unsigned char *pixels;
+
+ private:
FTPoint pos;
};
diff --git a/src/FTGlyph/FTBufferGlyph.cpp b/src/FTGlyph/FTBufferGlyph.cpp
index 24d95ed..41bd8a0 100644
--- a/src/FTGlyph/FTBufferGlyph.cpp
+++ b/src/FTGlyph/FTBufferGlyph.cpp
@@ -92,7 +92,7 @@ const FTPoint& FTBufferGlyphImpl::RenderImpl(const FTPoint& pen, int renderMode)
{
if(has_bitmap)
{
- FTPoint pos(buffer->pos + pen + corner);
+ FTPoint pos(buffer->Pos() + pen + corner);
int dx = (int)(pos.Xf() + 0.5f);
int dy = buffer->height - (int)(pos.Yf() + 0.5f);
unsigned char * dest = buffer->pixels + dx + dy * buffer->pitch;