Font: Add clone constructor
This commit is contained in:
parent
f067e0eff8
commit
7549778dc6
15
src/font.cpp
15
src/font.cpp
|
@ -154,6 +154,16 @@ struct FontPrivate
|
|||
sdlFont = shState->fontPool().request(this->name.constData(),
|
||||
this->size);
|
||||
}
|
||||
|
||||
FontPrivate(const FontPrivate &other)
|
||||
: name(other.name),
|
||||
size(other.size),
|
||||
bold(other.bold),
|
||||
italic(other.italic),
|
||||
color(&colorTmp),
|
||||
colorTmp(*other.color),
|
||||
sdlFont(other.sdlFont)
|
||||
{}
|
||||
};
|
||||
|
||||
QByteArray FontPrivate::defaultName = "Arial";
|
||||
|
@ -177,6 +187,11 @@ Font::Font(const char *name,
|
|||
p = new FontPrivate(name, size);
|
||||
}
|
||||
|
||||
Font::Font(const Font &other)
|
||||
{
|
||||
p = new FontPrivate(*other.p);
|
||||
}
|
||||
|
||||
Font::~Font()
|
||||
{
|
||||
delete p;
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
|
||||
Font(const char *name = 0,
|
||||
int size = 0);
|
||||
/* Clone constructor */
|
||||
Font(const Font &other);
|
||||
~Font();
|
||||
|
||||
const char *getName() const;
|
||||
|
|
Loading…
Reference in New Issue